diff --git a/Chart.yaml b/Chart.yaml index 1df05ad..e6ce8a3 100644 --- a/Chart.yaml +++ b/Chart.yaml @@ -7,7 +7,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.2 +version: 0.1.3 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/README.md b/README.md index b36082f..be6be55 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # letsencrypt -![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) +![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square) A Helm chart to add letsencrypt support to Validated Patterns. diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl new file mode 100644 index 0000000..8a75c43 --- /dev/null +++ b/templates/_helpers.tpl @@ -0,0 +1,11 @@ +{{/* + Name (and namespace) of the cluster Argo CD CR to patch for ingress TLS (see templates/default-routes.yaml). + Presets: vp-gitops (Validated Patterns), openshift-gitops (OpenShift GitOps operator default). +*/}} +{{- define "letsencrypt.gitopsInstanceName" -}} +{{- $i := .Values.letsencrypt.gitopsInstance | default "vp-gitops" -}} +{{- if not (or (eq $i "vp-gitops") (eq $i "openshift-gitops")) -}} +{{- fail (printf "letsencrypt.gitopsInstance must be \"vp-gitops\" or \"openshift-gitops\", got %q" $i) -}} +{{- end -}} +{{- print $i -}} +{{- end -}} diff --git a/templates/default-routes.yaml b/templates/default-routes.yaml index 8a01db6..b3102d4 100644 --- a/templates/default-routes.yaml +++ b/templates/default-routes.yaml @@ -17,8 +17,8 @@ spec: apiVersion: argoproj.io/v1alpha1 kind: ArgoCD metadata: - name: openshift-gitops - namespace: openshift-gitops + name: {{ include "letsencrypt.gitopsInstanceName" . }} + namespace: {{ include "letsencrypt.gitopsInstanceName" . }} annotations: argocd.argoproj.io/sync-options: ServerSideApply=true, Validate=false, SkipDryRunOnMissingResource=true spec: diff --git a/tests/default-routes_test.yaml b/tests/default-routes_test.yaml new file mode 100644 index 0000000..d14170b --- /dev/null +++ b/tests/default-routes_test.yaml @@ -0,0 +1,29 @@ +suite: Test default-routes Argo CD target +templates: + - templates/default-routes.yaml +release: + name: release-test +tests: + - it: patches vp-gitops Argo CD by default + asserts: + - hasDocuments: + count: 3 + - containsDocument: + any: true + kind: ArgoCD + apiVersion: argoproj.io/v1alpha1 + name: vp-gitops + namespace: vp-gitops + - it: patches openshift-gitops when gitopsInstance is set + set: + letsencrypt: + gitopsInstance: openshift-gitops + asserts: + - hasDocuments: + count: 3 + - containsDocument: + any: true + kind: ArgoCD + apiVersion: argoproj.io/v1alpha1 + name: openshift-gitops + namespace: openshift-gitops diff --git a/values.yaml b/values.yaml index 5a9f733..b369fa9 100644 --- a/values.yaml +++ b/values.yaml @@ -51,3 +51,8 @@ letsencrypt: # -- String the channel to install cert-manager from (Defaults to "stable-v1") certmanagerChannel: "stable-v1" + + # -- Which cluster Argo CD instance to patch for the server route TLS settings (`name` and `namespace` on the ArgoCD CR). + # Use `vp-gitops` when Argo CD runs in the Validated Patterns `vp-gitops` namespace (default). + # Use `openshift-gitops` for the default OpenShift GitOps operator instance. + gitopsInstance: vp-gitops