diff --git a/charts/alfresco-search-service/templates/secret-repository.yaml b/charts/alfresco-search-service/templates/secret-repository.yaml index 87a05190..bcdb2ac8 100644 --- a/charts/alfresco-search-service/templates/secret-repository.yaml +++ b/charts/alfresco-search-service/templates/secret-repository.yaml @@ -1,4 +1,4 @@ -{{- if and (eq "secret" .Values.repository.securecomms) (not .Values.repository.existingSecret.name) }} +{{- if and (not .Values.repository.existingSecret.name) (eq "secret" .Values.repository.securecomms) (not .Values.repository.existingConfigMap.name) }} apiVersion: v1 kind: Secret metadata: {{- $ctx := dict "Values" (dict "nameOverride" (printf "%s-repository" $.Chart.Name )) "Chart" $.Chart "Release" $.Release }} @@ -7,7 +7,7 @@ metadata: {{- $ctx := dict "Values" (dict "nameOverride" (printf "%s-repository" {{ template "alfresco-search-service.labels" . }} type: Opaque data: - {{- $reqmsg := "Please provide a shared secret for solr and repository in value repository.solr-secret" }} + {{- $reqmsg := "Please provide a shared secret for solr and repository in value repository.shared-secret" }} {{- $shared_secret := required $reqmsg (index .Values.repository "shared-secret") }} SOLR_ALFRESCO_SECURECOMMS_SECRET: {{ $shared_secret | b64enc | quote }} {{- end }} diff --git a/charts/alfresco-search-service/tests/secrets_test.yaml b/charts/alfresco-search-service/tests/secrets_test.yaml index 6b269494..7134f2b9 100644 --- a/charts/alfresco-search-service/tests/secrets_test.yaml +++ b/charts/alfresco-search-service/tests/secrets_test.yaml @@ -53,3 +53,13 @@ tests: asserts: - hasDocuments: count: 0 + - it: should not render a shared secret if securecomms is not set to "secret" + values: *testvalues + set: + repository: + existingSecret: + name: mysecret + template: secret-repository.yaml + asserts: + - hasDocuments: + count: 0