revert(mongodb): revert replicaset (#2567)

* revert(mongodb): revert replicaset

* cleanup
This commit is contained in:
Stavros Kois 2022-04-25 22:02:58 +03:00 committed by GitHub
parent 88ec771f7a
commit 275a821a77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 90 deletions

View File

@ -23,7 +23,7 @@ sources:
- https://github.com/bitnami/bitnami-docker-mongodb - https://github.com/bitnami/bitnami-docker-mongodb
- https://www.mongodb.com - https://www.mongodb.com
type: application type: application
version: 0.1.7 version: 0.1.8
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- database - database

View File

@ -97,27 +97,6 @@ questions:
type: string type: string
default: "" default: ""
required: true required: true
- variable: mongodbReplicasetMode
group: "App Configuration"
label: "ReplicaSet Mode"
schema:
type: string
default: "primary"
required: true
- variable: mongodbReplicasetName
group: "App Configuration"
label: "ReplicaSet Name"
schema:
type: string
default: "rs0"
required: true
- variable: mongodbReplicasetKey
group: "App Configuration"
label: "ReplicaSet Key"
schema:
type: string
default: "testreplicasetkey"
required: true
- variable: service - variable: service
group: "Networking and Services" group: "Networking and Services"

View File

@ -1,20 +1 @@
{{- include "common.setup" . }} {{- include "common.all" . }}
{{/* Append the hardcoded settings */}}
{{- define "mongodb.harcodedValues" -}}
persistence:
focalboard-config:
enabled: "true"
mountPath: "/docker-entrypoint-initdb.d/create-oplog-user.sh"
subPath: "create-oplog-user.sh"
type: "custom"
volumeSpec:
configMap:
name: {{ printf "%v-create-oplog-user" (include "common.names.fullname" .) }}
{{- end -}}
{{- $_ := mergeOverwrite .Values (include "mongodb.harcodedValues" . | fromYaml) -}}
{{- include "mongodb.configmap" . }}
{{/* Render the templates */}}
{{ include "common.postSetup" . }}

View File

@ -1,28 +0,0 @@
{{- define "mongodb.configmap" -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "common.names.fullname" . }}-create-oplog-user
labels:
{{- include "common.labels" . | nindent 4 }}
data:
create-oplog-user.sh: |-
#!/bin/bash
echo "Generating command for oplog user creation...";
# '.script' extension is just to avoid the bitnami init script to executing it. (bitnami executes .sh and .js files automatically)
echo 'use '$MONGODB_DATABASE > /docker-entrypoint-initdb.d/createOpLogUser.script;
echo 'db.createUser({user: "'$MONGODB_USERNAME'-oplog", pwd: "'$MONGODB_PASSWORD'", roles: [ { role: "read", db: "local" } ]})' >> /docker-entrypoint-initdb.d/createOpLogUser.script;
echo 'hostname()' >> /docker-entrypoint-initdb.d/createOpLogUser.script;
echo "Command Generated!";
echo "Creating the user...";
mongo admin -u root -p $MONGODB_ROOT_PASSWORD < /docker-entrypoint-initdb.d/createOpLogUser.script;
echo "User Created!";
echo "Removing mongodb generated command"...;
rm /docker-entrypoint-initdb.d/createOpLogUser.script;
echo "Removed mongodb generated command!";
{{- end -}}

View File

@ -12,4 +12,3 @@ type: Opaque
data: data:
mongodb-password: {{ ( .Values.mongodbPassword | default "empty" ) | b64enc | quote }} mongodb-password: {{ ( .Values.mongodbPassword | default "empty" ) | b64enc | quote }}
mongodb-root-password: {{ ( .Values.mongodbRootPassword | default "empty" ) | b64enc | quote }} mongodb-root-password: {{ ( .Values.mongodbRootPassword | default "empty" ) | b64enc | quote }}
mongodb-replicaset-key: {{ ( .Values.mongodbReplicasetKey | default "empty" ) | b64enc | quote }}

View File

@ -26,7 +26,6 @@ controller:
service: service:
main: main:
publishNotReadyAddresses: true
ports: ports:
main: main:
port: 27017 port: 27017
@ -62,7 +61,7 @@ probes:
command: command:
- /bin/bash - /bin/bash
- -ec - -ec
- echo "rs.status().ok" | mongo --host "${MONGODB_ADVERTISED_HOSTNAME}" -u root -p ${MONGODB_ROOT_PASSWORD} --port "${MONGODB_ADVERTISED_PORT_NUMBER}" --quiet - echo "db.runCommand(\"ping\")" | mongo --host localhost --port 27017 ${MONGODB_DATABASE} --quiet
# -- Redainess probe configuration # -- Redainess probe configuration
# @default -- See below # @default -- See below
@ -79,7 +78,7 @@ probes:
command: command:
- /bin/bash - /bin/bash
- -ec - -ec
- echo "rs.status().ok" | mongo --host "${MONGODB_ADVERTISED_HOSTNAME}" -u root -p ${MONGODB_ROOT_PASSWORD} --port "${MONGODB_ADVERTISED_PORT_NUMBER}" --quiet - echo "db.runCommand(\"ping\")" | mongo --host localhost --port 27017 ${MONGODB_DATABASE} --quiet
# -- Startup probe configuration # -- Startup probe configuration
# @default -- See below # @default -- See below
@ -95,16 +94,12 @@ probes:
command: command:
- /bin/bash - /bin/bash
- -ec - -ec
- echo "rs.status().ok" | mongo --host "${MONGODB_ADVERTISED_HOSTNAME}" -u root -p ${MONGODB_ROOT_PASSWORD} --port "${MONGODB_ADVERTISED_PORT_NUMBER}" --quiet - echo "db.runCommand(\"ping\")" | mongo --host localhost --port 27017 ${MONGODB_DATABASE} --quiet
mongodbPassword: "testpass" mongodbPassword: "testpass"
mongodbUsername: "test" mongodbUsername: "test"
mongodbDatabase: "test" mongodbDatabase: "test"
mongodbRootPassword: "testroot" mongodbRootPassword: "testroot"
mongodbReplicasetMode: "primary"
mongodbReplicasetName: "rs0"
mongodbReplicasetKey: "testreplicasetkey"
mongodbDependency: false
existingSecret: "" existingSecret: ""
envValueFrom: envValueFrom:
@ -116,18 +111,7 @@ envValueFrom:
secretKeyRef: secretKeyRef:
name: '{{ ( tpl .Values.existingSecret $ ) | default ( include "common.names.fullname" . ) }}' name: '{{ ( tpl .Values.existingSecret $ ) | default ( include "common.names.fullname" . ) }}'
key: "mongodb-root-password" key: "mongodb-root-password"
MONGODB_REPLICA_SET_KEY:
secretKeyRef:
name: '{{ ( tpl .Values.existingSecret $ ) | default ( include "common.names.fullname" . ) }}'
key: "mongodb-replicaset-key"
env: env:
MONGODB_USERNAME: "{{ .Values.mongodbUsername }}" MONGODB_USERNAME: "{{ .Values.mongodbUsername }}"
MONGODB_DATABASE: "{{ .Values.mongodbDatabase }}" MONGODB_DATABASE: "{{ .Values.mongodbDatabase }}"
MONGODB_REPLICA_SET_MODE: "{{ .Values.mongodbReplicasetMode }}"
MONGODB_REPLICA_SET_NAME: "{{ .Values.mongodbReplicasetName }}"
MONGODB_ADVERTISED_HOSTNAME: "{{ if .Values.mongodbDependency }}{{ .Release.Name }}-mongodb-0{{ else }}{{ .Release.Name }}-0{{ end }}"
MONGODB_ADVERTISED_PORT_NUMBER: 27017
MONGODB_INITIAL_PRIMARY_HOST: "{{ if .Values.mongodbDependency }}{{ .Release.Name }}-mongodb-0{{ else }}{{ .Release.Name }}-0{{ end }}"
MONGODB_INITIAL_PRIMARY_PORT_NUMBER: 27017
MONGODB_ENABLE_JOURNAL: true