Fix AAF CS startup timeouts
[oom.git] / kubernetes / aaf / charts / aaf-cs / templates / deployment.yaml
index 15e574f..893c5ac 100644 (file)
@@ -24,14 +24,11 @@ metadata:
     heritage: {{ .Release.Service }}
 spec:
   replicas: {{ .Values.replicaCount }}
-  selector:
-    matchLabels:
-      app: {{ include "common.name" . }}
   template:
     metadata:
       labels:
         app: {{ include "common.name" . }}
-      name: {{ .Release.Name }}
+        release: {{ .Release.Name }}
     spec:
       hostname: {{ include "common.name" . }}
       containers:
@@ -39,24 +36,45 @@ spec:
         image: "{{ include "common.repository" . }}/{{ .Values.image }}"
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
         name: {{ include "common.name" . }}
+        ports:
+        - containerPort: {{ .Values.service.externalPort }}
+        - containerPort: {{ .Values.service.externalPort2 }}
+        - containerPort: {{ .Values.service.externalPort3 }}
+        - containerPort: {{ .Values.service.externalPort4 }}
         volumeMounts:
         - mountPath: /data
           name: aaf-cs-data
+        - mountPath: /etc/localtime
+          name: localtime
+          readOnly: true
         # disable liveness probe when breakpoints set in debugger
         # so K8s doesn't restart unresponsive container
         {{- if eq .Values.liveness.enabled true }}
         livenessProbe:
           tcpSocket:
-            port: {{ .Values.service.internalPort }}
+            port: {{ .Values.service.internalPort3 }}
           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
           periodSeconds: {{ .Values.liveness.periodSeconds }}
         {{ end -}}
         readinessProbe:
           tcpSocket:
-            port: {{ .Values.service.internalPort }}
+            port: {{ .Values.service.internalPort3 }}
           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
           periodSeconds: {{ .Values.readiness.periodSeconds }}
-        resources:
+        lifecycle:
+          postStart:
+            exec:
+              command: 
+              - /bin/sh
+              - -c
+              - >
+                /bin/sleep {{ .Values.readiness.initialDelaySeconds }};
+                cd /data/;
+                cqlsh -u root -p root -f keyspace.cql ;
+                cqlsh -u root -p root -f init.cql ;
+                cqlsh -u root -p root -f osaaf.cql ;
+                cqlsh -u root -p root -f temp_identity.cql
+        resources: 
 {{ toYaml .Values.resources | indent 12 }}
       {{- if .Values.nodeSelector }}
       nodeSelector:
@@ -66,8 +84,10 @@ spec:
       affinity:
 {{ toYaml .Values.affinity | indent 10 }}
       {{- end }}
-
       volumes:
+        - name: localtime
+          hostPath:
+            path: /etc/localtime
         - name: aaf-cs-data
           secret:
             secretName: {{ include "common.fullname" . }}