From f1995d697e765b03a6b9f37e9a9faadb50010b14 Mon Sep 17 00:00:00 2001 From: mugi-o <62197019+mugioka@users.noreply.github.com> Date: Tue, 1 Feb 2022 00:36:49 +0900 Subject: [PATCH] feat(argo-cd): add poddisruptionbudget template. (#1110) Signed-off-by: mugioka --- charts/argo-cd/Chart.yaml | 4 +- charts/argo-cd/README.md | 15 +++++ .../poddisruptionbudget.yaml | 26 +++++++++ .../poddisruptionbudget.yaml | 26 +++++++++ .../argocd-server/poddisruptionbudget.yaml | 26 +++++++++ .../templates/dex/poddisruptionbudget.yaml | 26 +++++++++ .../templates/redis/poddisruptionbudget.yaml | 26 +++++++++ charts/argo-cd/values.yaml | 55 +++++++++++++++++++ 8 files changed, 202 insertions(+), 2 deletions(-) create mode 100644 charts/argo-cd/templates/argocd-application-controller/poddisruptionbudget.yaml create mode 100644 charts/argo-cd/templates/argocd-repo-server/poddisruptionbudget.yaml create mode 100644 charts/argo-cd/templates/argocd-server/poddisruptionbudget.yaml create mode 100644 charts/argo-cd/templates/dex/poddisruptionbudget.yaml create mode 100644 charts/argo-cd/templates/redis/poddisruptionbudget.yaml diff --git a/charts/argo-cd/Chart.yaml b/charts/argo-cd/Chart.yaml index 3f125b49..dac4747e 100644 --- a/charts/argo-cd/Chart.yaml +++ b/charts/argo-cd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: v2.2.3 description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes. name: argo-cd -version: 3.32.1 +version: 3.33.0 home: https://github.com/argoproj/argo-helm icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png keywords: @@ -21,4 +21,4 @@ dependencies: condition: redis-ha.enabled annotations: artifacthub.io/changes: | - - "[Fixed]: Add custom volume as Helm working dir (sync with upstream manifests)" + - "[Added]: PodDisruptionBudget template" diff --git a/charts/argo-cd/README.md b/charts/argo-cd/README.md index baa8ec44..d4550826 100644 --- a/charts/argo-cd/README.md +++ b/charts/argo-cd/README.md @@ -279,6 +279,9 @@ NAME: my-release | controller.metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector | | controller.name | string | `"application-controller"` | Application controller name string | | controller.nodeSelector | object | `{}` | [Node selector] | +| controller.pdb.annotations | object | `{}` | Annotations to be added to application controller pdb | +| controller.pdb.enabled | bool | `false` | Deploy a Poddisruptionbudget for the application controller | +| controller.pdb.labels | object | `{}` | Labels to be added to application controller pdb | | controller.podAnnotations | object | `{}` | Annotations to be added to application controller pods | | controller.podLabels | object | `{}` | Labels to be added to application controller pods | | controller.priorityClassName | string | `""` | Priority class for the application controller pods | @@ -346,6 +349,9 @@ NAME: my-release | repoServer.metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector | | repoServer.name | string | `"repo-server"` | Repo server name | | repoServer.nodeSelector | object | `{}` | [Node selector] | +| repoServer.pdb.annotations | object | `{}` | Annotations to be added to Repo server pdb | +| repoServer.pdb.enabled | bool | `false` | Deploy a Poddisruptionbudget for the Repo server | +| repoServer.pdb.labels | object | `{}` | Labels to be added to Repo server pdb | | repoServer.podAnnotations | object | `{}` | Annotations to be added to repo server pods | | repoServer.podLabels | object | `{}` | Labels to be added to repo server pods | | repoServer.priorityClassName | string | `""` | Priority class for the repo server | @@ -456,6 +462,9 @@ NAME: my-release | server.metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector | | server.name | string | `"server"` | Argo CD server name | | server.nodeSelector | object | `{}` | [Node selector] | +| server.pdb.annotations | object | `{}` | Annotations to be added to server pdb | +| server.pdb.enabled | bool | `false` | Deploy a Poddisruptionbudget for the server | +| server.pdb.labels | object | `{}` | Labels to be added to server pdb | | server.podAnnotations | object | `{}` | Annotations to be added to server pods | | server.podLabels | object | `{}` | Labels to be added to server pods | | server.priorityClassName | string | `""` | Priority class for the Argo CD server | @@ -539,6 +548,9 @@ NAME: my-release | dex.metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector | | dex.name | string | `"dex-server"` | Dex name | | dex.nodeSelector | object | `{}` | [Node selector] | +| dex.pdb.annotations | object | `{}` | Annotations to be added to Dex server pdb | +| dex.pdb.enabled | bool | `false` | Deploy a Poddisruptionbudget for the Dex server | +| dex.pdb.labels | object | `{}` | Labels to be added to Dex server pdb | | dex.podAnnotations | object | `{}` | Annotations to be added to the Dex server pods | | dex.podLabels | object | `{}` | Labels to be added to the Dex server pods | | dex.priorityClassName | string | `""` | Priority class for dex | @@ -600,6 +612,9 @@ NAME: my-release | redis.metrics.serviceMonitor.selector | object | `{}` | Prometheus ServiceMonitor selector | | redis.name | string | `"redis"` | Redis name | | redis.nodeSelector | object | `{}` | [Node selector] | +| redis.pdb.annotations | object | `{}` | Annotations to be added to Redis server pdb | +| redis.pdb.enabled | bool | `false` | Deploy a Poddisruptionbudget for the Redis server | +| redis.pdb.labels | object | `{}` | Labels to be added to Redis server pdb | | redis.podAnnotations | object | `{}` | Annotations to be added to the Redis server pods | | redis.podLabels | object | `{}` | Labels to be added to the Redis server pods | | redis.priorityClassName | string | `""` | Priority class for redis | diff --git a/charts/argo-cd/templates/argocd-application-controller/poddisruptionbudget.yaml b/charts/argo-cd/templates/argocd-application-controller/poddisruptionbudget.yaml new file mode 100644 index 00000000..f27e1d74 --- /dev/null +++ b/charts/argo-cd/templates/argocd-application-controller/poddisruptionbudget.yaml @@ -0,0 +1,26 @@ +{{- if .Values.controller.pdb.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "argo-cd.controller.fullname" . }} + labels: + {{- include "argo-cd.labels" (dict "context" . "component" .Values.controller.name "name" .Values.controller.name) | 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-cd.selectorLabels" (dict "context" . "name" .Values.controller.name) | nindent 6 }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-repo-server/poddisruptionbudget.yaml b/charts/argo-cd/templates/argocd-repo-server/poddisruptionbudget.yaml new file mode 100644 index 00000000..c388c263 --- /dev/null +++ b/charts/argo-cd/templates/argocd-repo-server/poddisruptionbudget.yaml @@ -0,0 +1,26 @@ +{{- if .Values.repoServer.pdb.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "argo-cd.repoServer.fullname" . }} + labels: + {{- include "argo-cd.labels" (dict "context" . "component" .Values.repoServer.name "name" .Values.repoServer.name) | nindent 4 }} + {{- with .Values.repoServer.pdb.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.repoServer.pdb.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.repoServer.pdb.minAvailable }} + minAvailable: {{ .Values.repoServer.pdb.minAvailable }} + {{- else if .Values.repoServer.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.repoServer.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.repoServer.name) | nindent 6 }} +{{- end }} diff --git a/charts/argo-cd/templates/argocd-server/poddisruptionbudget.yaml b/charts/argo-cd/templates/argocd-server/poddisruptionbudget.yaml new file mode 100644 index 00000000..2342a1c6 --- /dev/null +++ b/charts/argo-cd/templates/argocd-server/poddisruptionbudget.yaml @@ -0,0 +1,26 @@ +{{- if .Values.server.pdb.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "argo-cd.server.fullname" . }} + labels: + {{- include "argo-cd.labels" (dict "context" . "component" .Values.server.name "name" .Values.server.name) | nindent 4 }} + {{- with .Values.server.pdb.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.server.pdb.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.server.pdb.minAvailable }} + minAvailable: {{ .Values.server.pdb.minAvailable }} + {{- else if .Values.server.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.server.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.server.name) | nindent 6 }} +{{- end }} diff --git a/charts/argo-cd/templates/dex/poddisruptionbudget.yaml b/charts/argo-cd/templates/dex/poddisruptionbudget.yaml new file mode 100644 index 00000000..93d952fe --- /dev/null +++ b/charts/argo-cd/templates/dex/poddisruptionbudget.yaml @@ -0,0 +1,26 @@ +{{- if .Values.dex.pdb.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "argo-cd.dex.fullname" . }} + labels: + {{- include "argo-cd.labels" (dict "context" . "component" .Values.dex.name "name" .Values.dex.name) | nindent 4 }} + {{- with .Values.dex.pdb.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.dex.pdb.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.dex.pdb.minAvailable }} + minAvailable: {{ .Values.dex.pdb.minAvailable }} + {{- else if .Values.dex.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.dex.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + {{- include "argo-cd.selectorLabels" (dict "context" . "name" .Values.dex.name) | nindent 6 }} +{{- end }} diff --git a/charts/argo-cd/templates/redis/poddisruptionbudget.yaml b/charts/argo-cd/templates/redis/poddisruptionbudget.yaml new file mode 100644 index 00000000..0f19bb9f --- /dev/null +++ b/charts/argo-cd/templates/redis/poddisruptionbudget.yaml @@ -0,0 +1,26 @@ +{{- if .Values.redis.pdb.enabled }} +apiVersion: policy/v1beta1 +kind: PodDisruptionBudget +metadata: + name: {{ template "argo-cd.redis.fullname" . }} + labels: + {{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }} + {{- with .Values.redis.pdb.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.redis.pdb.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if .Values.redis.pdb.minAvailable }} + minAvailable: {{ .Values.redis.pdb.minAvailable }} + {{- else if .Values.redis.pdb.maxUnavailable }} + maxUnavailable: {{ .Values.redis.pdb.maxUnavailable }} + {{- else }} + minAvailable: 0 + {{- end }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "argo-cd.name" . }}-{{ .Values.redis.name }} +{{- end }} diff --git a/charts/argo-cd/values.yaml b/charts/argo-cd/values.yaml index ece90bc5..015ed592 100755 --- a/charts/argo-cd/values.yaml +++ b/charts/argo-cd/values.yaml @@ -345,6 +345,17 @@ controller: # name: custom-tools # subPath: helm + pdb: + # -- Labels to be added to application controller pdb + labels: {} + # -- Annotations to be added to application controller pdb + annotations: {} + + # -- Deploy a Poddisruptionbudget for the application controller + enabled: false + # minAvailable: 1 + # maxUnavailable: 0 + ## Dex dex: # -- Enable dex @@ -539,6 +550,17 @@ dex: # name: custom-tools # subPath: helm + pdb: + # -- Labels to be added to Dex server pdb + labels: {} + # -- Annotations to be added to Dex server pdb + annotations: {} + + # -- Deploy a Poddisruptionbudget for the Dex server + enabled: false + # minAvailable: 1 + # maxUnavailable: 0 + ## Redis redis: # -- Enable redis @@ -712,6 +734,17 @@ redis: # -- Prometheus ServiceMonitor labels additionalLabels: {} + pdb: + # -- Labels to be added to Redis server pdb + labels: {} + # -- Annotations to be added to Redis server pdb + annotations: {} + + # -- Deploy a Poddisruptionbudget for the Redis server + enabled: false + # minAvailable: 1 + # maxUnavailable: 0 + # This key configures Redis-HA subchart and when enabled (redis-ha.enabled=true) # the custom redis deployment is omitted # Check the redis-ha chart for more properties @@ -1352,6 +1385,17 @@ server: # - name: argo-rollouts # url: https://github.com/argoproj-labs/rollout-extension/releases/download/v0.1.0/extension.tar + pdb: + # -- Labels to be added to server pdb + labels: {} + # -- Annotations to be added to server pdb + annotations: {} + + # -- Deploy a Poddisruptionbudget for the server + enabled: false + # minAvailable: 1 + # maxUnavailable: 0 + ## Repo Server repoServer: # -- Repo server name @@ -1590,6 +1634,17 @@ repoServer: # name: custom-tools # subPath: helm + pdb: + # -- Labels to be added to Repo server pdb + labels: {} + # -- Annotations to be added to Repo server pdb + annotations: {} + + # -- Deploy a Poddisruptionbudget for the Repo server + enabled: false + # minAvailable: 1 + # maxUnavailable: 0 + ## Argo Configs configs: # -- Provide one or multiple [external cluster credentials]