feat(argo-rollouts): Add PDB option to controller and dashboard (#1294)

* feat(argo-rollouts): Add PodDisruptionBudget option to controller and dashboard

Signed-off-by: Ward Loos <ward.loos@gmail.com>

* Apply changes from code review

Signed-off-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>

Co-authored-by: Ward Loos <ward.loos@aaqua.live>
Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
pull/1271/head argo-rollouts-2.15.0
Ward Loos 2022-05-26 13:59:58 +02:00 committed by GitHub
parent 0956363ebb
commit dc4f6919d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 106 additions and 3 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "v1.2.0"
description: A Helm chart for Argo Rollouts
name: argo-rollouts
version: 2.14.1
version: 2.15.0
icon: https://argoproj.github.io/argo-rollouts/assets/logo.png
home: https://github.com/argoproj/argo-helm
maintainers:
@ -11,4 +11,4 @@ maintainers:
- name: jessesuen
annotations:
artifacthub.io/changes: |
- "[Added]: option to set dashboard replicas count"
- "[Added]: option to enable PodDisruptionBudget for controller and dashboard"

View File

@ -73,6 +73,11 @@ If dashboard is installed by `--set dashboard.enabled=true`, checkout the argo-r
| controller.metrics.serviceMonitor.additionalLabels | object | `{}` | Labels to be added to the ServiceMonitor |
| controller.metrics.serviceMonitor.enabled | bool | `false` | Enable a prometheus ServiceMonitor |
| controller.nodeSelector | object | `{}` | [Node selector] |
| controller.pdb.annotations | object | `{}` | Annotations to be added to controller [Pod Disruption Budget] |
| controller.pdb.enabled | bool | `false` | Deploy a [Pod Disruption Budget] for the controller |
| controller.pdb.labels | object | `{}` | Labels to be added to controller [Pod Disruption Budget] |
| controller.pdb.maxUnavailable | string | `nil` | Maximum number / percentage of pods that may be made unavailable |
| controller.pdb.minAvailable | string | `nil` | Minimum number / percentage of pods that should remain scheduled |
| controller.priorityClassName | string | `""` | [priorityClassName] for the controller |
| controller.readinessProbe | object | See [values.yaml] | Configure readiness [probe] for the controller |
| controller.replicas | int | `2` | The number of controller pods to run |
@ -109,6 +114,11 @@ If dashboard is installed by `--set dashboard.enabled=true`, checkout the argo-r
| dashboard.ingress.paths | list | `["/"]` | Dashboard ingress paths |
| dashboard.ingress.tls | list | `[]` | Dashboard ingress tls |
| dashboard.nodeSelector | object | `{}` | [Node selector] |
| dashboard.pdb.annotations | object | `{}` | Annotations to be added to dashboard [Pod Disruption Budget] |
| dashboard.pdb.enabled | bool | `false` | Deploy a [Pod Disruption Budget] for the dashboard |
| dashboard.pdb.labels | object | `{}` | Labels to be added to dashboard [Pod Disruption Budget] |
| dashboard.pdb.maxUnavailable | string | `nil` | Maximum number / percentage of pods that may be made unavailable |
| dashboard.pdb.minAvailable | string | `nil` | Minimum number / percentage of pods that should remain scheduled |
| dashboard.podSecurityContext | object | `{"runAsNonRoot":true}` | Security Context to set on pod level |
| dashboard.priorityClassName | string | `""` | [priorityClassName] for the dashboard server |
| dashboard.replicas | int | `1` | The number of dashboard pods to run |
@ -157,4 +167,5 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/
[probe]: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
[Tolerations]: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
[priorityClassName]: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
[values.yaml]: https://github.com/argoproj/argo-helm/blob/argo-rollouts-2.14.1/charts/argo-rollouts/values.yaml
[Pod Disruption Budget]: https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets
[values.yaml]: https://github.com/argoproj/argo-helm/blob/argo-rollouts-2.15.0/charts/argo-rollouts/values.yaml

View File

@ -97,4 +97,5 @@ Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/
[probe]: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes
[Tolerations]: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
[priorityClassName]: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/
[Pod Disruption Budget]: https://kubernetes.io/docs/concepts/workloads/pods/disruptions/#pod-disruption-budgets
[values.yaml]: https://github.com/argoproj/argo-helm/blob/argo-rollouts-{{ .Version }}/charts/argo-rollouts/values.yaml

View File

@ -84,3 +84,14 @@ Return the target Kubernetes version
{{- define "argo-rollouts.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
{{- end -}}
{{/*
Return the appropriate apiVersion for pod disruption budget
*/}}
{{- define "argo-rollouts.podDisruptionBudget.apiVersion" -}}
{{- if semverCompare "<1.21-0" (include "argo-rollouts.kubeVersion" $) -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,27 @@
{{- if .Values.controller.pdb.enabled }}
apiVersion: {{ include "argo-rollouts.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-rollouts.fullname" . }}
labels:
{{- include "argo-rollouts.labels" . | nindent 4 }}
{{- with .Values.controller.pdb.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.controller.pdb.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.controller.pdb.minAvailable }}
minAvailable: {{ .Values.controller.pdb.minAvailable }}
{{- else if .Values.controller.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.controller.pdb.maxUnavailable }}
{{- else }}
minAvailable: 0
{{- end }}
selector:
matchLabels:
{{- include "argo-rollouts.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ .Values.controller.component }}
{{- end }}

View File

@ -0,0 +1,27 @@
{{- if .Values.dashboard.pdb.enabled }}
apiVersion: {{ include "argo-rollouts.podDisruptionBudget.apiVersion" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-rollouts.fullname" . }}-dashboard
labels:
{{- include "argo-rollouts.labels" . | nindent 4 }}
{{- with .Values.dashboard.pdb.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.dashboard.pdb.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.dashboard.pdb.minAvailable }}
minAvailable: {{ .Values.dashboard.pdb.minAvailable }}
{{- else if .Values.dashboard.pdb.maxUnavailable }}
maxUnavailable: {{ .Values.dashboard.pdb.maxUnavailable }}
{{- else }}
minAvailable: 0
{{- end }}
selector:
matchLabels:
{{- include "argo-rollouts.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: {{ .Values.dashboard.component }}
{{- end }}

View File

@ -97,6 +97,19 @@ controller:
successThreshold: 1
timeoutSeconds: 4
## Configure Pod Disruption Budget for the controller
pdb:
# -- Labels to be added to controller [Pod Disruption Budget]
labels: {}
# -- Annotations to be added to controller [Pod Disruption Budget]
annotations: {}
# -- Deploy a [Pod Disruption Budget] for the controller
enabled: false
# -- Minimum number / percentage of pods that should remain scheduled
minAvailable: # 1
# -- Maximum number / percentage of pods that may be made unavailable
maxUnavailable: # 0
serviceAccount:
# -- Specifies whether a service account should be created
create: true
@ -198,6 +211,19 @@ dashboard:
# If not set and create is true, a name is generated using the fullname template
name: ""
## Configure Pod Disruption Budget for the dashboard
pdb:
# -- Labels to be added to dashboard [Pod Disruption Budget]
labels: {}
# -- Annotations to be added to dashboard [Pod Disruption Budget]
annotations: {}
# -- Deploy a [Pod Disruption Budget] for the dashboard
enabled: false
# -- Minimum number / percentage of pods that should remain scheduled
minAvailable: # 1
# -- Maximum number / percentage of pods that may be made unavailable
maxUnavailable: # 0
## Ingress configuration.
## ref: https://kubernetes.io/docs/user-guide/ingress/
##