From f759374ef3eda3320c1c9834245fcbffef9ba911 Mon Sep 17 00:00:00 2001 From: Luis Schweigard Date: Wed, 5 Oct 2022 17:44:31 +0200 Subject: [PATCH] [backport 1.x] Backport for healthchecks PR #329 (#333) * Add healthcheck probes to charts (#329) * Adding missing healthcheck probe configurations Signed-off-by: Luis Schweigard Signed-off-by: Luis Schweigard * Bumping chart versions and adding changes to CHANGELOG.md Signed-off-by: Luis Schweigard Signed-off-by: Luis Schweigard * Making opensearch liveness probe optional Signed-off-by: Luis Schweigard * Configuring livenessProbe to be optional for opensearch-dashboards chart Signed-off-by: Luis Schweigard * Adapting readme files Signed-off-by: Luis Schweigard * Changing opensearch dashboard lifecycle checks to tcpSocket Signed-off-by: Luis Schweigard * Adding changelog Signed-off-by: Luis Schweigard Signed-off-by: Luis Schweigard Signed-off-by: Luis Schweigard * Chart version bump Signed-off-by: Luis Schweigard Signed-off-by: Luis Schweigard Signed-off-by: Luis Schweigard --- charts/opensearch-dashboards/CHANGELOG.md | 12 ++++++++- charts/opensearch-dashboards/Chart.yaml | 2 +- charts/opensearch-dashboards/README.md | 11 ++++++++ .../templates/deployment.yaml | 14 ++++++++++ charts/opensearch-dashboards/values.yaml | 27 +++++++++++++++++++ charts/opensearch/CHANGELOG.md | 12 ++++++++- charts/opensearch/Chart.yaml | 2 +- charts/opensearch/README.md | 10 ++++--- charts/opensearch/templates/statefulset.yaml | 4 +++ charts/opensearch/values.yaml | 10 +++++++ 10 files changed, 96 insertions(+), 8 deletions(-) diff --git a/charts/opensearch-dashboards/CHANGELOG.md b/charts/opensearch-dashboards/CHANGELOG.md index 2957250e..9c4ea912 100644 --- a/charts/opensearch-dashboards/CHANGELOG.md +++ b/charts/opensearch-dashboards/CHANGELOG.md @@ -13,6 +13,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security --- +## [1.8.4] +### Added +- Healthchecks +### Changed +### Deprecated +### Removed +### Fixed +### Security +--- ## [1.8.3] ### Added - Template configmap content by tpl function @@ -306,7 +315,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security -[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-dashboards-1.8.3...HEAD +[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-dashboards-1.8.4...HEAD +[1.8.4]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.8.3...opensearch-1.8.4 [1.8.3]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.8.2...opensearch-1.8.3 [1.8.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.8.1...opensearch-1.8.2 [1.8.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.8.0...opensearch-1.8.1 diff --git a/charts/opensearch-dashboards/Chart.yaml b/charts/opensearch-dashboards/Chart.yaml index c2273439..97c16980 100644 --- a/charts/opensearch-dashboards/Chart.yaml +++ b/charts/opensearch-dashboards/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.8.3 +version: 1.8.4 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/opensearch-dashboards/README.md b/charts/opensearch-dashboards/README.md index abafa886..d951abae 100644 --- a/charts/opensearch-dashboards/README.md +++ b/charts/opensearch-dashboards/README.md @@ -76,3 +76,14 @@ | `updateStrategy` | The [updateStrategy][] for the StatefulSet. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` | | `extraObjects` | Array of extra K8s manifests to deploy | list `[]` | | `autoscaling` | Prerequisite: Install/Configure metrics server, to install use `kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml`, See https://github.com/kubernetes-sigs/metrics-server. Configurable pod autoscaling stratergy to scale based on `targetCPUUtilizationPercentage`, configure `minReplicas` and `maxReplicas` for desired scaling | false | +| `livenessProbe` | Configuration fields for the liveness [probe][] | see [exampleLiveness][] in `values.yaml` +| `readinessProbe` | Configuration fields for the readiness [probe][] | see [exampleReadiness][] in `values.yaml` +| `startupProbe` | Configuration fields for the startup [probe][] | see [exampleStartup][] in `values.yaml` | + + +[probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes + + +[exampleStartup]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch-dashboards/values.yaml#17 +[exampleLiveness]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch-dashboards/values.yaml#27 +[exampleReadiness]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch-dashboards/values.yaml#37 \ No newline at end of file diff --git a/charts/opensearch-dashboards/templates/deployment.yaml b/charts/opensearch-dashboards/templates/deployment.yaml index ccb20c85..e253e64b 100644 --- a/charts/opensearch-dashboards/templates/deployment.yaml +++ b/charts/opensearch-dashboards/templates/deployment.yaml @@ -91,6 +91,20 @@ spec: {{ toYaml .Values.securityContext | indent 10 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: "{{ .Values.image.pullPolicy }}" + {{- if .Values.readinessProbe }} + readinessProbe: +{{ toYaml .Values.readinessProbe | indent 10 }} + {{- end }} + {{- if .Values.livenessProbe }} + livenessProbe: +{{ toYaml .Values.livenessProbe | indent 10 }} + {{- end }} + {{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.Version }} + {{- if .Values.readinessProbe }} + startupProbe: +{{ toYaml .Values.startupProbe | indent 10 }} + {{- end }} + {{- end }} env: {{- if .Values.opensearchURL }} - name: OPENSEARCH_URL diff --git a/charts/opensearch-dashboards/values.yaml b/charts/opensearch-dashboards/values.yaml index 95354c72..c36b1861 100644 --- a/charts/opensearch-dashboards/values.yaml +++ b/charts/opensearch-dashboards/values.yaml @@ -14,6 +14,33 @@ image: tag: "" pullPolicy: "IfNotPresent" +startupProbe: + tcpSocket: + port: 5601 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 20 + successThreshold: 1 + initialDelaySeconds: 10 + +livenessProbe: + tcpSocket: + port: 5601 + periodSeconds: 20 + timeoutSeconds: 5 + failureThreshold: 10 + successThreshold: 1 + initialDelaySeconds: 10 + +readinessProbe: + tcpSocket: + port: 5601 + periodSeconds: 20 + timeoutSeconds: 5 + failureThreshold: 10 + successThreshold: 1 + initialDelaySeconds: 10 + imagePullSecrets: [] nameOverride: "" fullnameOverride: "" diff --git a/charts/opensearch/CHANGELOG.md b/charts/opensearch/CHANGELOG.md index 8bdf565f..91194435 100644 --- a/charts/opensearch/CHANGELOG.md +++ b/charts/opensearch/CHANGELOG.md @@ -12,6 +12,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed ### Security +--- +## [1.14.2] +### Added +- Healthchecks +### Changed +### Deprecated +### Removed +### Fixed +### Security --- ## [1.14.1] ### Added @@ -485,7 +494,8 @@ config: ### Fixed ### Security -[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.14.1...HEAD +[Unreleased]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.14.2...HEAD +[1.14.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.14.1...opensearch-1.14.2 [1.14.1]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.14.0...opensearch-1.14.1 [1.14.0]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.13.2...opensearch-1.14.0 [1.13.2]: https://github.com/opensearch-project/helm-charts/compare/opensearch-1.13.1...opensearch-1.13.2 diff --git a/charts/opensearch/Chart.yaml b/charts/opensearch/Chart.yaml index afa79980..3b359672 100644 --- a/charts/opensearch/Chart.yaml +++ b/charts/opensearch/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.14.1 +version: 1.14.2 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/opensearch/README.md b/charts/opensearch/README.md index e0d8bf95..8b89ba6e 100644 --- a/charts/opensearch/README.md +++ b/charts/opensearch/README.md @@ -106,8 +106,9 @@ helm uninstall my-release | `updateStrategy` | The [updateStrategy][] for the StatefulSet. By default Kubernetes will wait for the cluster to be green after upgrading each pod. Setting this to `OnDelete` will allow you to manually delete each pod during upgrades | `RollingUpdate` | | `volumeClaimTemplate` | Configuration for the [volumeClaimTemplate for StatefulSets][]. You will want to adjust the storage (default `30Gi` ) and the `storageClassName` if you are using a different storage class | see [values.yaml][] | | `extraObjects` | Array of extra K8s manifests to deploy | list `[]` | | -| `readinessProbe` | Configuration fields for the readiness [probe][] | see [example][] in `values.yaml` -| `startupProbe` | Configuration fields for the [probe][] | see [sample][] in `values.yaml` | +| `livenessProbe` | Configuration fields for the liveness [probe][] | see [exampleLiveness][] in `values.yaml` +| `readinessProbe` | Configuration fields for the readiness [probe][] | see [exampleReadiness][] in `values.yaml` +| `startupProbe` | Configuration fields for the startup [probe][] | see [exampleStartup][] in `values.yaml` | @@ -168,6 +169,7 @@ helm uninstall my-release [probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-readiness-probes -[example]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml#L336 +[exampleStartup]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml#332 +[exampleLiveness]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml#340 +[exampleReadiness]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml#349 -[sample]: https://github.com/opensearch-project/helm-charts/blob/main/charts/opensearch/values.yaml#L328 diff --git a/charts/opensearch/templates/statefulset.yaml b/charts/opensearch/templates/statefulset.yaml index b00630ec..91e17329 100644 --- a/charts/opensearch/templates/statefulset.yaml +++ b/charts/opensearch/templates/statefulset.yaml @@ -308,6 +308,10 @@ spec: imagePullPolicy: "{{ .Values.image.pullPolicy }}" readinessProbe: {{ toYaml .Values.readinessProbe | indent 10 }} + {{- if .Values.livenessProbe }} + livenessProbe: +{{ toYaml .Values.livenessProbe | indent 10 }} + {{- end }} {{- if semverCompare ">=1.16-0" .Capabilities.KubeVersion.Version }} startupProbe: {{ toYaml .Values.startupProbe | indent 10 }} diff --git a/charts/opensearch/values.yaml b/charts/opensearch/values.yaml index f2e60c4f..eb5a7ea9 100644 --- a/charts/opensearch/values.yaml +++ b/charts/opensearch/values.yaml @@ -336,6 +336,16 @@ startupProbe: periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 30 + +livenessProbe: {} + # periodSeconds: 20 + # timeoutSeconds: 5 + # failureThreshold: 10 + # successThreshold: 1 + # initialDelaySeconds: 10 + # tcpSocket: + # port: 9200 + readinessProbe: tcpSocket: port: 9200