From 783c045972b37430d9d768accbe0f69678bc2180 Mon Sep 17 00:00:00 2001 From: Mayank Mohindra Date: Tue, 13 Dec 2022 17:48:05 +0530 Subject: [PATCH 1/2] Add option to disable lookups for mysql-operator --- helm/mysql-operator/templates/service_account_operator.yaml | 3 ++- helm/mysql-operator/values.yaml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/helm/mysql-operator/templates/service_account_operator.yaml b/helm/mysql-operator/templates/service_account_operator.yaml index e8e30c5..7169054 100644 --- a/helm/mysql-operator/templates/service_account_operator.yaml +++ b/helm/mysql-operator/templates/service_account_operator.yaml @@ -1,3 +1,4 @@ +{{- $disable_lookups:= .Values.disableLookups }} {{- $install_namespace := .Release.Namespace }} {{- if and (.Release.IsInstall) (eq $install_namespace "default") }} {{ fail "Please provide a namespace with -n/--namespace . The operator cannot be installed in the 'default' namespace" }} @@ -13,7 +14,7 @@ imagePullSecrets: {{- if not $secret_name }} {{- fail "image.pullSecrets.secretName is required when pull secrets are enabled" }} {{- end }} - {{- if not (lookup "v1" "Secret" $install_namespace $secret_name) }} + {{- if and (not $disable_lookups) (lookup "v1" "Secret" $install_namespace $secret_name) }} {{- $err := printf "image.pullSecrets.secretName: secret '%s' not found in namespace '%s'" $secret_name $install_namespace }} {{- fail $err }} {{- end }} diff --git a/helm/mysql-operator/values.yaml b/helm/mysql-operator/values.yaml index 8b16f61..6f6dbeb 100644 --- a/helm/mysql-operator/values.yaml +++ b/helm/mysql-operator/values.yaml @@ -9,6 +9,10 @@ image: enabled: false secretName: +# 'lookup' functions need to be disabled while using +# `kubernetes kustomize` or `helm template`. +disableLookups: false + envs: imagesPullPolicy: IfNotPresent imagesDefaultRegistry: From fce330cbffb3f1a571430774d68bfbb4df910f55 Mon Sep 17 00:00:00 2001 From: Mayank Mohindra Date: Tue, 13 Dec 2022 21:06:03 +0530 Subject: [PATCH 2/2] Fix condition to lookup post flag set --- helm/mysql-operator/templates/service_account_operator.yaml | 2 +- helm/mysql-operator/values.yaml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/helm/mysql-operator/templates/service_account_operator.yaml b/helm/mysql-operator/templates/service_account_operator.yaml index 7169054..1558b17 100644 --- a/helm/mysql-operator/templates/service_account_operator.yaml +++ b/helm/mysql-operator/templates/service_account_operator.yaml @@ -14,7 +14,7 @@ imagePullSecrets: {{- if not $secret_name }} {{- fail "image.pullSecrets.secretName is required when pull secrets are enabled" }} {{- end }} - {{- if and (not $disable_lookups) (lookup "v1" "Secret" $install_namespace $secret_name) }} + {{- if and (not $disable_lookups) (not (lookup "v1" "Secret" $install_namespace $secret_name)) }} {{- $err := printf "image.pullSecrets.secretName: secret '%s' not found in namespace '%s'" $secret_name $install_namespace }} {{- fail $err }} {{- end }} diff --git a/helm/mysql-operator/values.yaml b/helm/mysql-operator/values.yaml index 6f6dbeb..69e47de 100644 --- a/helm/mysql-operator/values.yaml +++ b/helm/mysql-operator/values.yaml @@ -9,8 +9,6 @@ image: enabled: false secretName: -# 'lookup' functions need to be disabled while using -# `kubernetes kustomize` or `helm template`. disableLookups: false envs: