Skip to content

Commit db613f3

Browse files
authored
Support externel nginx cerficate (#618)
* Support externel nginx certificate * Fix name error Co-authored-by: ning.yougang <[email protected]>
1 parent 554cbd1 commit db613f3

File tree

6 files changed

+41
-0
lines changed

6 files changed

+41
-0
lines changed

helm/openwhisk/templates/_helpers.tpl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,17 @@ imagePullSecrets:
327327
{{- define "openwhisk.grafana_host" -}}
328328
{{ .Release.Name }}-grafana.{{ .Release.Namespace }}.svc.{{ .Values.k8s.domain }}
329329
{{- end -}}
330+
331+
{{/* nginx cert */}}
332+
{{- define "openwhisk.nginx_cert" -}}
333+
{{- if .Values.nginx.certificate.external }}
334+
{{ .Files.Get .Values.nginx.certificate.cert_file }}
335+
{{- end -}}
336+
{{- end -}}
337+
338+
{{/* nginx key */}}
339+
{{- define "openwhisk.nginx_key" -}}
340+
{{- if .Values.nginx.certificate.external }}
341+
{{ .Files.Get .Values.nginx.certificate.key_file }}
342+
{{- end -}}
343+
{{- end -}}

helm/openwhisk/templates/gen-certs-cm.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@ metadata:
2222
labels:
2323
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
2424
data:
25+
{{- if .Values.nginx.certificate.external }}
26+
tls.crt: |
27+
{{ include "openwhisk.nginx_cert" . | indent 4 }}
28+
tls.key: |
29+
{{ include "openwhisk.nginx_key" . | indent 4 }}
30+
sslPassword: |
31+
{{ .Values.nginx.certificate.sslPassword }}
32+
{{- else }}
2533
{{ (.Files.Glob "configMapFiles/genCerts/gencerts.sh").AsConfig | indent 2 }}
34+
{{- end }}

helm/openwhisk/templates/gen-certs-job.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18+
{{- if not .Values.nginx.certificate.external }}
1819
apiVersion: batch/v1
1920
kind: Job
2021
metadata:
@@ -55,3 +56,4 @@ spec:
5556
configMapKeyRef:
5657
name: {{ .Release.Name }}-whisk.config
5758
key: whisk_api_host_name
59+
{{- end }}

helm/openwhisk/templates/nginx-cm.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ data:
5757
ssl_session_timeout 10m;
5858
ssl_certificate /etc/nginx/certs/tls.crt;
5959
ssl_certificate_key /etc/nginx/certs/tls.key;
60+
{{- if .Values.nginx.certificate.external }}
61+
{{- if ne .Values.nginx.certificate.sslPassword "" }}
62+
ssl_password_file "/etc/nginx/certs/sslPassword";
63+
{{- end }}
64+
{{- end }}
6065
ssl_verify_client off;
6166
ssl_protocols TLSv1.2;
6267
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;

helm/openwhisk/templates/nginx-pod.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,15 @@ spec:
4848
{{- end }}
4949

5050
volumes:
51+
{{- if .Values.nginx.certificate.external }}
52+
- name: nginx-certs
53+
configMap:
54+
name: {{ .Release.Name }}-gen-certs
55+
{{- else }}
5156
- name: nginx-certs
5257
secret:
5358
secretName: {{ .Release.Name }}-nginx
59+
{{- end }}
5460
- name: nginx-conf
5561
configMap:
5662
name: {{ .Release.Name }}-nginx

helm/openwhisk/values.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ nginx:
239239
httpPort: 80
240240
httpsPort: 443
241241
httpsNodePort: 31001
242+
certificate:
243+
external: false
244+
cert_file: ""
245+
key_file: ""
246+
sslPassword: ""
242247

243248
# Controller configurations
244249
controller:

0 commit comments

Comments
 (0)