From d255379ba59aa3887ebae9db813e207895cdd80f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Pinkava?= Date: Mon, 23 Sep 2024 16:19:27 +0200 Subject: [PATCH] [bitnami/rabbitmq-cluster-operator] Add PodDistruptionBidget (PBDs) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allow running the Operator, and especially the validating webhook, in HA mode. Signed-off-by: Jiří Pinkava --- bitnami/rabbitmq-cluster-operator/Chart.yaml | 2 +- bitnami/rabbitmq-cluster-operator/README.md | 8 +++++- .../templates/cluster-operator/pdb.yaml | 28 +++++++++++++++++++ .../messaging-topology-operator/pdb.yaml | 28 +++++++++++++++++++ bitnami/rabbitmq-cluster-operator/values.yaml | 20 +++++++++++++ 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 bitnami/rabbitmq-cluster-operator/templates/cluster-operator/pdb.yaml create mode 100644 bitnami/rabbitmq-cluster-operator/templates/messaging-topology-operator/pdb.yaml diff --git a/bitnami/rabbitmq-cluster-operator/Chart.yaml b/bitnami/rabbitmq-cluster-operator/Chart.yaml index 00b6006c454c7e..0e06852d4c2ab3 100644 --- a/bitnami/rabbitmq-cluster-operator/Chart.yaml +++ b/bitnami/rabbitmq-cluster-operator/Chart.yaml @@ -37,4 +37,4 @@ maintainers: name: rabbitmq-cluster-operator sources: - https://github.com/bitnami/charts/tree/main/bitnami/rabbitmq-cluster-operator -version: 4.3.22 +version: 4.3.23 diff --git a/bitnami/rabbitmq-cluster-operator/README.md b/bitnami/rabbitmq-cluster-operator/README.md index c583f6c967abd3..adc4c6c4cfc37a 100644 --- a/bitnami/rabbitmq-cluster-operator/README.md +++ b/bitnami/rabbitmq-cluster-operator/README.md @@ -286,6 +286,9 @@ extraDeploy: | `clusterOperator.customStartupProbe` | Custom startupProbe that overrides the default one | `{}` | | `clusterOperator.resourcesPreset` | Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if clusterOperator.resources is set (clusterOperator.resources is recommended for production). | `nano` | | `clusterOperator.resources` | Set container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | +| `clusterOperator.pdb.create` | Enable a Pod Disruption Budget creation | `true` | +| `clusterOperator.pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `""` | +| `clusterOperator.pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable | `""` | | `clusterOperator.podSecurityContext.enabled` | Enabled RabbitMQ Cluster Operator pods' Security Context | `true` | | `clusterOperator.podSecurityContext.fsGroupChangePolicy` | Set filesystem group change policy | `Always` | | `clusterOperator.podSecurityContext.sysctls` | Set kernel settings using the sysctl interface | `[]` | @@ -428,6 +431,9 @@ extraDeploy: | `msgTopologyOperator.existingWebhookCertCABundle` | PEM-encoded CA Bundle of the existing secret provided in existingWebhookCertSecret (only if useCertManager=false) | `""` | | `msgTopologyOperator.resourcesPreset` | Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if msgTopologyOperator.resources is set (msgTopologyOperator.resources is recommended for production). | `nano` | | `msgTopologyOperator.resources` | Set container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | +| `msgTopologyOperator.pdb.create` | Enable a Pod Disruption Budget creation | `true` | +| `msgTopologyOperator.pdb.minAvailable` | Minimum number/percentage of pods that should remain scheduled | `""` | +| `msgTopologyOperator.pdb.maxUnavailable` | Maximum number/percentage of pods that may be made unavailable | `""` | | `msgTopologyOperator.podSecurityContext.enabled` | Enabled RabbitMQ Messaging Topology Operator pods' Security Context | `true` | | `msgTopologyOperator.podSecurityContext.fsGroupChangePolicy` | Set filesystem group change policy | `Always` | | `msgTopologyOperator.podSecurityContext.sysctls` | Set kernel settings using the sysctl interface | `[]` | @@ -632,4 +638,4 @@ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and -limitations under the License. \ No newline at end of file +limitations under the License. diff --git a/bitnami/rabbitmq-cluster-operator/templates/cluster-operator/pdb.yaml b/bitnami/rabbitmq-cluster-operator/templates/cluster-operator/pdb.yaml new file mode 100644 index 00000000000000..422e29075da7eb --- /dev/null +++ b/bitnami/rabbitmq-cluster-operator/templates/cluster-operator/pdb.yaml @@ -0,0 +1,28 @@ +{{- /* +Copyright Broadcom, Inc. All Rights Reserved. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if .Values.clusterOperator.pdb.create }} +apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} +kind: PodDisruptionBudget +metadata: + name: {{ template "rmqco.clusterOperator.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + app.kubernetes.io/component: rabbitmq-operator + app.kubernetes.io/part-of: rabbitmq + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + {{- if .Values.clusterOperator.pdb.minAvailable }} + minAvailable: {{ .Values.clusterOperator.pdb.minAvailable }} + {{- end }} + {{- if or .Values.clusterOperator.pdb.maxUnavailable (not .Values.clusterOperator.pdb.minAvailable) }} + maxUnavailable: {{ .Values.clusterOperator.pdb.maxUnavailable | default 1 }} + {{- end }} + {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.clusterOperator.podLabels .Values.commonLabels ) "context" . ) }} + selector: + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} + app.kubernetes.io/component: rabbitmq-operator diff --git a/bitnami/rabbitmq-cluster-operator/templates/messaging-topology-operator/pdb.yaml b/bitnami/rabbitmq-cluster-operator/templates/messaging-topology-operator/pdb.yaml new file mode 100644 index 00000000000000..46e3ec04a4c007 --- /dev/null +++ b/bitnami/rabbitmq-cluster-operator/templates/messaging-topology-operator/pdb.yaml @@ -0,0 +1,28 @@ +{{- /* +Copyright Broadcom, Inc. All Rights Reserved. +SPDX-License-Identifier: APACHE-2.0 +*/}} + +{{- if .Values.msgTopologyOperator.pdb.create }} +apiVersion: {{ include "common.capabilities.policy.apiVersion" . }} +kind: PodDisruptionBudget +metadata: + name: {{ template "rmqco.msgTopologyOperator.fullname" . }} + namespace: {{ include "common.names.namespace" . | quote }} + labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }} + app.kubernetes.io/component: messaging-topology-operator + app.kubernetes.io/part-of: rabbitmq + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} +spec: + {{- if .Values.msgTopologyOperator.pdb.minAvailable }} + minAvailable: {{ .Values.msgTopologyOperator.pdb.minAvailable }} + {{- end }} + {{- if or .Values.msgTopologyOperator.pdb.maxUnavailable (not .Values.msgTopologyOperator.pdb.minAvailable) }} + maxUnavailable: {{ .Values.msgTopologyOperator.pdb.maxUnavailable | default 1 }} + {{- end }} + {{- $podLabels := include "common.tplvalues.merge" ( dict "values" ( list .Values.msgTopologyOperator.podLabels .Values.commonLabels ) "context" . ) }} + selector: + matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" $podLabels "context" $ ) | nindent 6 }} + app.kubernetes.io/component: messaging-topology-operator diff --git a/bitnami/rabbitmq-cluster-operator/values.yaml b/bitnami/rabbitmq-cluster-operator/values.yaml index f1836fe4629143..1c5b48d5dd32d5 100644 --- a/bitnami/rabbitmq-cluster-operator/values.yaml +++ b/bitnami/rabbitmq-cluster-operator/values.yaml @@ -227,6 +227,16 @@ clusterOperator: ## memory: 1024Mi ## resources: {} + ## Pod Disruption Budget configuration + ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ + ## @param clusterOperator.pdb.create Enable a Pod Disruption Budget creation + ## @param clusterOperator.pdb.minAvailable Minimum number/percentage of pods that should remain scheduled + ## @param clusterOperator.pdb.maxUnavailable Maximum number/percentage of pods that may be made unavailable + ## + pdb: + create: true + minAvailable: "" + maxUnavailable: "" ## Configure Pods Security Context ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod ## @param clusterOperator.podSecurityContext.enabled Enabled RabbitMQ Cluster Operator pods' Security Context @@ -775,6 +785,16 @@ msgTopologyOperator: ## memory: 1024Mi ## resources: {} + ## Pod Disruption Budget configuration + ## ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/ + ## @param msgTopologyOperator.pdb.create Enable a Pod Disruption Budget creation + ## @param msgTopologyOperator.pdb.minAvailable Minimum number/percentage of pods that should remain scheduled + ## @param msgTopologyOperator.pdb.maxUnavailable Maximum number/percentage of pods that may be made unavailable + ## + pdb: + create: true + minAvailable: "" + maxUnavailable: "" ## Configure Pods Security Context ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#set-the-security-context-for-a-pod ## @param msgTopologyOperator.podSecurityContext.enabled Enabled RabbitMQ Messaging Topology Operator pods' Security Context