feat(argo-cd): Add ability to override API versions (#760)

* feat: Add ability to override api versions for argocd
Signed-off-by: Atze de Vries <devries@zorgdomein.nl>

* fix linting

Signed-off-by: Atze de Vries <devries@zorgdomein.nl>

* reimplement a bit and update chart version

Signed-off-by: Atze de Vries <devries@zorgdomein.nl>

* update to new minor

Signed-off-by: Atze de Vries <devries@zorgdomein.nl>

* fix spaces in comments

Signed-off-by: Atze de Vries <devries@zorgdomein.nl>

* Updated flow control and add documentation on apiVersionOverrides

Signed-off-by: Atze de Vries <devries@zorgdomein.nl>

* Add changelog annotation

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:
Atze de Vries 2021-07-09 14:34:09 +02:00 committed by GitHub
parent a70d156217
commit 783cb3e029
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 3 deletions

View file

@ -2,7 +2,7 @@ apiVersion: v2
appVersion: 2.0.4
description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes.
name: argo-cd
version: 3.7.2
version: 3.8.0
home: https://github.com/argoproj/argo-helm
icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png
keywords:
@ -19,3 +19,6 @@ dependencies:
version: 4.12.14
repository: https://dandydeveloper.github.io/charts/
condition: redis-ha.enabled
annotations:
artifacthub.io/changes: |
- "[Added]: Ability to override API versions"

View file

@ -111,6 +111,8 @@ NAME: my-release
| kubeVersionOverride | Override the Kubernetes version, which is used to evaluate certain manifests | `""` |
| nameOverride | Provide a name in place of `argocd` | `"argocd"` |
| fullnameOverride | String to fully override `"argo-cd.fullname"` | `""` |
| apiVersionOverrides.certmanager | String to override apiVersion of certmanager resources rendered by this helm chart | `""` |
| apiVersionOverrides.ingress | String to override apiVersion of ingresses rendered by this helm chart | `""` |
| configs.clusterCredentials | Provide one or multiple [external cluster credentials](https://argoproj.github.io/argo-cd/operator-manual/declarative-setup/#clusters) | `[]` (See [values.yaml](values.yaml)) |
| configs.gpgKeysAnnotations | GnuPG key ring annotations | `{}` |
| configs.gpgKeys | [GnuPG](https://argoproj.github.io/argo-cd/user-guide/gpg-verification/) keys to add to the key ring | `{}` (See [values.yaml](values.yaml)) |

View file

@ -144,7 +144,9 @@ app.kubernetes.io/component: {{ .component }}
Return the appropriate apiVersion for ingress
*/}}
{{- define "argo-cd.ingress.apiVersion" -}}
{{- if semverCompare "<1.14-0" (include "argo-cd.kubeVersion" $) -}}
{{- 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" -}}

View file

@ -1,5 +1,7 @@
{{- if .Values.server.certificate.enabled -}}
{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1" }}
{{- 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

View file

@ -20,6 +20,13 @@ global:
# hostnames:
# - git.myhostname
# Override APIVersions
# If you want to template helm charts but cannot access k8s API server
# you can set api versions here
apiVersionOverrides:
certmanager: "" # cert-manager.io/v1
ingress: "" # networking.k8s.io/v1beta1
## Controller
controller:
name: application-controller