Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn committed Jan 11, 2024
1 parent 165ff31 commit 883e04d
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 28 deletions.
5 changes: 3 additions & 2 deletions charts/alfresco-search-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ Checkout [alfresco-content-services chart's doc](https://github.com/Alfresco/acs
| repository.existingConfigMap.name | string | `nil` | Name of a pre-existing configmap containing Alfresco repository URL |
| repository.existingSecret.keys.sharedSecret | string | `"SOLR_ALFRESCO_SECURECOMMS_SECRET"` | Key within the secret holding the repository shared secret |
| repository.existingSecret.name | string | `nil` | Alternatively, provide a pre-existing secret containing the shared secret used with repository when `securecomms` is `secret` |
| repository.securecomms | string | `"secret"` | repository security level to use when tracking the repo ('none' or 'secret') |
| repository.host | string | `nil` | Alfresco repository hostname |
| repository.port | string | `nil` | Alfresco repository port |
| repository.securecomms | string | `"secret"` | Alfresco repository security level to use when tracking the repo ('none' or 'secret') |
| repository.sharedSecret | string | `nil` | Shared secret used with repository when `securecomms` is `secret` |
| repository.url | string | `"http://alfresco-search-service"` | Alfresco repository URL |
| resources.limits.cpu | string | `"4"` | |
| resources.limits.memory | string | `"2000Mi"` | |
| resources.requests.cpu | string | `"0.50"` | |
Expand Down
9 changes: 3 additions & 6 deletions charts/alfresco-search-service/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ metadata:
{{- include "alfresco-search-service.labels" . | nindent 4 }}
data:
{{- with .Values.repository }}
SOLR_ALFRESCO_HOST: >-
{{ template "alfresco-common.url.host" .url }}
SOLR_ALFRESCO_PORT: >-
{{ template "alfresco-common.url.port" .url }}
{{ .existingConfigMap.keys.host }}: {{ .host | quote }}
{{ .existingConfigMap.keys.port }}: {{ .port | quote }}
{{ .existingConfigMap.keys.securecomms }}: {{ .securecomms | quote }}
{{- end }}
SOLR_ALFRESCO_SECURE_COMMS: >-
{{ .Values.repository.securecomms }}
{{- end }}
12 changes: 5 additions & 7 deletions charts/alfresco-search-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,27 +35,25 @@ spec:
{{- include "alfresco-common.component-security-context" .Values | indent 8 }}
env:
{{- with .Values.repository }}
{{- if eq .securecomms "secret" }}
- name: SOLR_ALFRESCO_SECURECOMMS_SECRET
valueFrom:
secretKeyRef:
name: {{ template "alfresco-search-service.repository-config.name" $ }}
key: {{ index .existingSecret.keys "sharedSecret" }}
{{- end }}
name: {{ .existingSecret.name | default (include "alfresco-search-service.repository-config.name" $) }}
key: {{ .existingSecret.keys.sharedSecret }}
- name: SOLR_ALFRESCO_HOST
valueFrom:
configMapKeyRef:
name: {{ template "alfresco-search-service.repository-config.name" $ }}
name: {{ .existingConfigMap.name | default (include "alfresco-search-service.repository-config.name" $) }}
key: {{ .existingConfigMap.keys.host }}
- name: SOLR_ALFRESCO_PORT
valueFrom:
configMapKeyRef:
name: {{ template "alfresco-search-service.repository-config.name" $ }}
name: {{ .existingConfigMap.name | default (include "alfresco-search-service.repository-config.name" $) }}
key: {{ .existingConfigMap.keys.port }}
- name: SOLR_ALFRESCO_SECURECOMMS
valueFrom:
configMapKeyRef:
name: {{ template "alfresco-search-service.repository-config.name" $ }}
name: {{ .existingConfigMap.name | default (include "alfresco-search-service.repository-config.name" $) }}
key: {{ .existingConfigMap.keys.securecomms }}
{{- end }}
- name: SOLR_SOLR_HOST
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (not .Values.repository.existingSecret.name) (eq "secret" .Values.repository.securecomms) }}
{{- $secureCommsSet := and (eq "secret" .Values.repository.securecomms) (not .Values.repository.existingConfigMap.name) }}
{{- if and (not .Values.repository.existingSecret.name) $secureCommsSet }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -8,6 +9,6 @@ metadata:
type: Opaque
data:
{{- $reqmsg := "Please provide a shared secret for solr and repository in value repository.sharedSecret" }}
{{- $shared_secret := required $reqmsg (index .Values.repository "sharedSecret") }}
{{- $shared_secret := required $reqmsg .Values.repository.sharedSecret }}
SOLR_ALFRESCO_SECURECOMMS_SECRET: {{ $shared_secret | b64enc | quote }}
{{- end }}
3 changes: 2 additions & 1 deletion charts/alfresco-search-service/tests/config_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ tests:
values: *testvalues
set:
repository:
url: http://somehost:8888
host: somehost
port: 8888
asserts:
- equal:
path: data.SOLR_ALFRESCO_HOST
Expand Down
13 changes: 6 additions & 7 deletions charts/alfresco-search-service/tests/secret-repository_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ suite: test repository secret
templates:
- secret-repository.yaml
tests:
- it: should render the shared secret from values
- it: should render the secret from values
values: &testvalues
- values/test_values.yaml
asserts:
Expand All @@ -12,22 +12,21 @@ tests:
decodeBase64: true
value: dummy

- it: should not render a shared secret if securecomms is not set to "secret"
- it: should not render the secret when existing is provided
values: *testvalues
set:
repository:
securecomms: none
existingSecret:
name: mysecret
asserts:
- hasDocuments:
count: 0

- it: should not render a shared secret if securecomms is not set to "secret"
- it: should not render the secret if securecomms is set to none
values: *testvalues
set:
repository:
securecomms: secret
existingSecret:
name: mysecret
securecomms: none
asserts:
- hasDocuments:
count: 0
2 changes: 2 additions & 0 deletions charts/alfresco-search-service/tests/values/test_values.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
---
repository:
host: alfresco-search-service
port: 80
sharedSecret: dummy
8 changes: 5 additions & 3 deletions charts/alfresco-search-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,11 @@ ingress:
nginx.ingress.kubernetes.io/whitelist-source-range: 0.0.0.0/0
# Below values must be set by parent chart
repository:
# -- Alfresco repository URL
url: http://alfresco-search-service
# -- repository security level to use when tracking the repo ('none' or 'secret')
# -- Alfresco repository hostname
host: null
# -- Alfresco repository port
port: null
# -- Alfresco repository security level to use when tracking the repo ('none' or 'secret')
securecomms: secret
# -- Shared secret used with repository when `securecomms` is `secret`
sharedSecret: null
Expand Down

0 comments on commit 883e04d

Please sign in to comment.