From 6cf09bebecb993ed045ab7f4147254ea2bebe72f Mon Sep 17 00:00:00 2001 From: Darren Oakley Date: Tue, 20 Aug 2024 12:12:52 +0100 Subject: [PATCH] [bitnami/grafana-operator] Add some pod scheduling directives (#28861) * [bitnami/grafana-operator] Allow topologySpreadConstraints to be configured for a grafana instance. Signed-off-by: Darren Oakley * [bitnami/grafana-operator] Add a PDB resource for a configured grafana instance. Signed-off-by: Darren Oakley * [bitnami/grafana-operator] Bump the chart version Signed-off-by: Darren Oakley * Update CHANGELOG.md Signed-off-by: Bitnami Containers * Update README.md with readme-generator-for-helm Signed-off-by: Bitnami Containers * Update CHANGELOG.md Signed-off-by: Bitnami Containers --------- Signed-off-by: Darren Oakley Signed-off-by: Bitnami Containers Co-authored-by: Bitnami Containers --- bitnami/grafana-operator/CHANGELOG.md | 8 ++++-- bitnami/grafana-operator/Chart.lock | 6 ++--- bitnami/grafana-operator/Chart.yaml | 4 +-- bitnami/grafana-operator/README.md | 3 +++ .../templates/deployment.yaml | 2 ++ .../templates/grafana-pdb.yaml | 27 +++++++++++++++++++ .../grafana-operator/templates/grafana.yaml | 3 +++ bitnami/grafana-operator/templates/pdb.yaml | 1 + bitnami/grafana-operator/values.yaml | 10 +++++++ 9 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 bitnami/grafana-operator/templates/grafana-pdb.yaml diff --git a/bitnami/grafana-operator/CHANGELOG.md b/bitnami/grafana-operator/CHANGELOG.md index 22ef63838b286d..b296cff3d471ba 100644 --- a/bitnami/grafana-operator/CHANGELOG.md +++ b/bitnami/grafana-operator/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## 4.5.0 (2024-08-09) +## 4.6.0 (2024-08-14) -* [bitnami/grafana-operator] Add missing CRD + RBAC ([#28780](https://github.com/bitnami/charts/pull/28780)) +* [bitnami/grafana-operator] Add some pod scheduling directives ([#28861](https://github.com/bitnami/charts/pull/28861)) + +## 4.5.0 (2024-08-12) + +* [bitnami/grafana-operator] Add missing CRD + RBAC (#28780) ([d9075fa](https://github.com/bitnami/charts/commit/d9075fa4000414377ae8b2be67cc8a5616894fff)), closes [#28780](https://github.com/bitnami/charts/issues/28780) ## 4.4.15 (2024-08-08) diff --git a/bitnami/grafana-operator/Chart.lock b/bitnami/grafana-operator/Chart.lock index 4ac277a8dc7345..e27cc4795986fe 100644 --- a/bitnami/grafana-operator/Chart.lock +++ b/bitnami/grafana-operator/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common repository: oci://registry-1.docker.io/bitnamicharts - version: 2.21.0 -digest: sha256:aad727fb6bd333a7ebb22f06f1edcb53349acdbffaa1baffa0266d9a33162dbd -generated: "2024-08-07T02:25:55.329899808Z" + version: 2.22.0 +digest: sha256:a8fb2fc887ead658a89598a48acde5324196fbc0509503a3eaed50a710fbfe74 +generated: "2024-08-13T10:32:47.216451157+01:00" diff --git a/bitnami/grafana-operator/Chart.yaml b/bitnami/grafana-operator/Chart.yaml index 3917124a8b7413..5e9b97f1295579 100644 --- a/bitnami/grafana-operator/Chart.yaml +++ b/bitnami/grafana-operator/Chart.yaml @@ -29,5 +29,5 @@ maintainers: url: https://github.com/bitnami/charts name: grafana-operator sources: -- https://github.com/bitnami/charts/tree/main/bitnami/grafana-operator -version: 4.5.0 + - https://github.com/bitnami/charts/tree/main/bitnami/grafana-operator +version: 4.6.0 diff --git a/bitnami/grafana-operator/README.md b/bitnami/grafana-operator/README.md index f6d6f365b111b3..ac32e657b401ee 100644 --- a/bitnami/grafana-operator/README.md +++ b/bitnami/grafana-operator/README.md @@ -363,6 +363,9 @@ extraDeploy: | `grafana.affinity` | Affinity for controller pod assignment | `{}` | | `grafana.nodeSelector` | Node labels for controller pod assignment | `{}` | | `grafana.tolerations` | Tolerations for controller pod assignment | `[]` | +| `grafana.pdb.create` | Enable/disable a Pod Disruption Budget creation | `false` | +| `grafana.pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `""` | +| `grafana.pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable. Defaults to `1` if both `grafana.pdb.minAvailable` and `grafana.pdb.maxUnavailable` are empty. | `""` | | `grafana.envFrom` | Extra environment variable to pass to the running container | `[]` | | `grafana.client.timeout` | The timeout in seconds for the Grafana Rest API on that instance | `5` | | `grafana.labels` | Add additional labels to the grafana deployment, service and ingress resources | `{}` | diff --git a/bitnami/grafana-operator/templates/deployment.yaml b/bitnami/grafana-operator/templates/deployment.yaml index c35f87c277e2b2..9dc103d1ea7671 100644 --- a/bitnami/grafana-operator/templates/deployment.yaml +++ b/bitnami/grafana-operator/templates/deployment.yaml @@ -10,6 +10,7 @@ metadata: name: {{ include "common.names.fullname" . }} namespace: {{ include "common.names.namespace" . | quote }} labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + app.kubernetes.io/component: operator {{- if .Values.commonAnnotations }} annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} @@ -24,6 +25,7 @@ spec: template: metadata: labels: {{- include "common.labels.standard" ( dict "customLabels" $podLabels "context" $ ) | nindent 8 }} + app.kubernetes.io/component: operator {{- if .Values.operator.podAnnotations }} annotations: {{- include "common.tplvalues.render" (dict "value" .Values.operator.podAnnotations "context" $) | nindent 8 }} {{- end }} diff --git a/bitnami/grafana-operator/templates/grafana-pdb.yaml b/bitnami/grafana-operator/templates/grafana-pdb.yaml new file mode 100644 index 00000000000000..76a14896fae725 --- /dev/null +++ b/bitnami/grafana-operator/templates/grafana-pdb.yaml @@ -0,0 +1,27 @@ +{{- /* +Copyright Broadcom, Inc. All Rights Reserved. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if and .Values.grafana.enabled .Values.grafana.pdb.create }} +apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} +kind: PodDisruptionBudget +metadata: + name: {{ printf "%s-grafana" (include "common.names.fullname" .) | trunc 63 | trimSuffix "-" }} + namespace: {{ include "common.names.namespace" . | quote }} + {{- $grafanaLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.grafana.labels .Values.commonLabels ) "context" . ) }} + labels: {{- include "common.labels.standard" ( dict "customLabels" $grafanaLabels "context" $ ) | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + {{- if .Values.grafana.pdb.minAvailable }} + minAvailable: {{ .Values.grafana.pdb.minAvailable }} + {{- end }} + {{- if or .Values.grafana.pdb.maxUnavailable (not .Values.grafana.pdb.minAvailable) }} + maxUnavailable: {{ .Values.grafana.pdb.maxUnavailable | default 1 }} + {{- end }} + selector: + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $grafanaLabels "context" $ ) | nindent 6 }} + app.kubernetes.io/component: grafana +{{- end }} diff --git a/bitnami/grafana-operator/templates/grafana.yaml b/bitnami/grafana-operator/templates/grafana.yaml index d85db65043e9e8..1ca75e45a64fb2 100644 --- a/bitnami/grafana-operator/templates/grafana.yaml +++ b/bitnami/grafana-operator/templates/grafana.yaml @@ -102,6 +102,9 @@ spec: {{- if .Values.grafana.tolerations }} tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.grafana.tolerations "context" $) | nindent 12 }} {{- end }} + {{- if .Values.grafana.topologySpreadConstraints }} + topologySpreadConstraints: {{- include "common.tplvalues.render" (dict "value" .Values.grafana.topologySpreadConstraints "context" $) | nindent 12 }} + {{- end }} {{- if .Values.grafana.nodeSelector }} nodeSelector: {{ toYaml .Values.grafana.nodeSelector | nindent 12 }} {{- end }} diff --git a/bitnami/grafana-operator/templates/pdb.yaml b/bitnami/grafana-operator/templates/pdb.yaml index 410dd75a813543..d0547a39ab8317 100644 --- a/bitnami/grafana-operator/templates/pdb.yaml +++ b/bitnami/grafana-operator/templates/pdb.yaml @@ -23,4 +23,5 @@ spec: {{- $podLabels := include "common.tplvalues.merge" (dict "values" (list .Values.operator.podLabels .Values.commonLabels) "context" .) }} selector: matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} + app.kubernetes.io/component: operator {{- end }} diff --git a/bitnami/grafana-operator/values.yaml b/bitnami/grafana-operator/values.yaml index 9f3e8459b834b3..485f77359470a8 100644 --- a/bitnami/grafana-operator/values.yaml +++ b/bitnami/grafana-operator/values.yaml @@ -656,6 +656,16 @@ grafana: ## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ ## tolerations: [] + ## Pod Disruption Budget configuration for the grafana instance + ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb + ## @param grafana.pdb.create Enable/disable a Pod Disruption Budget creation + ## @param grafana.pdb.minAvailable Minimum number/percentage of pods that should remain scheduled + ## @param grafana.pdb.maxUnavailable Maximum number/percentage of pods that may be made unavailable. Defaults to `1` if both `grafana.pdb.minAvailable` and `grafana.pdb.maxUnavailable` are empty. + ## + pdb: + create: false + minAvailable: "" + maxUnavailable: "" ## @param grafana.envFrom Extra environment variable to pass to the running container ## Ref: https://github.com/integr8ly/grafana-operator/blob/master/documentation/deploy_grafana.md#configuring-the-deployment ## e.g: