feat(argo-cd): Add API version overrides for PDB and GKE (#1524)

Signed-off-by: Petr Drastil <petr.drastil@gmail.com>
main argo-cd-5.5.20
Petr Drastil 2022-10-11 15:52:31 +02:00 committed by GitHub
parent bbecd7445d
commit 6b523e3b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 130 additions and 91 deletions

View File

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: v2.4.14
description: A Helm chart for Argo CD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 5.5.19
version: 5.5.20
home: https://github.com/argoproj/argo-helm
icon: https://argo-cd.readthedocs.io/en/stable/assets/logo.png
sources:
@ -22,4 +22,5 @@ dependencies:
condition: redis-ha.enabled
annotations:
artifacthub.io/changes: |
- "[Changed]: Moved specific cloud provider resources to sub-folders"
- "[Added]: API version override for PDB and Google Cloud."
- "[Changed]: Moved all API versions in dedicated helper."

View File

@ -101,6 +101,11 @@ kubectl apply -k "https://github.com/argoproj/argo-cd/manifests/crds?ref=<appVer
kubectl apply -k "https://github.com/argoproj/argo-cd/manifests/crds?ref=v2.4.9"
```
### 5.5.20
This version moved API version templates into dedicated helper. If you are using these in your umbrella
chart please migrate your templates to pattern `argo-cd.apiVersion.<component>`.
### 5.5.0
This version introduces new `configs.params` section that replaces command line arguments for containers.
@ -329,7 +334,9 @@ NAME: my-release
|-----|------|---------|-------------|
| apiVersionOverrides.autoscaling | string | `""` | String to override apiVersion of autoscaling rendered by this helm chart |
| apiVersionOverrides.certmanager | string | `""` | String to override apiVersion of certmanager resources rendered by this helm chart |
| apiVersionOverrides.cloudgoogle | string | `""` | String to override apiVersion of GKE resources rendered by this helm chart |
| apiVersionOverrides.ingress | string | `""` | String to override apiVersion of ingresses rendered by this helm chart |
| apiVersionOverrides.pdb | string | `""` | String to override apiVersion of pod disruption budgets rendered by this helm chart |
| crds.annotations | object | `{}` | Annotations to be added to all CRDs |
| crds.install | bool | `true` | Install and upgrade CRDs |
| crds.keep | bool | `true` | Keep CRDs on chart uninstall |

View File

@ -100,6 +100,11 @@ kubectl apply -k "https://github.com/argoproj/argo-cd/manifests/crds?ref=<appVer
kubectl apply -k "https://github.com/argoproj/argo-cd/manifests/crds?ref=v2.4.9"
```
### 5.5.20
This version moved API version templates into dedicated helper. If you are using these in your umbrella
chart please migrate your templates to pattern `argo-cd.apiVersion.<component>`.
### 5.5.0
This version introduces new `configs.params` section that replaces command line arguments for containers.

View File

@ -216,41 +216,6 @@ app.kubernetes.io/component: {{ .component }}
{{- end }}
{{- end }}
{{/*
Return the appropriate apiVersion for ingress
*/}}
{{- define "argo-cd.ingress.apiVersion" -}}
{{- if .Values.apiVersionOverrides.ingress -}}
{{- print .Values.apiVersionOverrides.ingress -}}
{{- else if semverCompare "<1.14-0" (include "argo-cd.kubeVersion" $) -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" (include "argo-cd.kubeVersion" $) -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for autoscaling
*/}}
{{- define "argo-cd.autoscaling.apiVersion" -}}
{{- if .Values.apiVersionOverrides.autoscaling -}}
{{- print .Values.apiVersionOverrides.autoscaling -}}
{{- else if semverCompare "<1.23-0" (include "argo-cd.kubeVersion" $) -}}
{{- print "autoscaling/v2beta1" -}}
{{- else -}}
{{- print "autoscaling/v2" -}}
{{- end -}}
{{- end -}}
{{/*
Return the target Kubernetes version
*/}}
{{- define "argo-cd.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
{{- end -}}
{{/*
Argo Configuration Preset Values (Incluenced by Values configuration)
*/}}
@ -303,14 +268,3 @@ Return the default Argo CD app version
{{- define "argo-cd.defaultTag" -}}
{{- default .Chart.AppVersion .Values.global.image.tag }}
{{- end -}}
{{/*
Return the appropriate apiVersion for pod disruption budget
*/}}
{{- define "argo-cd.podDisruptionBudget.apiVersion" -}}
{{- if semverCompare "<1.21-0" (include "argo-cd.kubeVersion" $) -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,78 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Return the target Kubernetes version
*/}}
{{- define "argo-cd.kubeVersion" -}}
{{- default .Capabilities.KubeVersion.Version .Values.kubeVersionOverride }}
{{- end }}
{{/*
Return the appropriate apiVersion for autoscaling
*/}}
{{- define "argo-cd.apiVersion.autoscaling" -}}
{{- if .Values.apiVersionOverrides.autoscaling -}}
{{- print .Values.apiVersionOverrides.autoscaling -}}
{{- else if semverCompare "<1.23-0" (include "argo-cd.kubeVersion" .) -}}
{{- print "autoscaling/v2beta1" -}}
{{- else -}}
{{- print "autoscaling/v2" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for ingress
*/}}
{{- define "argo-cd.apiVersion.ingress" -}}
{{- if .Values.apiVersionOverrides.ingress -}}
{{- print .Values.apiVersionOverrides.ingress -}}
{{- else if semverCompare "<1.14-0" (include "argo-cd.kubeVersion" .) -}}
{{- print "extensions/v1beta1" -}}
{{- else if semverCompare "<1.19-0" (include "argo-cd.kubeVersion" .) -}}
{{- print "networking.k8s.io/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for pod disruption budget
*/}}
{{- define "argo-cd.apiVersion.pdb" -}}
{{- if .Values.apiVersionOverrides.pdb -}}
{{- print .Values.apiVersionOverrides.pdb -}}
{{- else if semverCompare "<1.21-0" (include "argo-cd.kubeVersion" .) -}}
{{- print "policy/v1beta1" -}}
{{- else -}}
{{- print "policy/v1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for cert-manager
*/}}
{{- define "argo-cd.apiVersion.cert-manager" -}}
{{- if .Values.apiVersionOverrides.certmanager -}}
{{- print .Values.apiVersionOverrides.certmanager -}}
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1" -}}
{{- print "cert-manager.io/v1" -}}
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1alpha3" -}}
{{- print "cert-manager.io/v1alpha3" -}}
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1alpha2" -}}
{{- print "cert-manager.io/v1alpha2" -}}
{{- else -}}
{{- print "certmanager.k8s.io/v1alpha1" -}}
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for GKE resources
*/}}
{{- define "argo-cd.apiVersions.cloudgoogle" -}}
{{- if .Values.apiVersionOverrides.cloudgoogle -}}
{{- print .Values.apiVersionOverrides.cloudgoogle -}}
{{- else if .Capabilities.APIVersions.Has "cloud.google.com/v1" -}}
{{- print "cloud.google.com/v1" -}}
{{- else -}}
{{- print "cloud.google.com/v1beta1" -}}
{{- end -}}
{{- end -}}

View File

@ -1,5 +1,5 @@
{{- if .Values.controller.pdb.enabled }}
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.controller.fullname" . }}

View File

@ -4,7 +4,7 @@
{{- $paths := .Values.applicationSet.webhook.ingress.paths -}}
{{- $extraPaths := .Values.applicationSet.webhook.ingress.extraPaths -}}
{{- $pathType := .Values.applicationSet.webhook.ingress.pathType -}}
apiVersion: {{ include "argo-cd.ingress.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.ingress" . }}
kind: Ingress
metadata:
{{- if .Values.applicationSet.webhook.ingress.annotations }}
@ -20,7 +20,7 @@ metadata:
{{- toYaml .Values.applicationSet.webhook.ingress.labels | nindent 4 }}
{{- end }}
spec:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
{{- with .Values.applicationSet.webhook.ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
@ -36,11 +36,11 @@ spec:
{{- end }}
{{- range $p := $paths }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
service:
name: {{ $serviceName }}
port:
@ -63,11 +63,11 @@ spec:
{{- end }}
{{- range $p := $paths }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
service:
name: {{ $serviceName }}
port:

View File

@ -1,5 +1,5 @@
{{- if .Values.repoServer.autoscaling.enabled }}
apiVersion: {{ include "argo-cd.autoscaling.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.autoscaling" . }}
kind: HorizontalPodAutoscaler
metadata:
labels:
@ -17,7 +17,7 @@ spec:
- type: Resource
resource:
name: memory
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
{{- if eq (include "argo-cd.apiVersion.autoscaling" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
@ -29,7 +29,7 @@ spec:
- type: Resource
resource:
name: cpu
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
{{- if eq (include "argo-cd.apiVersion.autoscaling" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:

View File

@ -1,5 +1,5 @@
{{- if .Values.repoServer.pdb.enabled }}
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.repoServer.fullname" . }}

View File

@ -1,15 +1,5 @@
{{- if .Values.server.certificate.enabled -}}
{{- if .Values.apiVersionOverrides.certmanager -}}
apiVersion: {{ .Values.apiVersionOverrides.certmanager }}
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1" }}
apiVersion: cert-manager.io/v1
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1alpha3" }}
apiVersion: cert-manager.io/v1alpha3
{{- else if .Capabilities.APIVersions.Has "cert-manager.io/v1alpha2" }}
apiVersion: cert-manager.io/v1alpha2
{{- else }}
apiVersion: certmanager.k8s.io/v1alpha1
{{- end }}
apiVersion: {{ include "argo-cd.apiVersion.cert-manager" . }}
kind: Certificate
metadata:
name: {{ template "argo-cd.server.fullname" . }}

View File

@ -1,5 +1,5 @@
{{- if .Values.server.GKEbackendConfig.enabled }}
apiVersion: cloud.google.com/v1beta1
apiVersion: {{ include "argo-cd.apiVersions.cloudgoogle" . }}
kind: BackendConfig
metadata:
name: {{ template "argo-cd.server.fullname" . }}

View File

@ -1,5 +1,5 @@
{{- if .Values.server.autoscaling.enabled }}
apiVersion: {{ include "argo-cd.autoscaling.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.autoscaling" . }}
kind: HorizontalPodAutoscaler
metadata:
labels:
@ -17,7 +17,7 @@ spec:
- type: Resource
resource:
name: memory
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
{{- if eq (include "argo-cd.apiVersion.autoscaling" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:
@ -29,7 +29,7 @@ spec:
- type: Resource
resource:
name: cpu
{{- if eq (include "argo-cd.autoscaling.apiVersion" $) "autoscaling/v2beta1" }}
{{- if eq (include "argo-cd.apiVersion.autoscaling" $) "autoscaling/v2beta1" }}
targetAverageUtilization: {{ . }}
{{- else }}
target:

View File

@ -4,7 +4,7 @@
{{- $paths := .Values.server.ingressGrpc.paths -}}
{{- $extraPaths := .Values.server.ingressGrpc.extraPaths -}}
{{- $pathType := .Values.server.ingressGrpc.pathType -}}
apiVersion: {{ include "argo-cd.ingress.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.ingress" . }}
kind: Ingress
metadata:
{{- if .Values.server.ingressGrpc.annotations }}
@ -20,7 +20,7 @@ metadata:
{{- toYaml .Values.server.ingressGrpc.labels | nindent 4 }}
{{- end }}
spec:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
{{- with .Values.server.ingressGrpc.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
@ -63,11 +63,11 @@ spec:
{{- end -}}
{{- range $p := $paths }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
service:
name: {{ $serviceName }}
port:

View File

@ -4,7 +4,7 @@
{{- $paths := .Values.server.ingress.paths -}}
{{- $extraPaths := .Values.server.ingress.extraPaths -}}
{{- $pathType := .Values.server.ingress.pathType -}}
apiVersion: {{ include "argo-cd.ingress.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.ingress" . }}
kind: Ingress
metadata:
{{- if .Values.server.ingress.annotations }}
@ -24,7 +24,7 @@ metadata:
{{- toYaml .Values.server.ingress.labels | nindent 4 }}
{{- end }}
spec:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
{{- with .Values.server.ingress.ingressClassName }}
ingressClassName: {{ . }}
{{- end }}
@ -41,11 +41,11 @@ spec:
{{- range $p := $paths }}
{{- if and $.Values.server.ingressGrpc.isAWSALB $.Values.server.ingressGrpc.enabled }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
pathType: Prefix
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
service:
name: {{ template "argo-cd.server.fullname" $ }}-grpc
port:
@ -60,11 +60,11 @@ spec:
{{- end }}
{{- end }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
service:
name: {{ $serviceName }}
port:
@ -87,11 +87,11 @@ spec:
{{- end }}
{{- range $p := $paths }}
- path: {{ $p }}
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
pathType: {{ $pathType }}
{{- end }}
backend:
{{- if eq (include "argo-cd.ingress.apiVersion" $) "networking.k8s.io/v1" }}
{{- if eq (include "argo-cd.apiVersion.ingress" $) "networking.k8s.io/v1" }}
service:
name: {{ $serviceName }}
port:

View File

@ -1,5 +1,5 @@
{{- if .Values.server.pdb.enabled }}
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.server.fullname" . }}

View File

@ -1,5 +1,5 @@
{{- if .Values.dex.pdb.enabled }}
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.dex.fullname" . }}

View File

@ -1,5 +1,5 @@
{{- if .Values.redis.pdb.enabled }}
apiVersion: {{ include "argo-cd.podDisruptionBudget.apiVersion" . }}
apiVersion: {{ include "argo-cd.apiVersion.pdb" . }}
kind: PodDisruptionBudget
metadata:
name: {{ template "argo-cd.redis.fullname" . }}

View File

@ -14,10 +14,14 @@ kubeVersionOverride: ""
apiVersionOverrides:
# -- String to override apiVersion of certmanager resources rendered by this helm chart
certmanager: "" # cert-manager.io/v1
# -- String to override apiVersion of ingresses rendered by this helm chart
ingress: "" # networking.k8s.io/v1beta1
# -- String to override apiVersion of GKE resources rendered by this helm chart
cloudgoogle: "" # cloud.google.com/v1
# -- String to override apiVersion of autoscaling rendered by this helm chart
autoscaling: "" # autoscaling/v2
# -- String to override apiVersion of ingresses rendered by this helm chart
ingress: "" # networking.k8s.io/v1beta1
# -- String to override apiVersion of pod disruption budgets rendered by this helm chart
pdb: "" # policy/v1
# -- Create clusterroles that extend existing clusterroles to interact with argo-cd crds
## Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles