feat(argo-cd): Add support for topologySpreadConstraints (#917)

* feat(argo-cd): Add support for topologySpreadConstraints

Signed-off-by: Sander van Schie <sandervanschie@gmail.com>

* Apply suggestions from code review

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

Co-authored-by: Marco Kilchhofer <mkilchhofer@users.noreply.github.com>
This commit is contained in:
Sander van Schie 2021-09-17 15:57:26 +02:00 committed by GitHub
parent 91aaaf066f
commit 804cd4ec54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 102 additions and 2 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 2.1.2 appVersion: 2.1.2
description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes. description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd name: argo-cd
version: 3.18.0 version: 3.19.0
home: https://github.com/argoproj/argo-helm home: https://github.com/argoproj/argo-helm
icon: https://argoproj.github.io/argo-cd/assets/logo.png icon: https://argoproj.github.io/argo-cd/assets/logo.png
keywords: keywords:
@ -21,4 +21,4 @@ dependencies:
condition: redis-ha.enabled condition: redis-ha.enabled
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- "[Added]: extraContainers values were added to pods besides server" - "[Added]: Add support for topologySpreadConstraints"

View file

@ -181,6 +181,7 @@ NAME: my-release
| Parameter | Description | Default | | Parameter | Description | Default |
|-----|---------|-------------| |-----|---------|-------------|
| controller.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` | | controller.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` |
| controller.topologySpreadConstraints | [Assign custom topologySpreadConstraints rules to the deployment](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | `[]` |
| controller.args.operationProcessors | define the controller `--operation-processors` | `"10"` | | controller.args.operationProcessors | define the controller `--operation-processors` | `"10"` |
| controller.args.appResyncPeriod | define the controller `--app-resync` | `"180"` | | controller.args.appResyncPeriod | define the controller `--app-resync` | `"180"` |
| controller.args.selfHealTimeout | define the controller `--self-heal-timeout-seconds` | `"5"` | | controller.args.selfHealTimeout | define the controller `--self-heal-timeout-seconds` | `"5"` |
@ -237,6 +238,7 @@ NAME: my-release
| Property | Description | Default | | Property | Description | Default |
|-----|---------|-------------| |-----|---------|-------------|
| repoServer.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` | | repoServer.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` |
| repoServer.topologySpreadConstraints | [Assign custom topologySpreadConstraints rules to the deployment](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | `[]` |
| repoServer.autoscaling.enabled | Enable Horizontal Pod Autoscaler ([HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)) for the repo server | `false` | | repoServer.autoscaling.enabled | Enable Horizontal Pod Autoscaler ([HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)) for the repo server | `false` |
| repoServer.autoscaling.minReplicas | Minimum number of replicas for the repo server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `1` | | repoServer.autoscaling.minReplicas | Minimum number of replicas for the repo server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `1` |
| repoServer.autoscaling.maxReplicas | Maximum number of replicas for the repo server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `5` | | repoServer.autoscaling.maxReplicas | Maximum number of replicas for the repo server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `5` |
@ -292,6 +294,7 @@ NAME: my-release
| Parameter | Description | Default | | Parameter | Description | Default |
|-----|---------|-------------| |-----|---------|-------------|
| server.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` | | server.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` |
| server.topologySpreadConstraints | [Assign custom topologySpreadConstraints rules to the deployment](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | `[]` |
| server.autoscaling.enabled | Enable Horizontal Pod Autoscaler ([HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)) for the server | `false` | | server.autoscaling.enabled | Enable Horizontal Pod Autoscaler ([HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/)) for the server | `false` |
| server.autoscaling.minReplicas | Minimum number of replicas for the server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `1` | | server.autoscaling.minReplicas | Minimum number of replicas for the server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `1` |
| server.autoscaling.maxReplicas | Maximum number of replicas for the server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `5` | | server.autoscaling.maxReplicas | Maximum number of replicas for the server [HPA](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/) | `5` |
@ -387,6 +390,7 @@ NAME: my-release
| Property | Description | Default | | Property | Description | Default |
|-----|---------|-------------| |-----|---------|-------------|
| dex.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` | | dex.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` |
| dex.topologySpreadConstraints | [Assign custom topologySpreadConstraints rules to the deployment](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | `[]` |
| dex.containerPortGrpc | GRPC container port | `5557` | | dex.containerPortGrpc | GRPC container port | `5557` |
| dex.containerPortHttp | HTTP container port | `5556` | | dex.containerPortHttp | HTTP container port | `5556` |
| dex.enabled | Enable dex | `true` | | dex.enabled | Enable dex | `true` |
@ -446,6 +450,7 @@ through `xxx.extraArgs`
| Parameter | Description | Default | | Parameter | Description | Default |
|-----|---------|-------------| |-----|---------|-------------|
| redis.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` | | redis.affinity | [Assign custom affinity rules to the deployment](https://kubernetes.io/docs/concepts/configuration/assign-pod-node/) | `{}` |
| redis.topologySpreadConstraints | [Assign custom topologySpreadConstraints rules to the deployment](https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/) | `[]` |
| redis.containerPort | Redis container port | `6379` | | redis.containerPort | Redis container port | `6379` |
| redis.enabled | Enable redis | `true` | | redis.enabled | Enable redis | `true` |
| redis.image.imagePullPolicy | Redis imagePullPolicy | `"IfNotPresent"` | | redis.image.imagePullPolicy | Redis imagePullPolicy | `"IfNotPresent"` |

View file

@ -120,6 +120,17 @@ spec:
{{- if .Values.controller.affinity }} {{- if .Values.controller.affinity }}
affinity: affinity:
{{- toYaml .Values.controller.affinity | nindent 8 }} {{- toYaml .Values.controller.affinity | nindent 8 }}
{{- end }}
{{- with .Values.controller.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.controller.name) | nindent 12 }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
serviceAccountName: {{ template "argo-cd.controllerServiceAccountName" . }} serviceAccountName: {{ template "argo-cd.controllerServiceAccountName" . }}
{{- with .Values.global.hostAliases }} {{- with .Values.global.hostAliases }}

View file

@ -128,6 +128,17 @@ spec:
{{- if .Values.repoServer.affinity }} {{- if .Values.repoServer.affinity }}
affinity: affinity:
{{- toYaml .Values.repoServer.affinity | nindent 8 }} {{- toYaml .Values.repoServer.affinity | nindent 8 }}
{{- end }}
{{- with .Values.repoServer.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.repoServer.name) | nindent 12 }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
serviceAccountName: {{ template "argo-cd.repoServerServiceAccountName" . }} serviceAccountName: {{ template "argo-cd.repoServerServiceAccountName" . }}
{{- with .Values.global.hostAliases }} {{- with .Values.global.hostAliases }}

View file

@ -139,6 +139,17 @@ spec:
{{- if .Values.server.affinity }} {{- if .Values.server.affinity }}
affinity: affinity:
{{- toYaml .Values.server.affinity | nindent 8 }} {{- toYaml .Values.server.affinity | nindent 8 }}
{{- end }}
{{- with .Values.server.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.server.name) | nindent 12 }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
serviceAccountName: {{ template "argo-cd.serverServiceAccountName" . }} serviceAccountName: {{ template "argo-cd.serverServiceAccountName" . }}
{{- with .Values.global.hostAliases }} {{- with .Values.global.hostAliases }}

View file

@ -114,6 +114,17 @@ spec:
{{- if .Values.dex.affinity }} {{- if .Values.dex.affinity }}
affinity: affinity:
{{- toYaml .Values.dex.affinity | nindent 8 }} {{- toYaml .Values.dex.affinity | nindent 8 }}
{{- end }}
{{- with .Values.dex.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
{{- include "argo-cd.selectorLabels" (dict "context" $ "name" $.Values.dex.name) | nindent 12 }}
{{- end }}
{{- end }}
{{- end }} {{- end }}
serviceAccountName: {{ template "argo-cd.dexServiceAccountName" . }} serviceAccountName: {{ template "argo-cd.dexServiceAccountName" . }}
volumes: volumes:

View file

@ -79,6 +79,17 @@ spec:
affinity: affinity:
{{- toYaml .Values.redis.affinity | nindent 8 }} {{- toYaml .Values.redis.affinity | nindent 8 }}
{{- end }} {{- end }}
{{- with .Values.redis.topologySpreadConstraints }}
topologySpreadConstraints:
{{- range $constraint := . }}
- {{ toYaml $constraint | nindent 8 | trim }}
{{- if not $constraint.labelSelector }}
labelSelector:
matchLabels:
app.kubernetes.io/name: {{ include "argo-cd.name" $ }}-{{ $.Values.redis.name }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.redis.volumes }} {{- if .Values.redis.volumes }}
volumes: volumes:
{{- toYaml .Values.redis.volumes | nindent 8}} {{- toYaml .Values.redis.volumes | nindent 8}}

View file

@ -143,6 +143,14 @@ controller:
tolerations: [] tolerations: []
affinity: {} affinity: {}
# Pod Topology Spread Constraints
# Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
# If labelSelector is left out, it will default to the labelSelector configuration of the deployment
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
priorityClassName: "" priorityClassName: ""
resources: {} resources: {}
@ -323,6 +331,14 @@ dex:
tolerations: [] tolerations: []
affinity: {} affinity: {}
# Pod Topology Spread Constraints
# Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
# If labelSelector is left out, it will default to the labelSelector configuration of the deployment
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
priorityClassName: "" priorityClassName: ""
## Labels to set container specific security contexts ## Labels to set container specific security contexts
@ -390,6 +406,14 @@ redis:
tolerations: [] tolerations: []
affinity: {} affinity: {}
# Pod Topology Spread Constraints
# Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
# If labelSelector is left out, it will default to the labelSelector configuration of the deployment
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
priorityClassName: "" priorityClassName: ""
## Labels to set container specific security contexts ## Labels to set container specific security contexts
@ -535,6 +559,14 @@ server:
tolerations: [] tolerations: []
affinity: {} affinity: {}
# Pod Topology Spread Constraints
# Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
# If labelSelector is left out, it will default to the labelSelector configuration of the deployment
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
priorityClassName: "" priorityClassName: ""
## Labels to set container specific security contexts ## Labels to set container specific security contexts
@ -948,6 +980,14 @@ repoServer:
tolerations: [] tolerations: []
affinity: {} affinity: {}
# Pod Topology Spread Constraints
# Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
# If labelSelector is left out, it will default to the labelSelector configuration of the deployment
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: topology.kubernetes.io/zone
# whenUnsatisfiable: DoNotSchedule
priorityClassName: "" priorityClassName: ""
## Labels to set container specific security contexts ## Labels to set container specific security contexts