SDNC-660: Helm integration for Netconf over TLS 17/79717/5
authorRahul Tyagi <rahul.tyagi@ericsson.com>
Sat, 2 Mar 2019 06:15:35 +0000 (06:15 +0000)
committerRahul Tyagi <rahul.tyagi@ericsson.com>
Tue, 12 Mar 2019 14:02:36 +0000 (14:02 +0000)
This commit introduces a persistent volume for
"NETCONF over TLS" usecase in SDNC, so that certificates can
be fetched from persistence at deployment time of SDNC/ODL. This
functionality can be enbaled/disabled using flag
oom/kubernetes/sdnc/values.yaml
values.certpersistence.enabled true/false.
By default this is enabled (.i.e. true).

Mounted paths are

Host path      : /dockerdata-nfs/sdnc/certs
Container path : /opt/opendaylight/current/certs

Issue-ID: SDNC-660
Change-Id: Iab2ecdfcb890b6dc779de12655f0fb7bd869fb0f
Signed-off-by: Rahul Tyagi <rahul.tyagi@ericsson.com>
kubernetes/sdnc/templates/pv.yaml
kubernetes/sdnc/templates/pvc.yaml [new file with mode: 0644]
kubernetes/sdnc/templates/statefulset.yaml
kubernetes/sdnc/values.yaml

index f10d67a..5a6566a 100644 (file)
@@ -82,3 +82,35 @@ spec:
     path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}2
 {{ end }}
 {{- end -}}
+{{ if .Values.certpersistence.enabled }}
+---
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+  name: {{ include "common.fullname" . }}-pv-certs
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}-pv-certs
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+    name: {{ include "common.fullname" . }}-certs
+spec:
+  capacity:
+    storage: {{ .Values.certpersistence.size }}
+  accessModes:
+    - {{ .Values.certpersistence.accessMode }}
+{{- if .Values.certpersistence.storageClass }}
+{{- if (eq "-" .Values.certpersistence.storageClass) }}
+  storageClassName: ""
+{{- else }}
+  storageClassName: "{{ .Values.certpersistence.storageClass }}"
+{{- end }}
+{{- end }}
+  persistentVolumeReclaimPolicy: {{ .Values.certpersistence.volumeReclaimPolicy }}
+  hostPath:
+    path: {{ .Values.global.persistence.mountPath | default .Values.certpersistence.mountPath }}/{{ .Values.certpersistence.mountSubPath }}
+{{ end }}
+
+
+
diff --git a/kubernetes/sdnc/templates/pvc.yaml b/kubernetes/sdnc/templates/pvc.yaml
new file mode 100644 (file)
index 0000000..aa9515b
--- /dev/null
@@ -0,0 +1,32 @@
+{{- if and .Values.certpersistence.enabled (not .Values.certpersistence.existingClaim) -}}
+kind: PersistentVolumeClaim
+apiVersion: v1
+metadata:
+  name: {{ include "common.fullname" .}}-pvc-certs
+  namespace: {{ include "common.namespace" . }}
+  labels:
+    app: {{ include "common.name" . }}-pvc-certs
+    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+    release: "{{ .Release.Name }}"
+    heritage: "{{ .Release.Service }}"
+{{- if .Values.certpersistence.annotations }}
+  annotations:
+{{ toYaml .Values.certpersistence.annotations | indent 4 }}
+{{- end }}
+spec:
+  selector:
+    matchLabels:
+      app: {{ include "common.name" . }}-pv-certs
+  accessModes:
+    - {{ .Values.certpersistence.accessMode }}
+  resources:
+    requests:
+      storage: {{ .Values.certpersistence.size }}
+{{- if .Values.certpersistence.storageClass }}
+{{- if (eq "-" .Values.certpersistence.storageClass) }}
+  storageClassName: ""
+{{- else }}
+  storageClassName: "{{ .Values.certpersistence.storageClass }}"
+{{- end }}
+{{- end }}
+{{- end -}}
\ No newline at end of file
index 70713cc..24ca832 100644 (file)
@@ -135,6 +135,8 @@ spec:
             name: {{ include "common.fullname" . }}-mdsal
           - mountPath: /var/log/onap
             name: logs
+          - mountPath: {{ .Values.certpersistence.certPath }}
+            name: {{ include "common.fullname" . }}-certs
           resources:
 {{ include "common.resources" . | indent 12 }}
         {{- if .Values.nodeSelector }}
@@ -182,6 +184,13 @@ spec:
           configMap:
             name: {{ include "common.fullname" . }}-properties
             defaultMode: 0644
+        - name: {{ include "common.fullname" . }}-certs
+  {{ if .Values.certpersistence.enabled }}
+          persistentVolumeClaim:
+            claimName: {{ include "common.fullname" . }}-pvc-certs
+  {{ else }}
+          emptyDir: {}
+  {{ end }}
   {{ if not .Values.persistence.enabled }}
         - name: {{ include "common.fullname" . }}-mdsal
           emptyDir: {}
@@ -200,4 +209,4 @@ spec:
       selector:
         matchLabels:
           name: {{ include "common.fullname" . }}
-  {{ end }}
+  {{ end }}
\ No newline at end of file
index 7faba15..95bc31a 100644 (file)
@@ -198,6 +198,22 @@ persistence:
   mountSubPath: sdnc/mdsal
   mdsalPath: /opt/opendaylight/current/daexim
 
+certpersistence:
+  enabled: true
+
+  ## A manually managed Persistent Volume and Claim
+  ## Requires persistence.enabled: true
+  ## If defined, PVC must be created manually before volume will be bound
+  # existingClaim:
+
+  volumeReclaimPolicy: Retain
+  accessMode: ReadWriteOnce
+  size: 50Mi
+  mountPath: /dockerdata-nfs
+  mountSubPath: sdnc/certs
+  certPath: /opt/opendaylight/current/certs
+  ##storageClass: "manual"
+
 ingress:
   enabled: false