From 1b254c642ffc39dd3df1e9c53c1ce8c0885aea49 Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Wed, 19 Jan 2022 06:15:26 -0500 Subject: [PATCH 1/3] allow customizing probes for the generic chart --- charts/generic/Chart.yaml | 2 +- charts/generic/NEWS.md | 6 ++++++ charts/generic/README.md | 6 +++++- charts/generic/templates/deployment.yaml | 14 +++++++++++--- charts/generic/values.yaml | 8 ++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/charts/generic/Chart.yaml b/charts/generic/Chart.yaml index e9ba07f..f4f8c0f 100644 --- a/charts/generic/Chart.yaml +++ b/charts/generic/Chart.yaml @@ -3,7 +3,7 @@ name: generic description: A generic Helm chart for Kubernetes type: application -version: 0.1.4 +version: 0.1.5 appVersion: latest maintainers: - name: colearendt diff --git a/charts/generic/NEWS.md b/charts/generic/NEWS.md index c7739d9..d0f9314 100644 --- a/charts/generic/NEWS.md +++ b/charts/generic/NEWS.md @@ -1,3 +1,9 @@ +# 0.1.5 + +- Add values for `readinessProbe`, `livenessProbe` and `startupProbe` + - This allows customization of probes + - Previously, `readinessProbe` was hardcoded + # 0.1.4 - Add `extraObjects` for arbitrary deployment possibilities! diff --git a/charts/generic/README.md b/charts/generic/README.md index ed902de..e8020c4 100644 --- a/charts/generic/README.md +++ b/charts/generic/README.md @@ -1,6 +1,6 @@ # generic -![Version: 0.1.4](https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) +![Version: 0.1.5](https://img.shields.io/badge/Version-0.1.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) A generic Helm chart for Kubernetes @@ -30,12 +30,15 @@ A generic Helm chart for Kubernetes | ingress.hosts[0].host | string | `"chart-example.local"` | | | ingress.hosts[0].paths | list | `[]` | | | ingress.tls | list | `[]` | | +| livenessProbe | object | `{}` | | | nameOverride | string | `""` | | | nodeSelector | object | `{}` | | | pod.env | list | `[]` | | | pod.port | int | `80` | | | podAnnotations | object | `{}` | | | podSecurityContext | object | `{}` | | +| readinessProbe.httpGet.path | string | `"/"` | | +| readinessProbe.httpGet.port | string | `"http"` | | | replicaCount | int | `1` | | | resources | object | `{}` | | | securityContext | object | `{}` | | @@ -44,6 +47,7 @@ A generic Helm chart for Kubernetes | serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | serviceAccount.create | bool | `true` | Specifies whether a service account should be created | | serviceAccount.name | string | `""` | The name of the service account to use. -- If not set and create is true, a name is generated using the fullname template | +| startupProbe | object | `{}` | | | storage.accessModes[0] | string | `"ReadWriteOnce"` | | | storage.create | bool | `false` | | | storage.name | string | `""` | | diff --git a/charts/generic/templates/deployment.yaml b/charts/generic/templates/deployment.yaml index 8b97a6a..81148c3 100644 --- a/charts/generic/templates/deployment.yaml +++ b/charts/generic/templates/deployment.yaml @@ -39,10 +39,18 @@ spec: - name: http containerPort: {{ .Values.pod.port }} protocol: TCP + {{- with .Values.readinessProbe }} readinessProbe: - httpGet: - path: / - port: http + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.livenessProbe }} + livenessProbe: + {{- toYaml . | nindent 12}} + {{- end }} + {{- with .Values.startupProbe }} + startupProbe: + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} diff --git a/charts/generic/values.yaml b/charts/generic/values.yaml index 65e6a68..2fd368f 100644 --- a/charts/generic/values.yaml +++ b/charts/generic/values.yaml @@ -89,3 +89,11 @@ affinity: {} # -- Extra kubernetes objects to deploy (value evaluted as a template) extraObjects: [] + +readinessProbe: + httpGet: + path: / + port: http + +livenessProbe: {} +startupProbe: {} From a9614103250c0dc768a3614841b67baf6adb186c Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Wed, 19 Jan 2022 06:17:12 -0500 Subject: [PATCH 2/3] add more docs on probes --- charts/generic/README.md | 7 +++---- charts/generic/values.yaml | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/charts/generic/README.md b/charts/generic/README.md index e8020c4..416a546 100644 --- a/charts/generic/README.md +++ b/charts/generic/README.md @@ -30,15 +30,14 @@ A generic Helm chart for Kubernetes | ingress.hosts[0].host | string | `"chart-example.local"` | | | ingress.hosts[0].paths | list | `[]` | | | ingress.tls | list | `[]` | | -| livenessProbe | object | `{}` | | +| livenessProbe | object | `{}` | customize the primary container's livenessProbe. Default none | | nameOverride | string | `""` | | | nodeSelector | object | `{}` | | | pod.env | list | `[]` | | | pod.port | int | `80` | | | podAnnotations | object | `{}` | | | podSecurityContext | object | `{}` | | -| readinessProbe.httpGet.path | string | `"/"` | | -| readinessProbe.httpGet.port | string | `"http"` | | +| readinessProbe | object | `{"httpGet":{"path":"/","port":"http"}}` | customize the primary container's readinessProbe. Default is httpGet on the default `http` port | | replicaCount | int | `1` | | | resources | object | `{}` | | | securityContext | object | `{}` | | @@ -47,7 +46,7 @@ A generic Helm chart for Kubernetes | serviceAccount.annotations | object | `{}` | Annotations to add to the service account | | serviceAccount.create | bool | `true` | Specifies whether a service account should be created | | serviceAccount.name | string | `""` | The name of the service account to use. -- If not set and create is true, a name is generated using the fullname template | -| startupProbe | object | `{}` | | +| startupProbe | object | `{}` | customize the primary container's startupProbe. Default none | | storage.accessModes[0] | string | `"ReadWriteOnce"` | | | storage.create | bool | `false` | | | storage.name | string | `""` | | diff --git a/charts/generic/values.yaml b/charts/generic/values.yaml index 2fd368f..acda89b 100644 --- a/charts/generic/values.yaml +++ b/charts/generic/values.yaml @@ -90,10 +90,13 @@ affinity: {} # -- Extra kubernetes objects to deploy (value evaluted as a template) extraObjects: [] +# -- customize the primary container's readinessProbe. Default is httpGet on the default `http` port readinessProbe: httpGet: path: / port: http +# -- customize the primary container's livenessProbe. Default none livenessProbe: {} +# -- customize the primary container's startupProbe. Default none startupProbe: {} From b7fd90ad07ea65ef12c452273a2959348ff4581f Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Wed, 19 Jan 2022 06:17:48 -0500 Subject: [PATCH 3/3] add ci values for probes --- charts/generic/ci/all-values.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/charts/generic/ci/all-values.yaml b/charts/generic/ci/all-values.yaml index 01e82b8..5131e16 100644 --- a/charts/generic/ci/all-values.yaml +++ b/charts/generic/ci/all-values.yaml @@ -94,3 +94,13 @@ extraObjects: name: "templating" data: something: {{ printf "special" }} + +readinessProbe: null +livenessProbe: + httpGet: + path: / + port: http +startupProbe: + httpGet: + path: / + port: http