From 5c7e4c32d4836ed11c6138c9efd5fb0afded9c04 Mon Sep 17 00:00:00 2001 From: Atze de Vries Date: Wed, 26 May 2021 14:45:17 +0200 Subject: [PATCH] feat: Add ability to override api versions for argocd Signed-off-by: Atze de Vries --- charts/argo-cd/Chart.yaml | 2 +- charts/argo-cd/templates/_helpers.tpl | 4 +++- .../argo-cd/templates/argocd-server/certificate.yaml | 4 +++- charts/argo-cd/values.yaml | 10 ++++++++++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/charts/argo-cd/Chart.yaml b/charts/argo-cd/Chart.yaml index 3dfdf5ed..bf36e5d4 100644 --- a/charts/argo-cd/Chart.yaml +++ b/charts/argo-cd/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 appVersion: 2.0.1 description: A Helm chart for ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes. name: argo-cd -version: 3.6.2 +version: 3.6.3 home: https://github.com/argoproj/argo-helm icon: https://raw.githubusercontent.com/argoproj/argo/master/docs/assets/argo.png keywords: diff --git a/charts/argo-cd/templates/_helpers.tpl b/charts/argo-cd/templates/_helpers.tpl index 65081951..16184eb7 100644 --- a/charts/argo-cd/templates/_helpers.tpl +++ b/charts/argo-cd/templates/_helpers.tpl @@ -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.APIOverrides -}} +{{- print .Values.APIOverrides.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" -}} diff --git a/charts/argo-cd/templates/argocd-server/certificate.yaml b/charts/argo-cd/templates/argocd-server/certificate.yaml index edaea3b5..12a7fbc2 100644 --- a/charts/argo-cd/templates/argocd-server/certificate.yaml +++ b/charts/argo-cd/templates/argocd-server/certificate.yaml @@ -1,5 +1,7 @@ {{- if .Values.server.certificate.enabled -}} -{{- if .Capabilities.APIVersions.Has "cert-manager.io/v1" }} +{{- if .Values.APIOverrides -}} +apiVersion: {{ .Values.APIOverrides.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 diff --git a/charts/argo-cd/values.yaml b/charts/argo-cd/values.yaml index bdcfe854..fc7d565a 100755 --- a/charts/argo-cd/values.yaml +++ b/charts/argo-cd/values.yaml @@ -23,6 +23,16 @@ 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 +APIOverrides: + enabled: false + certmanager: cert-manager.io/v1 + ingress: networking.k8s.io/v1beta1 + + + ## Controller controller: name: application-controller