From 57e28417700276ff10076bec829e21ce55ddb748 Mon Sep 17 00:00:00 2001 From: Roberto Giovanardi Date: Thu, 23 May 2024 14:18:04 +0200 Subject: [PATCH 1/2] chore: added maxUnavailable pdb option You can now choose either minAvailable or maxUnavailable specs for the PodDisruptionBudget Ticket: MC-7436 Signed-off-by: Roberto Giovanardi --- README.md | 7 +++++++ mender/CHANGELOG.md | 3 +++ mender/templates/_helpers.tpl | 7 +++++++ mender/values.yaml | 1 + 4 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 7988849d..407b981b 100644 --- a/README.md +++ b/README.md @@ -244,6 +244,7 @@ The following table lists the global, default, and other parameters supported by | `default.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `default.pdb.enabled` | PodDistruptionBudget enabled | `false` | | `default.pdb.minAvailable` | PodDistruptionBudget minAvailable | `1` | +| `default.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `default.imagePullSecrets` | Optional list of existing Image Pull Secrets in the format of `- name: my-custom-secret` | `[]` | | `default.updateStrategy` | The strategy to use to update existing pods | `rollingUpdate = { maxSurge = 25%, maxUnavailable = 0 }` | | `default.probesOverrides.timeoutSeconds` | Override the `timeoutSeconds` for every Readiness and Liveness probes. | `nil` | @@ -338,6 +339,7 @@ The following table lists the parameters for the `api-gateway` component and the | `api_gateway.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `api_gateway.pdb.enabled` | PodDistruptionBudget enabled | `nil` | | `api_gateway.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `api_gateway.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `api_gateway.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `api_gateway.certs` | certificate management | `nil` | | `api_gateway.certs.cert` | Public certificate (with full chain optionally) in PEM format | `nil` | @@ -400,6 +402,7 @@ The following table lists the parameters for the `deployments` component and the | `deployments.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `deployments.pdb.enabled` | PodDistruptionBudget enabled | `nil` | | `deployments.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `deployments.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `deployments.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `deployments.migrationRestartPolicy` | Migration job: restartPolicy option | `Never` | | `deployments.migrationResources` | Migration job: optional K8s resources. If not specified, uses the deployment resources | `nil` | @@ -460,6 +463,7 @@ The following table lists the parameters for the `device-auth` component and the | `device_auth.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `device_auth.pdb.enabled` | PodDistruptionBudget enabled | `nil` | | `device_auth.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `device_auth.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `device_auth.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `device_auth.certs` | certificate management | `nil` | | `device_auth.certs.key` | Private key in PEM format | `nil` | @@ -557,6 +561,7 @@ The following table lists the parameters for the `inventory` component and their | `inventory.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `inventory.pdb.enabled` | PodDistruptionBudget enabled | `nil` | | `inventory.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `inventory.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `inventory.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `inventory.migrationRestartPolicy` | Migration job: restartPolicy option | `Never` | | `inventory.migrationResources` | Migration job: optional K8s resources. If not specified, uses the deployment resources | `nil` | @@ -640,6 +645,7 @@ The following table lists the parameters for the `tenantadm` component and their | `tenantadm.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `tenantadm.pdb.enabled` | PodDistruptionBudget enabled | `nil` | | `tenantadm.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `tenantadm.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `tenantadm.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `tenantadm.certs` | certificate management | `nil` | | `tenantadm.certs.key` | Private key in PEM format | `nil` | @@ -714,6 +720,7 @@ The following table lists the parameters for the `useradm` component and their d | `useradm.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `useradm.pdb.enabled` | PodDistruptionBudget enabled | `nil` | | `useradm.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `useradm.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `useradm.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `useradm.certs` | certificate management | `nil` | | `useradm.certs.key` | Private key in PEM format | `nil` | diff --git a/mender/CHANGELOG.md b/mender/CHANGELOG.md index e56ed6dc..42e4ccf2 100644 --- a/mender/CHANGELOG.md +++ b/mender/CHANGELOG.md @@ -1,5 +1,8 @@ # Mender Helm chart +## Version 5.9.0 +* Added `pdb.maxUnavailable` option. + ## Version 5.8.3 * Fix: correctly setup the Integration Version. diff --git a/mender/templates/_helpers.tpl b/mender/templates/_helpers.tpl index 231f0286..d7e0a884 100644 --- a/mender/templates/_helpers.tpl +++ b/mender/templates/_helpers.tpl @@ -210,12 +210,19 @@ spec: {{- $_ := (mergeOverwrite $pdb .override.pdb) }} {{- end }} {{- if $pdb.enabled }} +{{- if and $pdb.minAvailable $pdb.maxUnavailable }} +{{- fail "Only one of minAvailable or maxUnavailable can be set" }} +{{- end }} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: {{ .name }} spec: + {{- if $pdb.minAvailable }} minAvailable: {{ $pdb.minAvailable | default 1 }} + {{- else if $pdb.maxUnavailable }} + maxUnavailable: {{ $pdb.maxUnavailable | default 1 }} + {{- end }} selector: matchLabels: run: {{ .name }} diff --git a/mender/values.yaml b/mender/values.yaml index f00fb5da..c3ae467c 100644 --- a/mender/values.yaml +++ b/mender/values.yaml @@ -72,6 +72,7 @@ default: pdb: enabled: false minAvailable: 1 + # maxUnavailable: 1 # custom default envs for every service customEnvs: [] From 2ade83cbaaf9df4dc988981916482581842bcb93 Mon Sep 17 00:00:00 2001 From: Roberto Giovanardi Date: Thu, 23 May 2024 14:20:28 +0200 Subject: [PATCH 2/2] chore: added deviceconnect poddisruptionbudget Ticket: MC-7302 Signed-off-by: Roberto Giovanardi --- README.md | 3 +++ mender/CHANGELOG.md | 1 + mender/Chart.yaml | 2 +- mender/templates/deviceconnect/pdb.yaml | 5 +++++ 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 mender/templates/deviceconnect/pdb.yaml diff --git a/README.md b/README.md index 407b981b..f15fa2c9 100644 --- a/README.md +++ b/README.md @@ -945,6 +945,9 @@ The following table lists the parameters for the `deviceconnect` component and t | `deviceconnect.hpa.behavior` | HorizontalPodAutoscaler behavior as defined in the [reference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.28/#horizontalpodautoscalerbehavior-v2-autoscaling) | `nil` | | `deviceconnect.gracefulShutdownTimeout` | Timeout for the graceful shutdown | `60s` | | `deviceconnect.terminationGracePeriodSeconds` | Termination grace period in seconds | `65` | +| `deviceconnect.pdb.enabled` | PodDistruptionBudget enabled | `nil` | +| `deviceconnect.pdb.minAvailable` | PodDistruptionBudget minAvailable | `nil` | +| `deviceconnect.pdb.maxUnavailable` | PodDistruptionBudget maxUnavailable | `nil` | | `deviceconnect.priorityClassName` | Optional pre-existing priorityClassName to be assigned to the resource | `nil` | | `deviceconnect.migrationRestartPolicy` | Migration job: restartPolicy option | `Never` | | `deviceconnect.migrationResources` | Migration job: optional K8s resources. If not specified, uses the deployment resources | `nil` | diff --git a/mender/CHANGELOG.md b/mender/CHANGELOG.md index 42e4ccf2..b8df72c4 100644 --- a/mender/CHANGELOG.md +++ b/mender/CHANGELOG.md @@ -2,6 +2,7 @@ ## Version 5.9.0 * Added `pdb.maxUnavailable` option. +* Added `deviceconnect` PodDisruptionBudget ## Version 5.8.3 * Fix: correctly setup the Integration Version. diff --git a/mender/Chart.yaml b/mender/Chart.yaml index d9e399cb..54c5f4f1 100644 --- a/mender/Chart.yaml +++ b/mender/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: "3.7.4" description: Mender is a robust and secure way to update all your software and deploy your IoT devices at scale with support for customization name: mender -version: 5.8.3 +version: 5.9.0 keywords: - mender - iot diff --git a/mender/templates/deviceconnect/pdb.yaml b/mender/templates/deviceconnect/pdb.yaml new file mode 100644 index 00000000..59a95f93 --- /dev/null +++ b/mender/templates/deviceconnect/pdb.yaml @@ -0,0 +1,5 @@ +{{- if .Values.deviceconnect.enabled }} +{{- $servicename := "deviceconnect" }} +{{- $context := (dict "default" .Values.default "override" .Values.deviceconnect "name" (printf "%s-%s" (include "mender.fullname" . ) $servicename ) ) -}} +{{- include "mender.pdb" $context }} +{{- end }}