Skip to content

Commit 7ef335d

Browse files
authored
fix: apl keycloak operator tls (#1646)
1 parent 096d9a1 commit 7ef335d

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

charts/apl-keycloak-operator/templates/deployment.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
{{- toYaml .Values.securityContext | nindent 12 }}
3232
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
3333
imagePullPolicy: {{ .Values.image.pullPolicy }}
34-
{{- if and .Values.configs (not (empty .Values.configs.tls.certificates)) }}
34+
{{- if (not (empty .Values.configs.tls.certificates)) }}
3535
command: ['/bin/sh', '-c']
3636
args: ['export NODE_EXTRA_CA_CERTS=/app/config/tls/certificate.crt && npm run operator:keycloak']
3737
env:
@@ -42,10 +42,12 @@ spec:
4242
{{- end }}
4343
resources:
4444
{{- toYaml .Values.resources | nindent 12 }}
45+
{{- if (not (empty .Values.configs.tls.certificates)) }}
4546
volumeMounts:
4647
- name: tls-certs
4748
mountPath: /app/config/tls/certificate.crt
4849
subPath: certificate.crt
50+
{{- end }}
4951
{{- with .Values.nodeSelector }}
5052
nodeSelector:
5153
{{- toYaml . | nindent 8 }}
@@ -59,9 +61,11 @@ spec:
5961
{{- toYaml . | nindent 8 }}
6062
{{- end }}
6163
volumes:
64+
{{- if (not (empty .Values.configs.tls.certificates)) }}
6265
- name: tls-certs
6366
secret:
6467
secretName: keycloak-operator-tls-certs-cm
68+
{{- end }}
6569
- name: operator-config-kc
6670
configMap:
6771
name: apl-keycloak-operator-cm
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{{- with .Values.configs.tls.certificates.caCert }}
1+
{{- if and .Values.configs .Values.configs.tls .Values.configs.tls.certificates .Values.configs.tls.certificates.caCert }}
22
apiVersion: v1
33
kind: Secret
44
metadata:
55
name: keycloak-operator-tls-certs-cm
66
namespace: apl-keycloak-operator
77
data:
8-
certificate.crt: {{- . | b64enc | nindent 4 }}
8+
certificate.crt: {{- .Values.configs.tls.certificates.caCert | b64enc | nindent 4 }}
99
{{- end }}

values/apl-keycloak-operator/apl-keycloak-operator.gotmpl

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ imagePullSecrets:
1212
- name: apl-pullsecret-global
1313
{{- end }}
1414
configs:
15-
{{ if $v._derived.untrustedCA }}
1615
tls:
1716
certificates:
17+
{{ if $v._derived.untrustedCA }}
1818
caCert: |
1919
{{- $v._derived.caCert | nindent 8 }}
20-
{{ end }}
20+
{{- else }}
21+
{}
22+
{{ end }}
2123
script: |
2224
{{- if $v._derived.untrustedCA }}
2325
export NODE_EXTRA_CA_CERTS=/app/config/tls/certificates.crt

0 commit comments

Comments
 (0)