changing portal liveness/readiness probe
[oom.git] / kubernetes / portal / charts / portal-cassandra / templates / deployment.yaml
index 91c4fa4..920efbc 100644 (file)
@@ -40,26 +40,33 @@ spec:
         - containerPort: {{ .Values.service.internalPort3 }}
         - containerPort: {{ .Values.service.internalPort4 }}
         - containerPort: {{ .Values.service.internalPort5 }}
-        {{- if eq .Values.liveness.enabled true }}
+        {{ if eq .Values.liveness.enabled true }}
         livenessProbe:
-          tcpSocket:
-            port: {{ .Values.service.internalPort }}
+          exec:
+            command:
+            - /bin/bash
+            - -c
+            - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
           initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
           periodSeconds: {{ .Values.liveness.periodSeconds }}
-        {{end -}}
+        {{ end }}
         readinessProbe:
-          tcpSocket:
-            port: {{ .Values.service.internalPort }}
+          exec:
+            command:
+            - /bin/bash
+            - -c
+            - nodetool status | grep $POD_IP | awk '$1!="UN" { exit 1; }'
           initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
           periodSeconds: {{ .Values.readiness.periodSeconds }}
         env:
           - name: CASSUSER
             value: "{{ .Values.config.cassandraUsername }}"
           - name: CASSPASS
+            value: "{{ .Values.config.cassandraPassword }}"
+          - name: POD_IP
             valueFrom:
-              secretKeyRef:
-                name: {{ template "common.fullname" . }}
-                key: db-root-password
+              fieldRef:
+                fieldPath: status.podIP
         volumeMounts:
         - mountPath: /etc/localtime
           name: localtime
@@ -70,6 +77,8 @@ spec:
         - name: cassandra-docker-entrypoint-initdb
           mountPath: /docker-entrypoint-initdb.d/zzz_portalsdk.cql
           subPath: portalsdk.cql
+        - name: {{ include "common.fullname" . }}-data
+          mountPath: /var/lib/cassandra/data
         resources:
 {{ toYaml .Values.resources | indent 12 }}
       {{- if .Values.nodeSelector }}
@@ -87,5 +96,12 @@ spec:
         - name: localtime
           hostPath:
             path: /etc/localtime
+      {{- if .Values.persistence.enabled }}
+        - name: {{ include "common.fullname" . }}-data
+          persistentVolumeClaim:
+            claimName: {{ include "common.fullname" . }}
+      {{- else }}
+          emptyDir: {}
+      {{- end }}
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"