From 1c8fa4b52e418f0771bf98a3198d3b13bdd655d3 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Tue, 30 Sep 2025 13:19:15 +0200 Subject: [PATCH] add .gitignore, .editorconfig, and clean up --- .editorconfig | 10 ++++ .gitignore | 1 + helm/templates/headless-service.yaml | 10 ++-- helm/templates/service.yaml | 10 ++-- helm/templates/statefulset.yaml | 84 ++++++++++++++-------------- helm/values.yaml | 4 +- 6 files changed, 65 insertions(+), 54 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitignore diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..c84a12f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = 1024 +tab_width = 2 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/helm/templates/headless-service.yaml b/helm/templates/headless-service.yaml index b989c0a..fe4c7f7 100644 --- a/helm/templates/headless-service.yaml +++ b/helm/templates/headless-service.yaml @@ -8,9 +8,9 @@ spec: clusterIP: None publishNotReadyAddresses: true ports: - - port: {{ .Values.service.port }} - targetPort: {{ .Values.service.port }} - protocol: TCP - name: mongodb + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: mongodb selector: - app.kubernetes.io/name: {{ include "mongo.name" . }} \ No newline at end of file + app.kubernetes.io/name: {{ include "mongo.name" . }} diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index b5c653f..19232d6 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -10,9 +10,9 @@ spec: loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} ports: - - port: {{ .Values.service.port }} - targetPort: {{ .Values.service.port }} - protocol: TCP - name: mongodb + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: mongodb selector: - app.kubernetes.io/name: {{ include "mongo.name" . }} \ No newline at end of file + app.kubernetes.io/name: {{ include "mongo.name" . }} diff --git a/helm/templates/statefulset.yaml b/helm/templates/statefulset.yaml index 277739a..2d5f3fd 100644 --- a/helm/templates/statefulset.yaml +++ b/helm/templates/statefulset.yaml @@ -26,53 +26,53 @@ spec: runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }} {{- end }} containers: - - name: mongo - image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - args: + - name: mongo + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: {{- if .Values.extraCommandLineArgs }} - - "{{ .Values.extraCommandLineArgs }}" + - "{{ .Values.extraCommandLineArgs }}" {{- end }} - ports: - - containerPort: {{ .Values.service.port }} - name: mongodb - envFrom: - - secretRef: - name: {{ include "mongo.name.secret" . }} - volumeMounts: - - name: data - mountPath: /data/db + ports: + - containerPort: {{ .Values.service.port }} + name: mongodb + envFrom: + - secretRef: + name: {{ include "mongo.name.secret" . }} + volumeMounts: + - name: data + mountPath: /data/db {{- if .Values.readinessProbe.enabled }} - readinessProbe: - exec: - command: {{ toJson .Values.healthCheck.command }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} + readinessProbe: + exec: + command: {{ toJson .Values.healthCheck.command }} + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} {{- end }} {{- if .Values.livenessProbe.enabled }} - livenessProbe: - exec: - command: {{ toJson .Values.healthCheck.command }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} + livenessProbe: + exec: + command: {{ toJson .Values.healthCheck.command }} + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} {{- end }} - resources: - {{- toYaml .Values.resources | nindent 10 }} + resources: + {{- toYaml .Values.resources | nindent 12 }} volumeClaimTemplates: - - metadata: - name: data - spec: - accessModes: - {{- toYaml .Values.persistence.accessModes | nindent 10 }} - resources: - requests: - storage: {{ .Values.persistence.size }} + - metadata: + name: data + spec: + accessModes: + {{- toYaml .Values.persistence.accessModes | nindent 10 }} + resources: + requests: + storage: {{ .Values.persistence.size }} {{- if .Values.persistence.storageClass }} - storageClassName: {{ .Values.persistence.storageClass }} - {{- end }} \ No newline at end of file + storageClassName: {{ .Values.persistence.storageClass }} + {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 2abcc92..895c566 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -19,7 +19,7 @@ auth: persistence: storageClass: accessModes: - - ReadWriteOnce + - ReadWriteOnce size: 8Gi @@ -68,4 +68,4 @@ extraCommandLineArgs: "" healthCheck: - command: ["/bin/sh", "-c", "mongosh --quiet --eval 'db.runCommand({ ping: 1 })' --username ${MONGO_INITDB_ROOT_USERNAME} --password ${MONGO_INITDB_ROOT_PASSWORD} --authenticationDatabase admin || exit 1" ] + command: [ "/bin/sh", "-c", "mongosh --quiet --eval 'db.runCommand({ ping: 1 })' --username ${MONGO_INITDB_ROOT_USERNAME} --password ${MONGO_INITDB_ROOT_PASSWORD} --authenticationDatabase admin || exit 1" ]