Skip to content

Commit

Permalink
ZENKO-4527: patch mongodb charts to disable telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
williamlardier committed Apr 18, 2023
1 parent d073520 commit 7f323a5
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 2 deletions.
2 changes: 1 addition & 1 deletion solution-base/deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# yq eval 'sortKeys(.)' -i deps.yaml
mongodb:
image: bitnami/mongodb
tag: 4.2.21-debian-10-r8
tag: 4.0.27-debian-9-r118
mongodb-exporter:
image: bitnami/mongodb-exporter
tag: 0.34.0-debian-11-r24
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ spec:
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
command:
- /bin/bash
- /entrypoint/mongos-entrypoint.sh
env:
- name: MONGODB_ENABLE_NUMACTL
value: {{ ternary "yes" "no" $.Values.common.mongodbEnableNumactl | quote }}
Expand Down Expand Up @@ -209,6 +212,8 @@ spec:
{{- end }}
{{- end }}
volumeMounts:
- name: replicaset-entrypoint-configmap
mountPath: /entrypoint
{{- if .Values.usePasswordFile }}
- name: secrets
mountPath: /bitnami/mongodb/secrets/
Expand Down Expand Up @@ -299,6 +304,9 @@ spec:
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
{{- end }}
volumes:
- name: replicaset-entrypoint-configmap
configMap:
name: {{ include "common.names.fullname" . }}-replicaset-entrypoint
{{- if .Values.usePasswordFile }}
- name: secrets
secret:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ metadata:
name: {{ include "common.names.fullname" . }}-replicaset-entrypoint
labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
mongos-entrypoint.sh: |-
#!/bin/bash
. /liblog.sh
# Disable MongoSH telemetry to support offline deployments
mongosh --nodb --eval "disableTelemetry()"
info "MongoDB Telemetry is now disabled."
exec /entrypoint.sh /run.sh
replicaset-entrypoint.sh: |-
#!/bin/bash
Expand All @@ -27,7 +37,8 @@ data:
{{- end }}
fi
# Disable MongoSH telemtry to support offline deployments
# Disable MongoSH telemetry to support offline deployments
mongosh --nodb --eval "disableTelemetry()"
info "MongoDB Telemetry is now disabled."
exec /entrypoint.sh /run.sh
36 changes: 36 additions & 0 deletions solution-base/mongodb/patches/mongos-dep-sts.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/solution-base/mongodb/charts/mongodb-sharded/templates/mongos/mongos-dep-sts.yaml b/solution-base/mongodb/charts/mongodb-sharded/templates/mongos/mongos-dep-sts.yaml
index 6be3476e..0bc6f8a9 100644
--- a/solution-base/mongodb/charts/mongodb-sharded/templates/mongos/mongos-dep-sts.yaml
+++ b/solution-base/mongodb/charts/mongodb-sharded/templates/mongos/mongos-dep-sts.yaml
@@ -84,6 +84,9 @@ spec:
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
+ command:
+ - /bin/bash
+ - /entrypoint/mongos-entrypoint.sh
env:
- name: MONGODB_ENABLE_NUMACTL
value: {{ ternary "yes" "no" $.Values.common.mongodbEnableNumactl | quote }}
@@ -209,6 +212,8 @@ spec:
{{- end }}
{{- end }}
volumeMounts:
+ - name: replicaset-entrypoint-configmap
+ mountPath: /entrypoint
{{- if .Values.usePasswordFile }}
- name: secrets
mountPath: /bitnami/mongodb/secrets/
@@ -299,6 +304,9 @@ spec:
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
{{- end }}
volumes:
+ - name: replicaset-entrypoint-configmap
+ configMap:
+ name: {{ include "common.names.fullname" . }}-replicaset-entrypoint
{{- if .Values.usePasswordFile }}
- name: secrets
secret:
--
2.25.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/solution-base/mongodb/charts/mongodb-sharded/templates/replicaset-entrypoint-configmap.yaml b/solution-base/mongodb/charts/mongodb-sharded/templates/replicaset-entrypoint-configmap.yaml
index 22bdc5d7..36526df2 100644
--- a/solution-base/mongodb/charts/mongodb-sharded/templates/replicaset-entrypoint-configmap.yaml
+++ b/solution-base/mongodb/charts/mongodb-sharded/templates/replicaset-entrypoint-configmap.yaml
@@ -4,6 +4,16 @@ metadata:
name: {{ include "common.names.fullname" . }}-replicaset-entrypoint
labels: {{- include "common.labels.standard" . | nindent 4 }}
data:
+ mongos-entrypoint.sh: |-
+ #!/bin/bash
+
+ . /liblog.sh
+
+ # Disable MongoSH telemetry to support offline deployments
+ mongosh --nodb --eval "disableTelemetry()"
+ info "MongoDB Telemetry is now disabled."
+
+ exec /entrypoint.sh /run.sh
replicaset-entrypoint.sh: |-
#!/bin/bash

@@ -29,5 +39,6 @@ data:

+ # Disable MongoSH telemetry to support offline deployments
+ mongosh --nodb --eval "disableTelemetry()"
+ info "MongoDB Telemetry is now disabled."

exec /entrypoint.sh /run.sh
--
2.25.1

0 comments on commit 7f323a5

Please sign in to comment.