From 5909fcd8413c34f163b3c26c246dfaf0664db913 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Mon, 7 Dec 2020 13:06:00 -0800 Subject: [PATCH] Fix empty CRDs, only deploy eck-operator if needed --- charts/kubezero-logging/values.yaml | 2 +- charts/kubezero/bootstrap.sh | 10 +++++----- charts/kubezero/templates/logging.yaml | 6 ++++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/charts/kubezero-logging/values.yaml b/charts/kubezero-logging/values.yaml index 4e5f935c..e2fa0e08 100644 --- a/charts/kubezero-logging/values.yaml +++ b/charts/kubezero-logging/values.yaml @@ -2,7 +2,7 @@ # fullnameOverride: "" eck-operator: - enabled: true + enabled: false installCRDs: false tolerations: - key: node-role.kubernetes.io/master diff --git a/charts/kubezero/bootstrap.sh b/charts/kubezero/bootstrap.sh index 97f32e50..54a2cfb1 100755 --- a/charts/kubezero/bootstrap.sh +++ b/charts/kubezero/bootstrap.sh @@ -71,10 +71,10 @@ function delete_ns() { # Extract crds via helm calls and apply delta=crds only function _crds() { - helm template $(chart_location $chart) --namespace $namespace --name-template $release --skip-crds --set ${release}.installCRDs=false > $TMPDIR/helm-no-crds.yaml - helm template $(chart_location $chart) --namespace $namespace --name-template $release --include-crds --set ${release}.installCRDs=true > $TMPDIR/helm-crds.yaml - diff -e $TMPDIR/helm-no-crds.yaml $TMPDIR/helm-crds.yaml | head -n-1 | tail -n+2 > $TMPDIR/crds.yaml - kubectl apply -f $TMPDIR/crds.yaml + helm template $(chart_location $chart) --namespace $namespace --name-template $release --skip-crds --set ${release}.installCRDs=false > $TMPDIR/helm-no-crds.yaml + helm template $(chart_location $chart) --namespace $namespace --name-template $release --include-crds --set ${release}.installCRDs=true > $TMPDIR/helm-crds.yaml + diff -e $TMPDIR/helm-no-crds.yaml $TMPDIR/helm-crds.yaml | head -n-1 | tail -n+2 > $TMPDIR/crds.yaml + [ -s $TMPDIR/crds.yaml ] && kubectl apply -f $TMPDIR/crds.yaml } @@ -200,7 +200,7 @@ function logging-crds() { helm template $(chart_location $chart) --namespace $namespace --name-template $release --skip-crds --set eck-operator.installCRDs=false > $TMPDIR/helm-no-crds.yaml helm template $(chart_location $chart) --namespace $namespace --name-template $release --include-crds --set eck-operator.installCRDs=true > $TMPDIR/helm-crds.yaml diff -e $TMPDIR/helm-no-crds.yaml $TMPDIR/helm-crds.yaml | head -n-1 | tail -n+2 > $TMPDIR/crds.yaml - kubectl apply -f $TMPDIR/crds.yaml + [ -s $TMPDIR/crds.yaml ] && kubectl apply -f $TMPDIR/crds.yaml } function logging-post() { kubectl annotate --overwrite namespace logging 'iam.amazonaws.com/permitted=.*ElasticSearchSnapshots.*' diff --git a/charts/kubezero/templates/logging.yaml b/charts/kubezero/templates/logging.yaml index ce161355..8b1f93ff 100644 --- a/charts/kubezero/templates/logging.yaml +++ b/charts/kubezero/templates/logging.yaml @@ -1,8 +1,10 @@ {{- define "logging-values" }} - -{{- with index .Values "logging" "eck-operator" }} +{{- if or .Values.logging.es .Values.logging.kibana }} eck-operator: + enabled: true + {{- with index .Values "logging" "eck-operator" }} {{- toYaml . | nindent 2 }} + {{- end }} {{- end }} {{- if .Values.logging.elastic_password }}