AAF OOM 2.1.20
[oom.git] / kubernetes / aaf / charts / aaf-sms / charts / aaf-sms-vault / templates / statefulset.yaml
index 26f0304..4023106 100644 (file)
@@ -1,4 +1,5 @@
 # Copyright 2018 Intel Corporation, Inc
+# Modifications © 2020 AT&T
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -20,7 +21,7 @@ metadata:
   labels:
     app: {{ include "common.name" . }}
     chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
+    release: {{ include "common.release" . }}
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
@@ -29,13 +30,29 @@ spec:
     metadata:
       labels:
         app: {{ include "common.name" . }}
-        release: {{ .Release.Name }}
+        release: {{ include "common.release" . }}
     spec:
+{{- if .Values.persistence.enabled }}
+      initContainers:
+        - name: fix-permission
+          command:
+            - /bin/sh
+          args:
+            - -c
+            - |
+              chmod -R 775 /consul/data
+              chown -R 100:1000 /consul/data
+          image: "{{ .Values.global.busyboxRepository }}/{{ .Values.global.busyboxImage }}"
+          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
+          volumeMounts:
+            - mountPath: /consul/data
+              name: {{ include "common.fullname" . }}-data
+{{- end }}
       containers:
       - image: "{{ include "common.repository" . }}/{{ .Values.image.vault }}"
         name: {{ include "common.name" . }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        command: ["vault","server","-config","/vault/config/config.json"]
+        args: ["server"]
         ports:
         - containerPort: {{ .Values.service.internalPort }}
         volumeMounts:
@@ -45,27 +62,29 @@ spec:
         - mountPath: /etc/localtime
           name: localtime
           readOnly: true
-
+        resources:
+{{ include "common.resources" . | indent 10 }}
       - image: "{{ include "common.repository" . }}/{{ .Values.image.consul }}"
         name: {{ include "common.name" . }}-backend
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        command: ["consul","agent","-server","-client","0.0.0.0","-bootstrap-expect=1","-config-file","/consul/config/config.json"]
+        args: ["agent","-server","-bind","0.0.0.0","-bootstrap-expect=1","-config-file","/consul/config/config.json"]
         ports:
         - name: http
           containerPort: 8500
         volumeMounts:
+{{- if .Values.persistence.enabled }}
         - mountPath: /consul/data
-          name: {{ include "common.fullname" . }}-consuldata
+          name: {{ include "common.fullname" . }}-data
+{{- end }}
         - mountPath: /consul/config/config.json
           name: {{ include "common.fullname" . }}-consulconfiguration
           subPath: config.json
         - mountPath: /etc/localtime
           name: localtime
           readOnly: true
+        resources:
+{{ include "common.resources" . | indent 10 }}
       volumes:
-        - name: {{ include "common.fullname" . }}-consuldata
-          persistentVolumeClaim:
-            claimName: {{ include "common.fullname" . }}
         - name: {{ include "common.fullname" . }}-consulconfiguration
           configMap:
             name: {{ include "common.fullname" . }}-consul
@@ -75,4 +94,22 @@ spec:
         - name: localtime
           hostPath:
             path: /etc/localtime
-
+      imagePullSecrets:
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
+{{- if .Values.persistence.enabled }}
+  volumeClaimTemplates:
+  - metadata:
+      name: {{ include "common.fullname" . }}-data
+      labels:
+        name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ include "common.release" . }}"
+        heritage: "{{ .Release.Service }}"
+    spec:
+      accessModes:
+      - {{ .Values.persistence.accessMode | quote }}
+      storageClassName: {{ include "common.storageClass" . }}
+      resources:
+        requests:
+          storage: {{ .Values.persistence.size | quote }}
+{{- end }}