From a69dfd16aa26f23acb9bed2a2dd871b7c10b8866 Mon Sep 17 00:00:00 2001 From: Sean Krail Date: Tue, 7 Jul 2020 16:39:11 -0400 Subject: [PATCH] JIT-35959: feat(agent-group): make readiness and liveness probes configurable (#6) * feat(agent-group): make readiness and liveness probes configurable * docs(agent-group): add comments to values file --- charts/agent-group/Chart.yaml | 2 +- charts/agent-group/templates/_required.tpl | 2 ++ charts/agent-group/templates/statefulset.yaml | 13 +++--------- charts/agent-group/values.schema.yaml | 14 +++++++++++++ charts/agent-group/values.yaml | 20 +++++++++++++++++++ definitions.schema.yaml | 3 +++ 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/charts/agent-group/Chart.yaml b/charts/agent-group/Chart.yaml index 40fa641..79207cc 100644 --- a/charts/agent-group/Chart.yaml +++ b/charts/agent-group/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: agent-group -version: 1.0.4 +version: 1.0.5 appVersion: 10 description: Jitterbit Agent Group home: https://github.com/jitterbit/charts diff --git a/charts/agent-group/templates/_required.tpl b/charts/agent-group/templates/_required.tpl index 83dcaf5..32df413 100644 --- a/charts/agent-group/templates/_required.tpl +++ b/charts/agent-group/templates/_required.tpl @@ -19,4 +19,6 @@ {{- required "resources is required!" .Values.resources -}} {{- required "revisionHistoryLimit is required!" .Values.revisionHistoryLimit -}} {{- required "affinity is required!" .Values.affinity -}} + {{- required "readinessProbe is required!" .Values.readinessProbe -}} + {{- required "livenessProbe is required!" .Values.livenessProbe -}} {{- end -}} diff --git a/charts/agent-group/templates/statefulset.yaml b/charts/agent-group/templates/statefulset.yaml index af34688..af70cd8 100644 --- a/charts/agent-group/templates/statefulset.yaml +++ b/charts/agent-group/templates/statefulset.yaml @@ -58,17 +58,10 @@ spec: env: {{- toYaml .Values.env | trimSuffix "\n" | nindent 12 }} {{- end }} - readinessProbe: &probe - httpGet: - scheme: HTTP - port: http-healthz - path: / - initialDelaySeconds: 90 - periodSeconds: 30 - timeoutSeconds: 5 + readinessProbe: + {{- toYaml .Values.readinessProbe | trimSuffix "\n" | nindent 12 }} livenessProbe: - <<: *probe - initialDelaySeconds: 300 + {{- toYaml .Values.livenessProbe | trimSuffix "\n" | nindent 12 }} resources: {{- toYaml .Values.resources | trimSuffix "\n" | nindent 12 }} volumeMounts: diff --git a/charts/agent-group/values.schema.yaml b/charts/agent-group/values.schema.yaml index 66b14f4..88c7efc 100644 --- a/charts/agent-group/values.schema.yaml +++ b/charts/agent-group/values.schema.yaml @@ -11,6 +11,8 @@ required: - resources - revisionHistoryLimit - affinity + - readinessProbe + - livenessProbe - env properties: metadata: @@ -91,6 +93,18 @@ properties: affinity: description: Pod affinity and anti-affinity definitions $ref: "#/definitions/affinity" + readinessProbe: + description: > + Periodic probe of container service readiness. + Container will be removed from service endpoints if the probe fails. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + $ref: "#/definitions/probe" + livenessProbe: + description: > + Periodic probe of container liveness. + Container will be restarted if the probe fails. + More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes + $ref: "#/definitions/probe" env: description: List of additional environment variables that may be specified in the container $ref: "#/definitions/env" diff --git a/charts/agent-group/values.yaml b/charts/agent-group/values.yaml index 837573d..bd715a4 100644 --- a/charts/agent-group/values.yaml +++ b/charts/agent-group/values.yaml @@ -78,6 +78,26 @@ affinity: app: '{{ template "agent-group.name" . }}' release: "{{ .Release.Name }}" +# readinessProbe is the container's readinessProbe definition +readinessProbe: + httpGet: + scheme: HTTP + port: http-healthz + path: / + initialDelaySeconds: 90 + periodSeconds: 30 + timeoutSeconds: 5 + +# livenessProbe is the container's livenessProbe definition +livenessProbe: + httpGet: + scheme: HTTP + port: http-healthz + path: / + initialDelaySeconds: 300 + periodSeconds: 30 + timeoutSeconds: 5 + # env is a list of extra environment variables that may be specified in the container env: [] # - name: CATALINA_OPTS diff --git a/definitions.schema.yaml b/definitions.schema.yaml index dcef537..732016e 100644 --- a/definitions.schema.yaml +++ b/definitions.schema.yaml @@ -89,6 +89,9 @@ definitions: affinity: description: Pod affinity and anti-affinity definitions $ref: "https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.12.8-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Affinity" + probe: + description: Container's readiness and liveness probe definition + $ref: "https://raw.githubusercontent.com/instrumenta/kubernetes-json-schema/master/v1.12.8-standalone-strict/_definitions.json#/definitions/io.k8s.api.core.v1.Probe" env: description: List of additional environment variables that may be specified in the container type: array