Skip to content

Render 3-shards mongodb manifests #1845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: development/2.7
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION="2.7.2"
VERSION="2.7.3"
VERSION_SUFFIX=

VERSION_FULL="${VERSION}${VERSION_SUFFIX}"
6 changes: 5 additions & 1 deletion solution-base/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ MONGODB_SINGLE_NODE_PATH=${ISO_ROOT}/deploy/mongodb-1-node.yaml
MONGODB_THREE_NODE_PATH=${ISO_ROOT}/deploy/mongodb-3-nodes.yaml
MONGODB_SHARDED_SINGLE_NODE_PATH=${ISO_ROOT}/deploy/mongodb-sharded-1-node.yaml
MONGODB_SHARDED_THREE_NODE_PATH=${ISO_ROOT}/deploy/mongodb-sharded-3-nodes.yaml
MONGODB_SHARDED_SINGLE_NODE_THREE_SHARDS_PATH=${ISO_ROOT}/deploy/mongodb-sharded-1-node-3-shards.yaml
MONGODB_SHARDED_THREE_NODE_THREE_SHARDS_PATH=${ISO_ROOT}/deploy/mongodb-sharded-3-nodes-3-shards.yaml
Comment on lines +40 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am interested in having a bit more context, this will create two new yaml files for MongoDB, each containing multiple resources, right? But I am not able to see where it is used in https://github.com/scality/artesca/pull/1721/files#diff-9f3a8c4af71c5060627586aa78119e38ab963af820e4b554b5d204c369f8534cR28 (more specifically, how the nShards is linked at install and upgrade time).

I am asking because my PR to handle mongodb upgrade must also handle this case, but I do see logic in the Zenko.py file still relying on only one shard (like in https://github.com/scality/artesca/blob/e16707350054fbfa6980131206358ff57d4075c6/installer/artesca_installer/salt/_modules/zenko.py#L158), am I missing something?


SOLUTION_ENV='SOLUTION_ENV'

Expand Down Expand Up @@ -199,7 +201,9 @@ function render_mongodb_sharded_yamls()
function mongodb_sharded_yamls()
{
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SINGLE_NODE_PATH}" 1 1
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_PATH}" 1 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_PATH}" 1 3
render_mongodb_sharded_yamls "${MONGODB_SHARDED_SINGLE_NODE_THREE_SHARDS_PATH}" 3 1
render_mongodb_sharded_yamls "${MONGODB_SHARDED_THREE_NODE_THREE_SHARDS_PATH}" 3 3
}

function gen_manifest_yaml()
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 telemtry 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,4 +37,8 @@ data:
{{- end }}
fi

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

exec /entrypoint.sh /run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ spec:
{{- end }}
{{- if $.Values.shardsvr.persistence.selector }}
selector:
{{ toYaml $.Values.shardsvr.persistence.selector | indent 10 }}
matchLabels:
shard: '{{ $i }}'
{{ toYaml $.Values.shardsvr.persistence.selector.matchLabels | indent 12 }}
Comment on lines +377 to +379
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this goes into a patch file as wel?

{{- end }}
resources:
requests:
Expand Down
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 telemtry 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 telemtry to support offline deployments
mongosh --nodb --eval "disableTelemetry()"
+ info "MongoDB Telemetry is now disabled."

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