-
Notifications
You must be signed in to change notification settings - Fork 2
feat!: use the official mongodb image #109
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ab2f564
feat!: use the official mongodb image
antoninguyot 7210a0d
Merge branch 'master' into remove_bitnami_mongodb
antoninguyot 3c567ae
chore: add compatibility with legacy values
antoninguyot eae4af5
fix: build depdencies before testing
antoninguyot 19512b5
chore(ci): improve secret generation tests
antoninguyot fc3d872
fix: unit tests scope
antoninguyot 6c092bf
fix: prevent empty volumes and volumeMounts
antoninguyot af130aa
fix: mongodb securityContext indentation
antoninguyot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,6 @@ | ||
| dependencies: | ||
| - name: common | ||
| repository: https://charts.bitnami.com/bitnami | ||
| version: 2.2.2 | ||
| - name: mongodb | ||
| repository: https://charts.bitnami.com/bitnami | ||
| version: 13.6.2 | ||
| digest: sha256:8f2475fdda7c417f31da168dbfb87df4177bf459a355226c81908c1e0f207ea7 | ||
| generated: "2023-01-25T13:54:49.218334+01:00" | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| version: 2.30.0 | ||
| digest: sha256:1d4fe7ab3d8601c2772b82ca4495929226ecbf073f9fb436f5bf5f089df6c4bd | ||
| generated: "2025-10-03T17:39:33.360927+02:00" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| {{- if and (ne (.Values.mongodb).enabled false) .Values.temporaryDatabase.enabled }} | ||
| apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} | ||
| kind: Deployment | ||
| metadata: | ||
| name: {{ include "common.names.dependency.fullname" (dict "chartName" "mongodb" "chartValues" .Values.temporaryDatabase "context" $) }} | ||
| {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.labels .Values.commonLabels (dict "app.kubernetes.io/name" "mongodb" "app.kubernetes.io/version" (.Values.temporaryDatabase.image.tag | toString) "app.kubernetes.io/part-of" "stream")) "context" . ) }} | ||
| labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} | ||
| {{- if or .Values.temporaryDatabase.annotations .Values.commonAnnotations }} | ||
| {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.temporaryDatabase.annotations .Values.commonAnnotations ) "context" . ) }} | ||
| annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| replicas: 1 | ||
| selector: | ||
| matchLabels: {{- include "common.labels.matchLabels" (dict "customLabels" (dict "app.kubernetes.io/name" "mongodb") "context" .) | nindent 6 }} | ||
| strategy: | ||
| type: Recreate | ||
| template: | ||
| metadata: | ||
| labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 8 }} | ||
| {{- if or .Values.temporaryDatabase.annotations .Values.commonAnnotations }} | ||
| {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.temporaryDatabase.annotations .Values.commonAnnotations ) "context" . ) }} | ||
| annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 8 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- if .Values.temporaryDatabase.podSecurityContext.enabled }} | ||
| securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.temporaryDatabase.podSecurityContext "context" $) | nindent 8 -}} | ||
| {{- end }} | ||
| serviceAccountName: {{ template "stream.serviceAccountName" . }} | ||
| automountServiceAccountToken: {{ .Values.automountServiceAccountToken }} | ||
| containers: | ||
| - name: mongo | ||
| image: {{ include "common.images.image" (dict "imageRoot" .Values.temporaryDatabase.image "global" .Values.global) }} | ||
| imagePullPolicy: {{ .Values.temporaryDatabase.image.pullPolicy | default "IfNotPresent" | quote }} | ||
| {{- if .Values.temporaryDatabase.containerSecurityContext.enabled }} | ||
| securityContext: {{- include "common.compatibility.renderSecurityContext" (dict "secContext" .Values.temporaryDatabase.containerSecurityContext "context" $) | nindent 10 -}} | ||
| {{- end }} | ||
| livenessProbe: | ||
| tcpSocket: | ||
| port: mongo | ||
| initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} | ||
| periodSeconds: {{ .Values.livenessProbe.periodSeconds }} | ||
| timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} | ||
| failureThreshold: {{ .Values.livenessProbe.failureThreshold }} | ||
| successThreshold: {{ .Values.livenessProbe.successThreshold }} | ||
| startupProbe: | ||
| tcpSocket: | ||
| port: mongo | ||
| periodSeconds: {{ .Values.startupProbe.periodSeconds }} | ||
| failureThreshold: {{ .Values.startupProbe.failureThreshold }} | ||
| readinessProbe: | ||
| tcpSocket: | ||
| port: mongo | ||
| initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} | ||
| periodSeconds: {{ .Values.readinessProbe.periodSeconds }} | ||
| timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} | ||
| failureThreshold: {{ .Values.readinessProbe.failureThreshold }} | ||
| successThreshold: {{ .Values.readinessProbe.successThreshold }} | ||
| resources: {{- toYaml .Values.temporaryDatabase.resources | nindent 12 }} | ||
| {{- if .Values.temporaryDatabase.persistence.enabled }} | ||
| volumeMounts: | ||
| - name: data | ||
| mountPath: /data/db | ||
| {{- end }} | ||
| ports: | ||
| - name: mongo | ||
| containerPort: 27017 | ||
| {{- include "common.images.renderPullSecrets" (dict "images" (list .Values.temporaryDatabase.image) "context" $) | nindent 6 }} | ||
| {{- if and .Values.temporaryDatabase.persistence.enabled }} | ||
| volumes: | ||
| - name: data | ||
| persistentVolumeClaim: | ||
| claimName: {{ include "common.names.dependency.fullname" (dict "chartName" "mongodb" "chartValues" .Values.temporaryDatabase "context" $) }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| {{- if and (ne (.Values.mongodb).enabled false) .Values.temporaryDatabase.enabled }} | ||
| apiVersion: v1 | ||
| kind: PersistentVolumeClaim | ||
| metadata: | ||
| name: {{ include "common.names.dependency.fullname" (dict "chartName" "mongodb" "chartValues" .Values.temporaryDatabase "context" $) }} | ||
| {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.labels .Values.commonLabels (dict "app.kubernetes.io/name" "mongodb" "app.kubernetes.io/part-of" "stream")) "context" . ) }} | ||
| labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} | ||
| {{- if or .Values.temporaryDatabase.annotations .Values.commonAnnotations }} | ||
| {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.temporaryDatabase.annotations .Values.commonAnnotations ) "context" . ) }} | ||
| annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- include "common.storage.class" (dict "persistence" .Values.temporaryDatabase.persistence "global" .Values.global) | nindent 2 }} | ||
| accessModes: | ||
| {{- range .Values.temporaryDatabase.persistence.accessModes }} | ||
| - {{ . | quote }} | ||
| {{- end }} | ||
| resources: | ||
| requests: | ||
| storage: {{ .Values.temporaryDatabase.persistence.size | quote }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| {{- if and (ne (.Values.mongodb).enabled false) .Values.temporaryDatabase.enabled }} | ||
| apiVersion: v1 | ||
| kind: Service | ||
| metadata: | ||
| name: {{ include "common.names.dependency.fullname" (dict "chartName" "mongodb" "chartValues" .Values.temporaryDatabase "context" $) }} | ||
| {{- $labels := include "common.tplvalues.merge" ( dict "values" ( list .Values.labels .Values.commonLabels (dict "app.kubernetes.io/name" "mongodb" "app.kubernetes.io/part-of" "stream")) "context" . ) }} | ||
| labels: {{- include "common.labels.standard" ( dict "customLabels" $labels "context" $ ) | nindent 4 }} | ||
| {{- if or .Values.temporaryDatabase.annotations .Values.commonAnnotations }} | ||
| {{- $annotations := include "common.tplvalues.merge" ( dict "values" ( list .Values.temporaryDatabase.annotations .Values.commonAnnotations ) "context" . ) }} | ||
| annotations: {{- include "common.tplvalues.render" ( dict "value" $annotations "context" $) | nindent 4 }} | ||
| {{- end }} | ||
| spec: | ||
| type: ClusterIP | ||
| ports: | ||
| - name: mongo | ||
| protocol: TCP | ||
| port: 27017 | ||
| targetPort: mongo | ||
| selector: {{- include "common.labels.matchLabels" (dict "customLabels" $labels "context" .) | nindent 4 }} | ||
| {{- end }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json | ||
| suite: temporary mongodb database | ||
| templates: | ||
| - mongodb/deployment.yml | ||
| - mongodb/service.yml | ||
| - mongodb/pvc.yml | ||
| - secrets.yml | ||
| tests: | ||
| - it: should deploy a temporary mongodb by default | ||
| template: mongodb/deployment.yml | ||
| asserts: | ||
| - isKind: | ||
| of: Deployment | ||
| - equal: | ||
| path: spec.template.spec.containers[0].name | ||
| value: mongo | ||
|
|
||
| - it: should not deploy a temporary mongodb when disabled | ||
| set: | ||
| temporaryDatabase.enabled: false | ||
| externalDatabase.secretName: dummy | ||
| externalDatabase.secretKey: dummy | ||
| template: mongodb/deployment.yml | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 0 | ||
|
|
||
| - it: should not deploy a temporary mongodb when legacy flag is disabled | ||
| set: | ||
| mongodb.enabled: false | ||
| externalDatabase.secretName: dummy | ||
| externalDatabase.secretKey: dummy | ||
| template: mongodb/deployment.yml | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 0 | ||
|
|
||
| - it: should deploy a temporary mongodb when legacy flag is enabled | ||
| set: | ||
| mongodb.enabled: true | ||
| template: mongodb/deployment.yml | ||
| asserts: | ||
| - hasDocuments: | ||
| count: 1 | ||
|
|
||
| - it: should generate a mongodb connection string in the secret when temporary database is enabled | ||
| template: secrets.yml | ||
| asserts: | ||
| - exists: | ||
| path: data.mongoUri | ||
|
|
||
| - it: should not generate a mongodb connection string in the secret when temporary database is disabled | ||
| set: | ||
| temporaryDatabase.enabled: false | ||
| externalDatabase.secretName: dummy | ||
| externalDatabase.secretKey: dummy | ||
| template: secrets.yml | ||
| asserts: | ||
| - notExists: | ||
| path: data.mongoUri |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.