[SO] Leverage startup probe to avoid initialDelaySeconds of 10 minutes for k8s probes 91/140291/4
authorFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Mon, 24 Feb 2025 15:39:18 +0000 (16:39 +0100)
committerFiete Ostkamp <Fiete.Ostkamp@telekom.de>
Tue, 25 Feb 2025 13:42:58 +0000 (14:42 +0100)
- use startup probe to make so services available as early as possible
- define revisionHistoryLimit
- reduce default liveness period from 60 seconds to 20 seconds

Issue-ID: SO-4144
Change-Id: Ibd84fe1ef2d5c7f55e580fb7cc7b0a4bedff0045
Signed-off-by: Fiete Ostkamp <Fiete.Ostkamp@telekom.de>
14 files changed:
kubernetes/so/components/so-bpmn-infra/templates/deployment.yaml
kubernetes/so/components/so-bpmn-infra/values.yaml
kubernetes/so/components/so-catalog-db-adapter/templates/deployment.yaml
kubernetes/so/components/so-catalog-db-adapter/values.yaml
kubernetes/so/components/so-cnf-adapter/templates/deployment.yaml
kubernetes/so/components/so-cnf-adapter/values.yaml
kubernetes/so/components/so-cnfm-lcm/templates/deployment.yaml
kubernetes/so/components/so-cnfm-lcm/values.yaml
kubernetes/so/components/so-request-db-adapter/templates/deployment.yaml
kubernetes/so/components/so-request-db-adapter/values.yaml
kubernetes/so/components/soHelpers/Chart.yaml
kubernetes/so/components/soHelpers/templates/_livenessProbe.tpl
kubernetes/so/components/soHelpers/templates/_startupProbe.tpl [new file with mode: 0644]
kubernetes/so/components/soHelpers/values.yaml

index ec19321..190b89d 100755 (executable)
@@ -20,6 +20,7 @@ metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
   minReadySeconds: {{ index .Values.minReadySeconds }}
   strategy:
     type: {{ index .Values.updateStrategy.type }}
@@ -65,7 +66,8 @@ spec:
           readOnly: true
         - name: {{ include "common.fullname" . }}-logs
           mountPath: {{ .Values.log.path }}
-{{ include "so.helpers.livenessProbe" .| indent 8 }}
+        {{- include "so.helpers.startupProbe" .| indent 8 }}
+        {{- include "so.helpers.livenessProbe" .| indent 8 }}
         ports: {{ include "common.containerPorts" . | nindent 10  }}
       # Filebeat sidecar container
       {{ include "common.log.sidecar" . | nindent 6 }}
index 136c9ad..d2c5fa2 100755 (executable)
@@ -33,6 +33,8 @@ readinessCheck:
   wait_for:
     jobs:
       - '{{ include "common.release" . }}-so-mariadb-config-job'
+    services:
+      - 'so-catalog-db-adapter'
 
 #################################################################
 # Secrets metaconfig
@@ -136,6 +138,7 @@ vnf:
     version: v2
 
 replicaCount: 1
+revisionHistoryLimit: 1
 minReadySeconds: 10
 containerPort: &containerPort 8081
 logPath: ./logs/bpmn/
@@ -178,8 +181,7 @@ resources:
 livenessProbe:
   path: /manage/health
   scheme: HTTP
-  initialDelaySeconds: 600
-  periodSeconds: 60
+  periodSeconds: 20
   timeoutSeconds: 10
   successThreshold: 1
   failureThreshold: 3
index e3a77de..02673ec 100755 (executable)
@@ -19,6 +19,7 @@ metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
   minReadySeconds: {{ index .Values.minReadySeconds }}
   strategy:
     type: {{ index .Values.updateStrategy.type }}
@@ -57,7 +58,8 @@ spec:
         - name: config
           mountPath: /app/config
           readOnly: true
-{{ include "so.helpers.livenessProbe" .| indent 8 }}
+        {{- include "so.helpers.startupProbe" .| indent 8 }}
+        {{- include "so.helpers.livenessProbe" .| indent 8 }}
         ports: {{ include "common.containerPorts" . | nindent 10  }}
       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
