From f517f471d2765ace0e7981093117b10ffc640c0c Mon Sep 17 00:00:00 2001 From: Sherif Ayad Date: Thu, 30 Mar 2023 15:07:31 +0200 Subject: [PATCH] feat: enabled poddisruptionbudget in case more than one broker instance is used (#50) Signed-off-by: Sherif Ayad --- charts/pact-broker/Chart.yaml | 2 +- charts/pact-broker/README.md | 9 ++++---- .../templates/poddisruptionbudget.yaml | 23 +++++++++++++++++++ charts/pact-broker/values.yaml | 10 ++++++-- 4 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 charts/pact-broker/templates/poddisruptionbudget.yaml diff --git a/charts/pact-broker/Chart.yaml b/charts/pact-broker/Chart.yaml index 97cbd96..bc86205 100644 --- a/charts/pact-broker/Chart.yaml +++ b/charts/pact-broker/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: pact-broker description: The Pact Broker is an application for sharing for Pact contracts and verification results. type: application -version: 0.8.0 +version: 0.9.0 appVersion: 2.105.0.1 dependencies: - condition: postgresql.enabled diff --git a/charts/pact-broker/README.md b/charts/pact-broker/README.md index 54f970f..15c9717 100644 --- a/charts/pact-broker/README.md +++ b/charts/pact-broker/README.md @@ -1,6 +1,6 @@ # pact-broker -![Version: 0.8.0](https://img.shields.io/badge/Version-0.8.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.105.0.1](https://img.shields.io/badge/AppVersion-2.105.0.1-informational?style=flat-square) +![Version: 0.9.0](https://img.shields.io/badge/Version-0.9.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.105.0.1](https://img.shields.io/badge/AppVersion-2.105.0.1-informational?style=flat-square) The Pact Broker is an application for sharing for Pact contracts and verification results. @@ -121,6 +121,7 @@ helm upgrade -i oci://ghcr.io/pact-foundation/pact-broker-chart/p | broker.containerSecurityContext.enabled | Enable Pact Broker containers' Security Context | bool | `true` | | broker.containerSecurityContext.runAsNonRoot | Set Pact Broker container's Security Context runAsNonRoot | bool | `true` | | broker.containerSecurityContext.runAsUser | Set Pact Broker container's Security Context runAsUser | int | `1001` | +| broker.extraContainers | Additional containers to add to the Pact Broker pods | list | `[]` | | broker.labels | Additional labels that can be added to the Broker deployment | object | `{}` | | broker.livenessProbe.enabled | Enable livenessProbe on Pact Broker containers | bool | `true` | | broker.livenessProbe.failureThreshold | Failure threshold for livenessProbe | int | `3` | @@ -129,6 +130,7 @@ helm upgrade -i oci://ghcr.io/pact-foundation/pact-broker-chart/p | broker.livenessProbe.successThreshold | Success threshold for livenessProbe | int | `1` | | broker.livenessProbe.timeoutSeconds | Timeout seconds for livenessProbe | int | `5` | | broker.nodeSelector | Pact Broker [Node Selector](https://kubernetes.io/docs/user-guide/node-selection/) | object | `{}` | +| broker.podDisruptionBudget.maxUnavailable | Max Unavailable Pods (alternatively one can define `minAvailable`) | int | `1` | | broker.podSecurityContext.enabled | Enable Pact Broker pods' Security Context | bool | `true` | | broker.podSecurityContext.fsGroup | Set Pact Broker pod's Security Context fsGroup | int | `1001` | | broker.readinessProbe.enabled | Enable readinessProbe on Pact Broker containers | bool | `true` | @@ -144,9 +146,8 @@ helm upgrade -i oci://ghcr.io/pact-foundation/pact-broker-chart/p | broker.resources.requests.memory | | string | `"512Mi"` | | broker.revisionHistoryLimit | Number of Deployment Revisions to set | int | `10` | | broker.tolerations | Pact Broker [Tolerations](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) | list | `[]` | -| broker.volumeMounts | | list | `[]` | -| broker.volumes | | list | `[]` | -| broker.extraContainers | Additional containers to add to the Pact Broker pods | list | `[]` | +| broker.volumeMounts | Volume mounts | list | `[]` | +| broker.volumes | Volumes to mount | list | `[]` | | externalDatabase.config.adapter | Database engine to use. Only allowed values are `postgres` or `sqlite`. More info [here](https://docs.pact.io/pact_broker/docker_images/pactfoundation#getting-started) | string | `""` | | externalDatabase.config.auth.existingSecret | Name of an existing Kubernetes secret containing the database credentials | string | `""` | | externalDatabase.config.auth.existingSecretPasswordKey | The key to which the password will be stored under within existing secret. | string | `"user-password"` | diff --git a/charts/pact-broker/templates/poddisruptionbudget.yaml b/charts/pact-broker/templates/poddisruptionbudget.yaml new file mode 100644 index 0000000..2eb2897 --- /dev/null +++ b/charts/pact-broker/templates/poddisruptionbudget.yaml @@ -0,0 +1,23 @@ +{{- if gt (int .Values.broker.replicaCount) 1 }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ include "common.names.fullname" . }} + namespace: {{ .Release.Namespace | quote }} + labels: + name: {{ include "chart.fullname" . }} + app.kubernetes.io/name: {{ include "chart.name" . }} + helm.sh/chart: {{ .Chart.Name }} + app.kubernetes.io/instance: {{ .Release.Name }} +spec: + selector: + matchLabels: + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/name: {{ include "chart.name" . }} + {{- with .Values.broker.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ . }} + {{- end }} + {{- with .Values.broker.podDisruptionBudget.minAvailable }} + minAvailable: {{ . }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/pact-broker/values.yaml b/charts/pact-broker/values.yaml index 9b45856..1a4b3a4 100644 --- a/charts/pact-broker/values.yaml +++ b/charts/pact-broker/values.yaml @@ -340,13 +340,19 @@ broker: # -- Success threshold for readinessProbe successThreshold: 1 - # Volumes to mount + # Pact Broker [Pod Disruption Budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/#specifying-a-poddisruptionbudget) + podDisruptionBudget: + # -- Max Unavailable Pods (alternatively one can define `minAvailable`) + maxUnavailable: 1 + # minAvailable: 1 + + # -- Volumes to mount volumes: [] # - name: cache-volume # emptyDir: # sizeLimit: 500Mi - # Volume mounts + # -- Volume mounts volumeMounts: [] # - mountPath: # name: