From afe05a6577ea0708937292b5cdfe351f1ced86cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Guillot?= Date: Wed, 21 Aug 2024 15:53:40 +0200 Subject: [PATCH] feat(helm-chart): add Bitnami's MinIO chart to default configuration --- apps/helm-chart/src/Chart.lock | 7 +++-- apps/helm-chart/src/Chart.yaml | 4 +++ apps/helm-chart/src/templates/_helpers.tpl | 30 +++++++++++++++++-- .../src/templates/server/deployment.yaml | 1 + apps/helm-chart/src/values.yaml | 8 +++++ 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/apps/helm-chart/src/Chart.lock b/apps/helm-chart/src/Chart.lock index e0f9ad4a..af9b4d3d 100644 --- a/apps/helm-chart/src/Chart.lock +++ b/apps/helm-chart/src/Chart.lock @@ -1,9 +1,12 @@ dependencies: +- name: minio + repository: https://charts.bitnami.com/bitnami + version: 14.7.1 - name: mongodb repository: https://charts.bitnami.com/bitnami version: 15.6.1 - name: nginx repository: https://charts.bitnami.com/bitnami version: 18.0.1 -digest: sha256:c05c16045648a51dec1bff82e3571661b720b97fe5d516550531a68d581a4393 -generated: "2024-06-06T19:56:41.397493834Z" +digest: sha256:bfc7cb256c921e752d6348ac0ab392d479cdd6a577b7441bd54a8c59f1b4d4b6 +generated: "2024-08-20T16:15:02.771396128+02:00" diff --git a/apps/helm-chart/src/Chart.yaml b/apps/helm-chart/src/Chart.yaml index 75b4b119..f24d9dc6 100644 --- a/apps/helm-chart/src/Chart.yaml +++ b/apps/helm-chart/src/Chart.yaml @@ -13,6 +13,10 @@ maintainers: sources: - https://github.com/clementguillot/nx-cloud-ce dependencies: + - name: minio + version: 14.7.1 + repository: https://charts.bitnami.com/bitnami + condition: minio.enabled - name: mongodb version: 15.6.1 repository: https://charts.bitnami.com/bitnami diff --git a/apps/helm-chart/src/templates/_helpers.tpl b/apps/helm-chart/src/templates/_helpers.tpl index 5e1af7e5..4aa8e12f 100644 --- a/apps/helm-chart/src/templates/_helpers.tpl +++ b/apps/helm-chart/src/templates/_helpers.tpl @@ -19,15 +19,41 @@ Create the default port of the server. Create the MongoDB connection string of the server. */}} {{- define "nx-cloud-ce.server.database.connection-string" -}} -{{- if .Values.mongodb.enabled }} +{{- if .Values.mongodb.enabled -}} valueFrom: secretKeyRef: name: {{ template "nx-cloud-ce.name" . }}-mongodb-svcbind-0 key: uri -{{- else }} +{{- else -}} valueFrom: secretKeyRef: name: {{ .Values.server.database.connectionStringSecretName | quote }} key: {{ .Values.server.database.connectionStringSecretKeyRef | quote }} {{- end -}} {{- end -}} + +{{/* +Create the embedded MinIO S3 settings. +*/}} +{{- define "nx-cloud-ce.server.s3.settings" -}} +{{- if .Values.minio.enabled -}} +- name: NX_SERVER_STORAGE_S3_ENDPOINT + value: "http://{{ template "nx-cloud-ce.name" . }}-minio.{{ .Release.Namespace }}.svc.cluster.local:9000" +- name: NX_SERVER_STORAGE_S3_REGION + value: "us-east-1" +- name: NX_SERVER_STORAGE_S3_BUCKET + value: "nx-cloud-ce" +- name: NX_SERVER_STORAGE_S3_FORCE_PATH_STYLE + value: "true" +- name: NX_SERVER_STORAGE_S3_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: {{ template "nx-cloud-ce.name" . }}-minio + key: root-user +- name: NX_SERVER_STORAGE_S3_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: {{ template "nx-cloud-ce.name" . }}-minio + key: root-password +{{- end -}} +{{- end -}} diff --git a/apps/helm-chart/src/templates/server/deployment.yaml b/apps/helm-chart/src/templates/server/deployment.yaml index ca08d961..9892708f 100644 --- a/apps/helm-chart/src/templates/server/deployment.yaml +++ b/apps/helm-chart/src/templates/server/deployment.yaml @@ -63,6 +63,7 @@ spec: {{- include "nx-cloud-ce.server.database.connection-string" . | nindent 12 }} - name: QUARKUS_MONGODB_DATABASE value: {{ default .Values.server.name .Values.server.database.dbName }} + {{- include "nx-cloud-ce.server.s3.settings" . | nindent 10 }} {{- with .Values.server.envFrom }} envFrom: {{- toYaml . | nindent 10 }} diff --git a/apps/helm-chart/src/values.yaml b/apps/helm-chart/src/values.yaml index 79244c76..ad9579a9 100644 --- a/apps/helm-chart/src/values.yaml +++ b/apps/helm-chart/src/values.yaml @@ -224,6 +224,14 @@ server: # -- Server clean-up numbers of days to truncate on days: 30 +## Embedded MinIO configuration (Bitnami Helm Chart) +minio: + # If `enabled`, Bitnami's chart is installed. + enabled: true + + # Comma, semi-colon or space separated list of buckets to create at initialization (only in standalone mode) + defaultBuckets: "nx-cloud-ce" + ## Embedded MongoDB configuration (Bitnami Helm Chart) mongodb: # If `enabled`, Bitnami's chart is installed.