diff --git a/charts/argo-rollouts/Chart.yaml b/charts/argo-rollouts/Chart.yaml index 83e75ad3..97cf311b 100644 --- a/charts/argo-rollouts/Chart.yaml +++ b/charts/argo-rollouts/Chart.yaml @@ -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" diff --git a/charts/argo-rollouts/README.md b/charts/argo-rollouts/README.md index 47386dad..a39ed1e4 100644 --- a/charts/argo-rollouts/README.md +++ b/charts/argo-rollouts/README.md @@ -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 diff --git a/charts/argo-rollouts/README.md.gotmpl b/charts/argo-rollouts/README.md.gotmpl index 37305b9e..6682d168 100644 --- a/charts/argo-rollouts/README.md.gotmpl +++ b/charts/argo-rollouts/README.md.gotmpl @@ -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 diff --git a/charts/argo-rollouts/templates/_helpers.tpl b/charts/argo-rollouts/templates/_helpers.tpl index 025b709e..94733603 100644 --- a/charts/argo-rollouts/templates/_helpers.tpl +++ b/charts/argo-rollouts/templates/_helpers.tpl @@ -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 -}} diff --git a/charts/argo-rollouts/templates/controller/poddisruptionbudget.yaml b/charts/argo-rollouts/templates/controller/poddisruptionbudget.yaml new file mode 100644 index 00000000..437efab9 --- /dev/null +++ b/charts/argo-rollouts/templates/controller/poddisruptionbudget.yaml @@ -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 }} diff --git a/charts/argo-rollouts/templates/dashboard/poddisruptionbudget.yaml b/charts/argo-rollouts/templates/dashboard/poddisruptionbudget.yaml new file mode 100644 index 00000000..742b149f --- /dev/null +++ b/charts/argo-rollouts/templates/dashboard/poddisruptionbudget.yaml @@ -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 }} diff --git a/charts/argo-rollouts/values.yaml b/charts/argo-rollouts/values.yaml index c9ec9a99..46a64593 100644 --- a/charts/argo-rollouts/values.yaml +++ b/charts/argo-rollouts/values.yaml @@ -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/ ##