aboutsummaryrefslogtreecommitdiffstats
path: root/kubernetes/common
diff options
context:
space:
mode:
authorJan Malkiewicz <jan.malkiewicz@nokia.com>2021-01-12 11:59:28 +0100
committerJan Malkiewicz <jan.malkiewicz@nokia.com>2021-01-13 09:32:16 +0100
commit7a0f2eb4b0700b89207a7d439a08a7918f3b399a (patch)
treef8e426f5e96280189c4d07525646cd162da19ba0 /kubernetes/common
parent581f2b17fd0b247eeeb4e3770b212c7e6cd631fb (diff)
[CMPV2] Generate certificate name
Genereate names of certificate and secret Issue-ID: OOM-2568 Signed-off-by: Jan Malkiewicz <jan.malkiewicz@nokia.com> Change-Id: I014df059f348e974f6d222b5d6d1c2416bea0440
Diffstat (limited to 'kubernetes/common')
-rw-r--r--kubernetes/common/common/templates/_certificate.tpl18
1 files changed, 9 insertions, 9 deletions
diff --git a/kubernetes/common/common/templates/_certificate.tpl b/kubernetes/common/common/templates/_certificate.tpl
index 74f81af901..d3313b2bc1 100644
--- a/kubernetes/common/common/templates/_certificate.tpl
+++ b/kubernetes/common/common/templates/_certificate.tpl
@@ -33,11 +33,10 @@
# To be added in the file values.yaml
# 1. Minimal version (certificates only in PEM format)
# certificates:
-# - name: onap-component-certificate
-# secretName: onap-component-certificate
-# commonName: component.onap.org
-# 2. Extended version (with defined own issuer and additional certificate format):
-# certificates:
+# - commonName: component.onap.org
+#
+# 2. Extended version (with defined own issuer and additional certificate format):
+# certificates:
# - name: onap-component-certificate
# secretName: onap-component-certificate
# commonName: component.onap.org
@@ -71,10 +70,11 @@
{{- $dot := default . .dot -}}
{{- $certificates := $dot.Values.certificates -}}
-{{ range $certificate := $certificates }}
+{{ range $i, $certificate := $certificates }}
{{/*# General certifiacate attributes #*/}}
-{{- $name := $certificate.name -}}
-{{- $secretName := $certificate.secretName -}}
+{{- $name := include "common.fullname" $dot -}}
+{{- $certName := default (printf "%s-cert-%d" $name $i) $certificate.name -}}
+{{- $secretName := default (printf "%s-secret-%d" $name $i) $certificate.secretName -}}
{{- $commonName := default $dot.Values.global.certificate.default.commonName $certificate.commonName -}}
{{- $renewBefore := default $dot.Values.global.certificate.default.renewBefore $certificate.renewBefore -}}
{{- $duration := $certificate.duration -}}
@@ -122,7 +122,7 @@
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
- name: {{ $name }}
+ name: {{ $certName }}
namespace: {{ $namespace }}
spec:
secretName: {{ $secretName }}