Skip to content

Commit

Permalink
better handle secret creation
Browse files Browse the repository at this point in the history
  • Loading branch information
alxgomz committed Sep 15, 2023
1 parent 1143992 commit 1774756
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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 }}
Expand All @@ -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 }}
10 changes: 10 additions & 0 deletions charts/alfresco-search-service/tests/secrets_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 1774756

Please sign in to comment.