From 31fc70640b76f5658fb89db395d7fc0acae1ea8e Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Thu, 19 Aug 2021 02:10:46 -0700 Subject: [PATCH] [bitnami/grafana-operator] Custom update strategy for Grafana deployment (#6868) * Fix persistence in Grafana Opeartor temporarily * Bump version * Add updateStrategy field to Grafana * Update documentation * Fix default value * Fix default value again * Add warning * Insert a blank line * Update comment based on feedback * Fix template * Bump minor version * Add removed entry in table in readme * Fix indent * Fix wrong field description --- bitnami/grafana-operator/Chart.yaml | 2 +- bitnami/grafana-operator/README.md | 3 ++- .../grafana-operator/templates/grafana.yaml | 3 +++ bitnami/grafana-operator/values.yaml | 20 ++++++++++++++++--- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/bitnami/grafana-operator/Chart.yaml b/bitnami/grafana-operator/Chart.yaml index e339a9ee2..fa647eed2 100644 --- a/bitnami/grafana-operator/Chart.yaml +++ b/bitnami/grafana-operator/Chart.yaml @@ -25,4 +25,4 @@ name: grafana-operator sources: - https://github.com/integr8ly/grafana-operator - https://github.com/bitnami/bitnami-docker-grafana-operator -version: 1.0.1 +version: 1.1.0 diff --git a/bitnami/grafana-operator/README.md b/bitnami/grafana-operator/README.md index 06184a112..f810b2386 100644 --- a/bitnami/grafana-operator/README.md +++ b/bitnami/grafana-operator/README.md @@ -153,7 +153,7 @@ This solution allows to easily deploy multiple Grafana instances compared to the | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -------------------------- | | `operator.enabled` | Enable the deployment of the Grafana Operator | `true` | | `operator.replicaCount` | Number of grafana-operator Pod replicas | `1` | -| `operator.updateStrategy.type` | Set up update strategy for Grafana installation. | `Recreate` | +| `operator.updateStrategy.type` | Set up update strategy for Grafana Operator installation. | `Recreate` | | `operator.image.registry` | Grafana Operator image registry | `docker.io` | | `operator.image.repository` | Grafana Operator image name | `bitnami/grafana-operator` | | `operator.image.tag` | Grafana Operator image tag | `3.10.3-debian-10-r9` | @@ -230,6 +230,7 @@ This solution allows to easily deploy multiple Grafana instances compared to the | `grafana.resources.limits` | The resources limits for the container | `{}` | | `grafana.resources.requests` | The requested resources for the container | `{}` | | `grafana.replicaCount` | Specify the amount of replicas running | `1` | +| `grafana.updateStrategy` | Set up update strategy for Grafana installation. | `{}` | | `grafana.podAffinityPreset` | Pod affinity preset | `""` | | `grafana.podAntiAffinityPreset` | Pod anti-affinity preset | `soft` | | `grafana.nodeAffinityPreset.type` | Set nodeAffinity preset type | `""` | diff --git a/bitnami/grafana-operator/templates/grafana.yaml b/bitnami/grafana-operator/templates/grafana.yaml index 1a3ecb9d3..2cfc79e57 100644 --- a/bitnami/grafana-operator/templates/grafana.yaml +++ b/bitnami/grafana-operator/templates/grafana.yaml @@ -95,6 +95,9 @@ spec: successThreshold: {{ .Values.grafana.readinessProbe.successThreshold }} failureThreshold: {{ .Values.grafana.readinessProbe.failureThreshold }} {{- end }} + {{- if .Values.grafana.updateStrategy }} + strategy: {{ toYaml .Values.grafana.updateStrategy | nindent 6 }} + {{- end }} {{- if .Values.grafana.extraVolumeMounts }} extraVolumeMounts: {{- include "common.tplvalues.render" (dict "value" .Values.grafana.extraVolumeMounts "context" $) | nindent 6 }} diff --git a/bitnami/grafana-operator/values.yaml b/bitnami/grafana-operator/values.yaml index 8745c01cd..8e20aae0b 100644 --- a/bitnami/grafana-operator/values.yaml +++ b/bitnami/grafana-operator/values.yaml @@ -46,7 +46,7 @@ operator: ## @param operator.replicaCount Number of grafana-operator Pod replicas ## replicaCount: 1 - ## @param operator.updateStrategy.type Set up update strategy for Grafana installation. + ## @param operator.updateStrategy.type Set up update strategy for Grafana Operator installation. ## Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to make sure the pods is destroyed first. ## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy ## Example: @@ -432,6 +432,9 @@ grafana: ## persistence: ## @param grafana.persistence.enabled Enable persistent storage for the grafana deployment + ## NOTE: In order to avoid deployment failure due to multi-attach of the same volume, + ## you might also want to set `grafana.updateStrategy` to Recreate. + ## More information can be found here: https://github.com/grafana-operator/grafana-operator/issues/453 ## enabled: false ## @param grafana.persistence.storageClass Define the storageClass for the persistent storage if not defined default is used @@ -512,14 +515,14 @@ grafana: ## jsonnetLibrarySelector: matchLabels: - app.kubernetes.io/instance: '{{ .Release.Name }}' + app.kubernetes.io/instance: "{{ .Release.Name }}" ## @param grafana.dashboardLabelSelectors [object] This selects dashboards on the label. ## A cachall is not possible so you need to define at least one label selector here. ## Ref: https://github.com/integr8ly/grafana-operator/blob/master/documentation/deploy_grafana.md#deploying-grafana ## dashboardLabelSelectors: - matchLabels: - app.kubernetes.io/instance: '{{ .Release.Name }}' + app.kubernetes.io/instance: "{{ .Release.Name }}" ## Grafana containers' liveness probe ## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes ## @param grafana.livenessProbe.enabled Enable livenessProbe @@ -552,6 +555,17 @@ grafana: timeoutSeconds: 5 failureThreshold: 6 successThreshold: 1 + ## @param grafana.updateStrategy Set up update strategy for Grafana installation. + ## Set to Recreate if you use persistent volume that cannot be mounted by more than one pods to make sure the pods is destroyed first. + ## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy + ## Example: + ## updateStrategy: + ## type: RollingUpdate + ## rollingUpdate: + ## maxSurge: 25% + ## maxUnavailable: 25% + ## + updateStrategy: {} ## @param grafana.extraVolumes Optionally specify extra list of additional volumes for the grafana pod(s) ## extraVolumes: []