From d5f53a83eacedf62f45caaaa66b499195fd41350 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Fri, 17 Dec 2021 17:53:56 +0300 Subject: [PATCH] added mongodb chart --- etc/k8s/eshoponabp/charts/mongodb/Chart.yaml | 6 +++ .../mongodb/templates/mongodb-deployment.yaml | 38 +++++++++++++++++++ .../mongodb/templates/mongodb-service.yaml | 14 +++++++ etc/k8s/eshoponabp/charts/mongodb/values.yaml | 0 4 files changed, 58 insertions(+) create mode 100644 etc/k8s/eshoponabp/charts/mongodb/Chart.yaml create mode 100644 etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml create mode 100644 etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-service.yaml create mode 100644 etc/k8s/eshoponabp/charts/mongodb/values.yaml diff --git a/etc/k8s/eshoponabp/charts/mongodb/Chart.yaml b/etc/k8s/eshoponabp/charts/mongodb/Chart.yaml new file mode 100644 index 00000000..d8a45394 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/mongodb/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: mongodb +appVersion: "1.0" +description: Runs Mongo DB Instance +version: 1.0.0 +type: application diff --git a/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml b/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml new file mode 100644 index 00000000..c69e67fe --- /dev/null +++ b/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-deployment.yaml @@ -0,0 +1,38 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + serviceName: {{ .Release.Name }}-{{ .Chart.Name }} + replicas: 1 + selector: + matchLabels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + template: + metadata: + labels: + app: {{ .Release.Name }}-{{ .Chart.Name }} + spec: + containers: + - image: mongo + name: {{ .Release.Name }}-{{ .Chart.Name }} +{{- if eq .Release.Name "es-az" }} + volumeMounts: + - mountPath: "/data/db" + name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume + subPath: mongodb-data +{{- end }} + ports: + - name: mongo + containerPort: 27017 +{{- if eq .Release.Name "es-az" }} + volumeClaimTemplates: + - metadata: + name: {{ .Release.Name }}-{{ .Chart.Name }}-database-volume + spec: + accessModes: [ "ReadWriteOnce" ] + storageClassName: "managed-premium-retain" + resources: + requests: + storage: 32Gi +{{- end }} \ No newline at end of file diff --git a/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-service.yaml b/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-service.yaml new file mode 100644 index 00000000..74fc1015 --- /dev/null +++ b/etc/k8s/eshoponabp/charts/mongodb/templates/mongodb-service.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Service +metadata: + labels: + name: {{ .Release.Name }}-{{ .Chart.Name }} + name: {{ .Release.Name }}-{{ .Chart.Name }} +spec: + type: ClusterIP + ports: + - name: mongodb + port: 27017 + selector: + app: {{ .Release.Name }}-{{ .Chart.Name }} + diff --git a/etc/k8s/eshoponabp/charts/mongodb/values.yaml b/etc/k8s/eshoponabp/charts/mongodb/values.yaml new file mode 100644 index 00000000..e69de29b