Merge "[DCAEMOD] Uses new tpls for repos / images"
[oom.git] / kubernetes / common / cassandra / templates / statefulset.yaml
index 2f262ca..471f88f 100644 (file)
@@ -1,3 +1,4 @@
+{{/*
 # Copyright © 2018 Amdocs, AT&T, Bell Canada
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+*/}}
 
-apiVersion: apps/v1beta1
+apiVersion: apps/v1
 kind: StatefulSet
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ include "common.release" . }}
-    heritage: {{ .Release.Service }}
+metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
-  selector:
-    matchLabels:
-      app: {{ include  "common.name" . }}
-      release: {{ include "common.release" . }}
+  selector: {{- include "common.selectors" . | nindent 4 }}
   serviceName: {{ include "common.servicename" . }}
   replicas: {{ .Values.replicaCount }}
   podManagementPolicy: {{ .Values.podManagementPolicy }}
   updateStrategy:
     type: {{ .Values.updateStrategy.type }}
   template:
-    metadata:
-      labels:
-        app: {{ include "common.name" . }}
-        release: {{ include "common.release" . }}
-      name: {{ include "common.name" . }}
+    metadata: {{- include "common.templateMetadata" . | nindent 6 }}
     spec:
       hostNetwork: {{ .Values.hostNetwork }}
       containers:
       - name: {{ include "common.name" . }}
-        image: {{ .Values.image }}
+        image: {{ include "repositoryGenerator.dockerHubRepository" . }}/{{ .Values.image }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        ports:
-        {{- range $index, $ports := .Values.service.ports }}
-        - containerPort: {{ $ports.port }}
-        {{- end }}
+        ports: {{ include "common.containerPorts" . | nindent 8  }}
         volumeMounts:
           - name: {{ include "common.fullname" . }}-data
             mountPath: /var/lib/cassandra
@@ -65,7 +50,7 @@ spec:
         {{- if eq .Values.liveness.enabled true }}
         livenessProbe:
           exec:
-           command:
+            command:
             - /bin/bash
             - -c
             - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
@@ -115,14 +100,6 @@ spec:
             value: {{ default "GossipingPropertyFileSnitch" .Values.config.endpoint_snitch | quote }}
           - name: CASSANDRA_AUTHENTICATOR
             value: {{ default "PasswordAuthenticator" .Values.config.authenticator | quote }}
-          {{- if  (include "common.serviceMesh" .) }}
-          - name: CASSANDRA_LISTEN_ADDRESS
-            value: "127.0.0.1"
-          - name: CASSANDRA_BROADCAST_ADDRESS
-            valueFrom:
-              fieldRef:
-                fieldPath: status.podIP
-          {{- end }}
           - name: POD_IP
             valueFrom:
               fieldRef:
@@ -135,15 +112,12 @@ spec:
         {{- else }}
               command: ["/bin/sh", "-c", "PID=$(pidof java) && kill $PID && while ps -p $PID > /dev/null; do sleep 1; done"]
         {{- end }}
-        resources:
-{{ toYaml .Values.resources | indent 10 }}
+        resources: {{ toYaml .Values.resources | nindent 10 }}
       {{- if .Values.nodeSelector }}
-      nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 8 }}
+      nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
       {{- end -}}
       {{- if .Values.affinity }}
-      affinity:
-{{ toYaml .Values.affinity | indent 8 }}
+      affinity: {{ toYaml .Values.affinity | nindent 8 }}
       {{- end }}
       volumes:
       - name: localtime