From a733e38b85bf73fe6411dc66675a23cf20e2e815 Mon Sep 17 00:00:00 2001 From: derrabauke <pfralf@googlemail.com> Date: Sun, 14 Mar 2021 21:25:30 +0100 Subject: [PATCH] make persistance via mongo db work --- .../chart/backend/templates/deployment.yaml | 20 ++++--------------- .../backend/templates/persistent-volume.yaml | 12 +++++++++++ .../chart/backend/templates/pv-claim.yaml | 11 ++++++++++ app/server/chart/backend/values.yaml | 18 ++++++----------- 4 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 app/server/chart/backend/templates/persistent-volume.yaml create mode 100644 app/server/chart/backend/templates/pv-claim.yaml diff --git a/app/server/chart/backend/templates/deployment.yaml b/app/server/chart/backend/templates/deployment.yaml index 7bede01..c30a4ea 100644 --- a/app/server/chart/backend/templates/deployment.yaml +++ b/app/server/chart/backend/templates/deployment.yaml @@ -34,28 +34,16 @@ spec: image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} ports: - - name: http - containerPort: {{ .Values.service.port }} + - name: primary + containerPort: {{ .Values.port }} protocol: TCP livenessProbe: httpGet: path: / - port: http + port: primary readinessProbe: httpGet: path: / - port: http + port: primary resources: {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/app/server/chart/backend/templates/persistent-volume.yaml b/app/server/chart/backend/templates/persistent-volume.yaml new file mode 100644 index 0000000..01c6957 --- /dev/null +++ b/app/server/chart/backend/templates/persistent-volume.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolume +metadata: + name: 'pv-todos' +spec: + storageClass: {{ .Values.mongodb.persistence.storageClass }} + accessModes: + - ReadWriteOnce + capacity: + storage: 1Gi + hostPath: + path: '/data/{{ include "backend.fullname" . }}/' diff --git a/app/server/chart/backend/templates/pv-claim.yaml b/app/server/chart/backend/templates/pv-claim.yaml new file mode 100644 index 0000000..5cb6169 --- /dev/null +++ b/app/server/chart/backend/templates/pv-claim.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: 'pvc-todos' +spec: + storageClass: {{ .Values.mongodb.persistence.storageClass }} + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi diff --git a/app/server/chart/backend/values.yaml b/app/server/chart/backend/values.yaml index 6f5ff4a..8b503d9 100644 --- a/app/server/chart/backend/values.yaml +++ b/app/server/chart/backend/values.yaml @@ -1,11 +1,11 @@ # Backend value definitions: -replicaCount: 1 - image: repository: backend #! change to container registry if possible pullPolicy: IfNotPresent # Overrides the image tag whose default is the chart appVersion. tag: "v0.0.2" +replicaCount: 1 +port: 3002 imagePullSecrets: [] nameOverride: "" @@ -65,23 +65,17 @@ autoscaling: targetCPUUtilizationPercentage: 80 # targetMemoryUtilizationPercentage: 80 -nodeSelector: {} - -tolerations: [] - -affinity: {} - # Depedencies definition mongodb: fullnameOverride: 'mongodb' image: registry: 'docker.io' repository: 'bitnami/mongodb' - tag: '10.10.2' + tag: 'latest' service: port: 27017 # auth: # rootPassword: mongodb - # persistence: - # enabled: true - # existingClaim: 'pvc-db' + persistence: + enabled: true + existingClaim: 'pvc-todos' -- GitLab