index 5a5325f..85f7467 100755 (executable)
@@ -82,6 +82,7 @@ mso:
       auth: Basic YnBlbDpwYXNzd29yZDEk
 
 replicaCount: 1
+revisionHistoryLimit: 1
 minReadySeconds: 10
 containerPort: &containerPort 8082
 logPath: ./logs/catdb/
@@ -125,8 +126,7 @@ livenessProbe:
   path: /manage/health
   port: 8082
   scheme: HTTP
-  initialDelaySeconds: 600
-  periodSeconds: 60
+  periodSeconds: 20
   timeoutSeconds: 10
   successThreshold: 1
   failureThreshold: 3
index d8670f1..60baffa 100755 (executable)
@@ -20,6 +20,7 @@ metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ index .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
   minReadySeconds: {{ index .Values.minReadySeconds }}
   strategy:
     type: {{ index .Values.updateStrategy.type }}
@@ -80,12 +81,12 @@ spec:
               readOnly: true
             - name: encoder
               mountPath: /input
+          {{- include "so.helpers.startupProbe" .| indent 10 }}
           livenessProbe:
             httpGet:
               path: {{ index .Values.livenessProbe.path}}
               port: {{ index .Values.containerPort }}
               scheme: {{ index .Values.livenessProbe.scheme}}
-            initialDelaySeconds: {{ index .Values.livenessProbe.initialDelaySeconds}}
             periodSeconds: {{ index .Values.livenessProbe.periodSeconds}}
             timeoutSeconds: {{ index .Values.livenessProbe.timeoutSeconds}}
             successThreshold: {{ index .Values.livenessProbe.successThreshold}}
index 32f8727..cf2b2bc 100755 (executable)
@@ -104,6 +104,7 @@ mso:
     requestDb:
       auth: ${REQUEST_AUTH}
 replicaCount: 1
+revisionHistoryLimit: 1
 minReadySeconds: 10
 containerPort: &containerPort 8090
 logPath: ./logs/cnf-adapter/
@@ -147,8 +148,7 @@ livenessProbe:
   path: /manage/health
   port: 8090
   scheme: HTTP
-  initialDelaySeconds: 600
-  periodSeconds: 60
+  periodSeconds: 20
   timeoutSeconds: 10
   successThreshold: 1
   failureThreshold: 3
index 45572c9..040fbad 100644 (file)
@@ -18,6 +18,7 @@ metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ index .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
   minReadySeconds: {{ index .Values.minReadySeconds }}
   strategy:
     type: {{ index .Values.updateStrategy.type }}
index 9a85ec8..b9955f2 100644 (file)
@@ -77,6 +77,7 @@ sdc:
   key: 566B754875657232314F5548556D3665
 
 replicaCount: 1
+revisionHistoryLimit: 1
 minReadySeconds: 10
 containerPort: &containerPort 9888
 logPath: ./logs/so-cnfm-lcm/
@@ -119,9 +120,9 @@ resources:
 
 livenessProbe:
   port: *containerPort
-  initialDelaySeconds: 600
-  periodSeconds: 60
+  periodSeconds: 20
   timeoutSeconds: 10
+  initialDelaySeconds: 60
   successThreshold: 1
   failureThreshold: 3
 
@@ -152,4 +153,3 @@ serviceAccount:
   nameOverride: so-cnfm-lcm
   roles:
     - read
-
index 329d45e..93eef57 100755 (executable)
@@ -19,6 +19,7 @@ metadata: {{- include "common.resourceMetadata" . | nindent 2 }}
 spec:
   selector: {{- include "common.selectors" . | nindent 4 }}
   replicas: {{ index .Values.replicaCount }}
+  revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
   minReadySeconds: {{ index .Values.minReadySeconds }}
   strategy:
     type: {{ index .Values.updateStrategy.type }}
@@ -57,7 +58,8 @@ spec:
         - name: config
           mountPath: /app/config
           readOnly: true
