Skip to content

Commit bf273b2

Browse files
authored
K8SPSMDB-991 - Add PMM_AGENT_PATHS_TEMPDIR env var for pmm-agent sidecar (#1350)
* K8SPSMDB-991 - Add PMM_AGENT_PATHS_TEMPDIR env var for pmm-agent sidecar * K8SPSMDB-991 - Update PMM_AGENT_PATHS_TEMPDIR to /data/db/pmm2/tmp * Set PMM_AGENT_PATHS_TEMPDIR to /tmp * Set PMM_AGENT_PATHS_TEMPDIR only if crVersion >= 1.15.0 * Fix monitoring and default-cr test for openshift
1 parent dcd248c commit bf273b2

File tree

9 files changed

+39
-1
lines changed

9 files changed

+39
-1
lines changed

e2e-tests/default-cr/run

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,17 @@ function main() {
110110
"spec": {"pmm":{"enabled":false}}
111111
}'
112112
sleep 120
113+
114+
if [[ -n ${OPENSHIFT} ]]; then
115+
oc adm policy remove-scc-from-user privileged -z pmm-server
116+
if [ -n "$OPERATOR_NS" ]; then
117+
oc delete clusterrolebinding pmm-psmdb-operator-cluster-wide
118+
else
119+
oc delete rolebinding pmm-psmdb-operator-namespace-only
120+
fi
121+
fi
113122
helm uninstall monitoring
123+
114124
wait_cluster_consistency $cluster
115125

116126
desc 'enabling arbiter'

e2e-tests/monitoring-2-0/compare/statefulset_monitoring-cfg-oc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,8 @@ spec:
232232
value: "true"
233233
- name: PMM_AGENT_SIDECAR_SLEEP
234234
value: "5"
235+
- name: PMM_AGENT_PATHS_TEMPDIR
236+
value: /tmp
235237
imagePullPolicy: Always
236238
lifecycle:
237239
preStop:

e2e-tests/monitoring-2-0/compare/statefulset_monitoring-cfg.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ spec:
233233
value: "true"
234234
- name: PMM_AGENT_SIDECAR_SLEEP
235235
value: "5"
236+
- name: PMM_AGENT_PATHS_TEMPDIR
237+
value: /tmp
236238
imagePullPolicy: Always
237239
lifecycle:
238240
preStop:

e2e-tests/monitoring-2-0/compare/statefulset_monitoring-mongos-oc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ spec:
234234
value: "true"
235235
- name: PMM_AGENT_SIDECAR_SLEEP
236236
value: "5"
237+
- name: PMM_AGENT_PATHS_TEMPDIR
238+
value: /tmp
237239
imagePullPolicy: Always
238240
lifecycle:
239241
preStop:

e2e-tests/monitoring-2-0/compare/statefulset_monitoring-mongos.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,8 @@ spec:
235235
value: "true"
236236
- name: PMM_AGENT_SIDECAR_SLEEP
237237
value: "5"
238+
- name: PMM_AGENT_PATHS_TEMPDIR
239+
value: /tmp
238240
imagePullPolicy: Always
239241
lifecycle:
240242
preStop:

e2e-tests/monitoring-2-0/compare/statefulset_monitoring-rs0-oc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ spec:
220220
value: "true"
221221
- name: PMM_AGENT_SIDECAR_SLEEP
222222
value: "5"
223+
- name: PMM_AGENT_PATHS_TEMPDIR
224+
value: /tmp
223225
imagePullPolicy: Always
224226
lifecycle:
225227
preStop:

e2e-tests/monitoring-2-0/compare/statefulset_monitoring-rs0.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ spec:
221221
value: "true"
222222
- name: PMM_AGENT_SIDECAR_SLEEP
223223
value: "5"
224+
- name: PMM_AGENT_PATHS_TEMPDIR
225+
value: /tmp
224226
imagePullPolicy: Always
225227
lifecycle:
226228
preStop:

e2e-tests/monitoring-2-0/run

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ get_qan_values mongodb "dev-mongod" admin:admin
114114
get_qan_values mongodb "dev-mongos" admin:admin
115115

116116
if [[ -n ${OPENSHIFT} ]]; then
117-
oc adm policy remove-scc-from-user privileged -z percona-server-mongodb-operator
117+
oc adm policy remove-scc-from-user privileged -z pmm-server
118+
if [ -n "$OPERATOR_NS" ]; then
119+
oc delete clusterrolebinding pmm-psmdb-operator-cluster-wide
120+
else
121+
oc delete rolebinding pmm-psmdb-operator-namespace-only
122+
fi
118123
fi
119124

120125
if [[ $(kubectl_bin logs monitoring-rs0-0 pmm-client | grep -c 'cannot auto discover databases and collections') != 0 ]]; then

pkg/psmdb/pmm.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,17 @@ func AddPMMContainer(ctx context.Context, cr *api.PerconaServerMongoDB, secret *
374374
}
375375
pmmC.Env = append(pmmC.Env, sidecarEnvs...)
376376
}
377+
if cr.CompareVersion("1.15.0") >= 0 {
378+
// PMM team moved temp directory to /usr/local/percona/pmm2/tmp
379+
// but it doesn't work on OpenShift so we set it back to /tmp
380+
sidecarEnvs := []corev1.EnvVar{
381+
{
382+
Name: "PMM_AGENT_PATHS_TEMPDIR",
383+
Value: "/tmp",
384+
},
385+
}
386+
pmmC.Env = append(pmmC.Env, sidecarEnvs...)
387+
}
377388

378389
return &pmmC
379390
}

0 commit comments

Comments
 (0)