From bd07824107991f678019e3005606463faef7fbd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Fri, 22 Mar 2024 13:02:22 +0100 Subject: [PATCH] Use the official MongoDB image The bitnami variant seems to be flaky, let's use the official offering. Change-Id: Id9adb8b57fc63f79f4f5b91b525f7dc996290627 --- charts/nebulous-gui-controller/Chart.yaml | 5 --- .../templates/_helpers.tpl | 14 ++++++ .../templates/mongodb.yaml | 45 +++++++++++++++++++ charts/nebulous-gui-controller/values.yaml | 12 ++--- 4 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 charts/nebulous-gui-controller/templates/mongodb.yaml diff --git a/charts/nebulous-gui-controller/Chart.yaml b/charts/nebulous-gui-controller/Chart.yaml index f834f0b..5510512 100644 --- a/charts/nebulous-gui-controller/Chart.yaml +++ b/charts/nebulous-gui-controller/Chart.yaml @@ -22,8 +22,3 @@ version: 0.1.0 # follow Semantic Versioning. They should reflect the version the application is using. # It is recommended to use it with quotes. appVersion: "latest" - -dependencies: - - name: mongodb - version: 14.12.1 - repository: "https://charts.bitnami.com/bitnami" diff --git a/charts/nebulous-gui-controller/templates/_helpers.tpl b/charts/nebulous-gui-controller/templates/_helpers.tpl index eda9029..e033f9f 100644 --- a/charts/nebulous-gui-controller/templates/_helpers.tpl +++ b/charts/nebulous-gui-controller/templates/_helpers.tpl @@ -42,6 +42,15 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} +{{- define "nebulous-gui-controller.mongodb.labels" -}} +helm.sh/chart: {{ include "nebulous-gui-controller.chart" . }} +{{ include "nebulous-gui-controller.mongodb.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + {{/* Selector labels */}} @@ -50,6 +59,11 @@ app.kubernetes.io/name: {{ include "nebulous-gui-controller.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end }} +{{- define "nebulous-gui-controller.mongodb.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nebulous-gui-controller.name" . }}-mongodb +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + {{/* Create the name of the service account to use */}} diff --git a/charts/nebulous-gui-controller/templates/mongodb.yaml b/charts/nebulous-gui-controller/templates/mongodb.yaml new file mode 100644 index 0000000..ad90cb3 --- /dev/null +++ b/charts/nebulous-gui-controller/templates/mongodb.yaml @@ -0,0 +1,45 @@ +{{ if .Values.mongodb.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }}-mongodb + labels: + {{- include "nebulous-gui-controller.mongodb.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "nebulous-gui-controller.mongodb.selectorLabels" . | nindent 6 }} + template: + metadata: + labels: + {{- include "nebulous-gui-controller.mongodb.selectorLabels" . | nindent 8 }} + spec: + containers: + - name: mongodb + image: "docker.io/mongodb/mongodb-community-server:7.0.7-ubuntu2204" + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + env: + - name: MONGO_INITDB_ROOT_USERNAME + value: username + - name: MONGO_INITDB_ROOT_PASSWORD + value: password +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "nebulous-gui-controller.fullname" . }}-mongodb + labels: + {{- include "nebulous-gui-controller.mongodb.labels" . | nindent 4 }} +spec: + type: ClusterIP + ports: + - port: 27017 + targetPort: mongodb + protocol: TCP + name: mongodb + selector: + {{- include "nebulous-gui-controller.mongodb.selectorLabels" . | nindent 4 }} +{{ end }} diff --git a/charts/nebulous-gui-controller/values.yaml b/charts/nebulous-gui-controller/values.yaml index 6181ed6..960176b 100644 --- a/charts/nebulous-gui-controller/values.yaml +++ b/charts/nebulous-gui-controller/values.yaml @@ -82,12 +82,9 @@ tolerations: [] affinity: {} mongodb: - auth: - rootPassword: "nebulous-gui" - username: "admin" - password: "nebulous-gui" - database: "gui-controller" - + # this enables the built-in mongodb deployment - not recommended for production + enabled: true + env: - name: ACTIVEMQ_HOST value: "nebulous-activemq" @@ -98,10 +95,9 @@ env: - name: ACTIVEMQ_PASSWORD value: "nebulous" - name: APOS_MONGODB_URI - value: "mongodb://admin:nebulous-gui@nebulous-gui-controller-mongodb:27017/admin" + value: "mongodb://username:password@nebulous-gui-controller-mongodb:27017/admin" apostropheCMS: user: name: admin password: admin -