From 647e2ae12252846d8de3b454f470f3b12ecd5803 Mon Sep 17 00:00:00 2001 From: TalShafir Date: Wed, 6 Mar 2024 17:23:28 +0200 Subject: [PATCH] Exporter add healthiness and readiness probes (#92) * bump ocean-metric-exporter version and add liveness & readiness probes * bump ocean-metric-exporter chart version * update helm docs * added optional probes to ocean metric exporter * changed default value for probes.enabled * update helm-docs to 1.13.1 --- Makefile.devel.mk | 2 +- charts/ocean-kubernetes-controller/README.md | 2 +- charts/ocean-metric-exporter/Chart.yaml | 4 +-- charts/ocean-metric-exporter/README.md | 16 +++++++-- .../templates/_helpers.tpl | 26 +++++++++++++++ .../templates/deployment.yaml | 1 + charts/ocean-metric-exporter/values.yaml | 33 +++++++++++++++++++ charts/ocean-network-client/README.md | 2 +- 8 files changed, 79 insertions(+), 7 deletions(-) diff --git a/Makefile.devel.mk b/Makefile.devel.mk index fbd904b..40209f3 100644 --- a/Makefile.devel.mk +++ b/Makefile.devel.mk @@ -72,5 +72,5 @@ docs: $(Q) echo "$$HELP_DOCS" else docs: ## Document the charts - @docker run --rm --volume "$(shell pwd):/helm-docs" -u $(shell id -u) jnorwood/helm-docs:v1.12.0 + @docker run --rm --volume "$(shell pwd):/helm-docs" -u $(shell id -u) jnorwood/helm-docs:v1.13.1 endif diff --git a/charts/ocean-kubernetes-controller/README.md b/charts/ocean-kubernetes-controller/README.md index de9e9d0..46985c8 100644 --- a/charts/ocean-kubernetes-controller/README.md +++ b/charts/ocean-kubernetes-controller/README.md @@ -131,4 +131,4 @@ Kubernetes: `>=1.20.0-0` | updateStrategy | object | `{}` | | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) diff --git a/charts/ocean-metric-exporter/Chart.yaml b/charts/ocean-metric-exporter/Chart.yaml index 35658f6..2abf307 100644 --- a/charts/ocean-metric-exporter/Chart.yaml +++ b/charts/ocean-metric-exporter/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: ocean-metric-exporter description: A Helm chart for Ocean Metric Exporter type: application -version: 1.0.6 -appVersion: 1.0.3 +version: 1.0.7 +appVersion: 1.0.4 home: https://github.com/spotinst/charts/tree/main/charts/ocean-metric-exporter icon: https://docs.spot.io/_media/images/spot_mark.png sources: diff --git a/charts/ocean-metric-exporter/README.md b/charts/ocean-metric-exporter/README.md index 9aa0c67..6175e8d 100644 --- a/charts/ocean-metric-exporter/README.md +++ b/charts/ocean-metric-exporter/README.md @@ -1,6 +1,6 @@ # ocean-metric-exporter -![Version: 1.0.6](https://img.shields.io/badge/Version-1.0.6-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.3](https://img.shields.io/badge/AppVersion-1.0.3-informational?style=flat-square) +![Version: 1.0.7](https://img.shields.io/badge/Version-1.0.7-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.4](https://img.shields.io/badge/AppVersion-1.0.4-informational?style=flat-square) A Helm chart for Ocean Metric Exporter. @@ -48,10 +48,22 @@ helm install my-release spot/ocean-metric-exporter | oceanController.secretName | Optional | `"spotinst-kubernetes-cluster-controller"` | Secret name. | | podAnnotations | Optional | `{}` | Pod annotations. Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ | | podEnvVariables | Optional | `[]` | Additional environment variables for the exporter container. | +| probes.enabled | Bool | `true` | Whether to include both liveness and readiness probe, if this is set to true it will ignore the nested enabled booleans. | +| probes.liveness.enabled | Bool | `false` | Whether to include liveness probe, this will be ignored if probes.enabled was set to true. | +| probes.liveness.failureThreshold | Integer | `3` | Liveness probe failure threshold. | +| probes.liveness.initialDelaySeconds | Integer | `15` | Liveness probe initial delay. | +| probes.liveness.periodSeconds | Integer | `10` | Liveness probe period. | +| probes.liveness.timeoutSeconds | Integer | `1` | Liveness probe timeout. | +| probes.readiness.enabled | Bool | `false` | Whether to include readiness probe, this will be ignored if probes.enabled was set to true. | +| probes.readiness.failureThreshold | Integer | `3` | Readiness probe failure threshold. | +| probes.readiness.initialDelaySeconds | Integer | `15` | Readiness probe initial delay. | +| probes.readiness.periodSeconds | Integer | `10` | Readiness probe period. | +| probes.readiness.successThreshold | Integer | `1` | Readiness probe success threshold. | +| probes.readiness.timeoutSeconds | Integer | `1` | Readiness probe timeout. | | replicaCount | Optional | `1` | Replicas. Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#replicas | | resources | Optional | `{"limits":{"cpu":"500m","memory":"500Mi"},"requests":{"cpu":"100m","memory":"50Mi"}}` | Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ | | service.create | Optional | `true` | Controls whether a service should be created. | | tolerations | Optional | `[{"key":"node-role.kubernetes.io/master","operator":"Exists"},{"key":"node-role.kubernetes.io/control-plane","operator":"Exists"}]` | Tolerations for nodes that have taints on them. Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1) diff --git a/charts/ocean-metric-exporter/templates/_helpers.tpl b/charts/ocean-metric-exporter/templates/_helpers.tpl index 1e29533..f3abfa2 100644 --- a/charts/ocean-metric-exporter/templates/_helpers.tpl +++ b/charts/ocean-metric-exporter/templates/_helpers.tpl @@ -103,3 +103,29 @@ Container command. {{- printf "[ \"java\", \"-Dspring.profiles.active=prod,default\", \"-jar\", \"/app/app.jar\" ]" -}} {{- end }} +{{/* +probes. +*/}} +{{- define "ocean-metric-exporter.probes" -}} +{{- if or .Values.probes.liveness.enabled .Values.probes.enabled }} +livenessProbe: + httpGet: + path: /health/liveness + port: exporter + initialDelaySeconds: {{ .Values.probes.liveness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.liveness.periodSeconds }} + failureThreshold: {{ .Values.probes.liveness.failureThreshold }} + timeoutSeconds: {{ .Values.probes.liveness.timeoutSeconds }} +{{- end}} +{{- if or .Values.probes.readiness.enabled .Values.probes.enabled }} +readinessProbe: + httpGet: + path: /health/readiness + port: exporter + initialDelaySeconds: {{ .Values.probes.readiness.initialDelaySeconds }} + periodSeconds: {{ .Values.probes.readiness.periodSeconds }} + failureThreshold: {{ .Values.probes.readiness.failureThreshold }} + successThreshold: {{ .Values.probes.readiness.successThreshold }} + timeoutSeconds: {{ .Values.probes.readiness.timeoutSeconds }} +{{- end}} +{{- end }} \ No newline at end of file diff --git a/charts/ocean-metric-exporter/templates/deployment.yaml b/charts/ocean-metric-exporter/templates/deployment.yaml index b12a86a..0903100 100644 --- a/charts/ocean-metric-exporter/templates/deployment.yaml +++ b/charts/ocean-metric-exporter/templates/deployment.yaml @@ -90,6 +90,7 @@ spec: - --deny-labels={{ join "," .Values.metricsConfiguration.denyLabels }} resources: {{- toYaml .Values.resources | nindent 12 }} + {{- include "ocean-metric-exporter.probes" . | nindent 8 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/ocean-metric-exporter/values.yaml b/charts/ocean-metric-exporter/values.yaml index 81a6d51..be049d2 100644 --- a/charts/ocean-metric-exporter/values.yaml +++ b/charts/ocean-metric-exporter/values.yaml @@ -63,6 +63,39 @@ service: # -- (Optional) Controls whether a service should be created. create: true +# Probes configuration +probes: + # -- (Bool) Whether to include both liveness and readiness probe, if this is set to true it will ignore the nested enabled booleans. + enabled: true + + # Liveness probe configuration. + liveness: + # -- (Bool) Whether to include liveness probe, this will be ignored if probes.enabled was set to true. + enabled: false + # -- (Integer) Liveness probe initial delay. + initialDelaySeconds: 15 + # -- (Integer) Liveness probe period. + periodSeconds: 10 + # -- (Integer) Liveness probe failure threshold. + failureThreshold: 3 + # -- (Integer) Liveness probe timeout. + timeoutSeconds: 1 + + # Readiness probe configuration. + readiness: + # -- (Bool) Whether to include readiness probe, this will be ignored if probes.enabled was set to true. + enabled: false + # -- (Integer) Readiness probe initial delay. + initialDelaySeconds: 15 + # -- (Integer) Readiness probe period. + periodSeconds: 10 + # -- (Integer) Readiness probe failure threshold. + failureThreshold: 3 + # -- (Integer) Readiness probe success threshold. + successThreshold: 1 + # -- (Integer) Readiness probe timeout. + timeoutSeconds: 1 + # -- (Optional) Exporter Metrics Configurations metricsConfiguration: # -- (Array[string]) List of Categories to enable - if empty will get no metrics. Additional possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=categories diff --git a/charts/ocean-network-client/README.md b/charts/ocean-network-client/README.md index dae86d2..5258e03 100644 --- a/charts/ocean-network-client/README.md +++ b/charts/ocean-network-client/README.md @@ -41,4 +41,4 @@ helm install my-release spot/ocean-network-client | tolerations | Optional | `[{"operator":"Exists"}]` | Tolerations - Enable pods to run an all nodes in cluster Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ | ---------------------------------------------- -Autogenerated from chart metadata using [helm-docs v1.12.0](https://github.com/norwoodj/helm-docs/releases/v1.12.0) +Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)