From 2a49e6d670495d46a45a7deabce881f4a5b56239 Mon Sep 17 00:00:00 2001 From: amecea Date: Tue, 11 Dec 2018 14:17:16 +0200 Subject: [PATCH] Don't install CRDs when the api is already registered. --- hack/charts/mysql-operator/templates/crds.yaml | 2 +- hack/generate_chart_manifests.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/charts/mysql-operator/templates/crds.yaml b/hack/charts/mysql-operator/templates/crds.yaml index 0883fd9eb..0f1a64a93 100644 --- a/hack/charts/mysql-operator/templates/crds.yaml +++ b/hack/charts/mysql-operator/templates/crds.yaml @@ -1,4 +1,4 @@ -{{- if .Values.installCRDs }} +{{- if (and .Values.installCRDs (not (.Capabilities.APIVersions.Has "mysql.presslabs.org/v1alpha1"))) }} apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: diff --git a/hack/generate_chart_manifests.sh b/hack/generate_chart_manifests.sh index 717a35499..44ef206ca 100755 --- a/hack/generate_chart_manifests.sh +++ b/hack/generate_chart_manifests.sh @@ -15,7 +15,7 @@ yq d -d'*' -i ${CHART_PATH}/templates/_crds.yaml spec.validation yq w -d1 -i ${CHART_PATH}/templates/_crds.yaml 'spec.names.shortNames[0]' mysql -echo '{{- if .Values.installCRDs }}' > ${CHART_PATH}/templates/crds.yaml +echo '{{- if (and .Values.installCRDs (not (.Capabilities.APIVersions.Has "mysql.presslabs.org/v1alpha1"))) }}' > ${CHART_PATH}/templates/crds.yaml cat ${CHART_PATH}/templates/_crds.yaml >> ${CHART_PATH}/templates/crds.yaml echo '{{- end }}' >> ${CHART_PATH}/templates/crds.yaml rm ${CHART_PATH}/templates/_crds.yaml