From 1b2c468287af826a3dffd4883f362919883bf654 Mon Sep 17 00:00:00 2001 From: Roming22 Date: Thu, 21 Mar 2024 18:12:52 -0400 Subject: [PATCH] Fix components guards (#64) * Fix guards on subscriptions leading to them being deleted on updates. * Add guard for DH. --- templates/developer-hub/includes/_configure.tpl | 2 ++ templates/openshift-gitops/subscription.yaml | 2 +- templates/openshift-pipelines/subscription.yaml | 2 +- test/data/helm-chart/template.yaml | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/developer-hub/includes/_configure.tpl b/templates/developer-hub/includes/_configure.tpl index a8ca9bb..f878b11 100644 --- a/templates/developer-hub/includes/_configure.tpl +++ b/templates/developer-hub/includes/_configure.tpl @@ -1,4 +1,5 @@ {{ define "rhtap.developer-hub.configure" }} +{{ if (index .Values "developer-hub") }} - name: configure-developer-hub image: "quay.io/codeready-toolchain/oc-client-base:latest" command: @@ -142,4 +143,5 @@ echo echo "Configuration successful" +{{ end }} {{ end }} \ No newline at end of file diff --git a/templates/openshift-gitops/subscription.yaml b/templates/openshift-gitops/subscription.yaml index f37f297..3522691 100644 --- a/templates/openshift-gitops/subscription.yaml +++ b/templates/openshift-gitops/subscription.yaml @@ -1,5 +1,5 @@ --- -{{if eq (len (lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "applications.argoproj.io")) 0}} +{{ if (index .Values "openshift-gitops") }} apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: diff --git a/templates/openshift-pipelines/subscription.yaml b/templates/openshift-pipelines/subscription.yaml index d98109a..4123c74 100644 --- a/templates/openshift-pipelines/subscription.yaml +++ b/templates/openshift-pipelines/subscription.yaml @@ -1,5 +1,5 @@ --- -{{if eq (len (lookup "apiextensions.k8s.io/v1" "CustomResourceDefinition" "" "pipelines.tekton.dev")) 0}} +{{ if (index .Values "openshift-pipelines") }} apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: diff --git a/test/data/helm-chart/template.yaml b/test/data/helm-chart/template.yaml index 82f388b..c9d2655 100644 --- a/test/data/helm-chart/template.yaml +++ b/test/data/helm-chart/template.yaml @@ -141,6 +141,7 @@ spec: echo "Configuration successful" + - name: configure-developer-hub image: "quay.io/codeready-toolchain/oc-client-base:latest" command: @@ -503,6 +504,7 @@ spec: echo echo "Configuration successful" + - name: configure-gitops image: "quay.io/codeready-toolchain/oc-client-base:latest"