-{{ include "so.helpers.livenessProbe" .| indent 8 }}
+        {{- include "so.helpers.startupProbe" .| indent 8 }}
+        {{- include "so.helpers.livenessProbe" .| indent 8 }}
         ports: {{- include "common.containerPorts" . | nindent 10  }}
       serviceAccountName: {{ include "common.fullname" (dict "suffix" "read" "dot" . )}}
       volumes:
index 0e12f51..d6cad07 100755 (executable)
@@ -80,6 +80,7 @@ mso:
       auth: Basic YnBlbDpwYXNzd29yZDEk
 
 replicaCount: 1
+revisionHistoryLimit: 1
 minReadySeconds: 10
 containerPort: &containerPort 8083
 logPath: ./logs/reqdb/
@@ -123,8 +124,7 @@ livenessProbe:
   path: /manage/health
   port: 8083
   scheme: HTTP
-  initialDelaySeconds: 600
-  periodSeconds: 60
+  periodSeconds: 20
   timeoutSeconds: 10
   successThreshold: 1
   failureThreshold: 3
index 36ce3fa..280e3e2 100755 (executable)
@@ -16,7 +16,7 @@
 apiVersion: v2
 description: A Helm chart for SO helpers
 name: soHelpers
-version: 13.0.0
+version: 13.0.1
 
 dependencies:
   - name: common
index e596b80..70ea57c 100644 (file)
@@ -7,7 +7,9 @@ livenessProbe:
     path: {{ $subchartDot.Values.livenessProbe.path }}
     port: {{ $subchartDot.Values.containerPort }}
     scheme: {{  $subchartDot.Values.livenessProbe.scheme }}
+{{- if $subchartDot.Values.livenessProbe.initialDelaySeconds }}
   initialDelaySeconds: {{ $subchartDot.Values.livenessProbe.initialDelaySeconds }}
+{{- end }}
   periodSeconds: {{ $subchartDot.Values.livenessProbe.periodSeconds }}
   timeoutSeconds: {{ $subchartDot.Values.livenessProbe.timeoutSeconds }}
   successThreshold: {{ $subchartDot.Values.livenessProbe.successThreshold }}
diff --git a/kubernetes/so/components/soHelpers/templates/_startupProbe.tpl b/kubernetes/so/components/soHelpers/templates/_startupProbe.tpl
new file mode 100644 (file)
index 0000000..3ea8916
--- /dev/null
@@ -0,0 +1,14 @@
+{{- define "so.helpers.startupProbe" -}}
+{{-   $dot := default . .dot -}}
+{{-   $initRoot := default $dot.Values.soHelpers .initRoot -}}
+{{- $subchartDot := fromJson (include "common.subChartDot" (dict "dot" $dot "initRoot" $initRoot)) }}
+startupProbe:
+  httpGet:
+    path: {{ $subchartDot.Values.startupProbe.path }}
+    port: {{ $subchartDot.Values.containerPort }}
+    scheme: {{  $subchartDot.Values.startupProbe.scheme }}
+  periodSeconds: {{ $subchartDot.Values.startupProbe.periodSeconds }}
+  timeoutSeconds: {{ $subchartDot.Values.startupProbe.timeoutSeconds }}
+  successThreshold: {{ $subchartDot.Values.startupProbe.successThreshold }}
+  failureThreshold: {{ $subchartDot.Values.startupProbe.failureThreshold }}
+{{- end -}}
index ec3fef2..0da387f 100755 (executable)
@@ -24,11 +24,17 @@ global:
 # Application configuration defaults.
 #################################################################
 
+startupProbe:
+  path: /manage/health
+  scheme: HTTP
+  periodSeconds: 3
+  timeoutSeconds: 3
+  successThreshold: 1
+  failureThreshold: 200
 livenessProbe:
   path: /manage/health
   scheme: HTTP
-  initialDelaySeconds: 600
-  periodSeconds: 60
+  periodSeconds: 20
   timeoutSeconds: 10
   successThreshold: 1
   failureThreshold: 3