[Common] Use global storage templates for PVC 62/98962/6
authorSylvain Desbureaux <sylvain.desbureaux@orange.com>
Fri, 29 Nov 2019 10:35:13 +0000 (11:35 +0100)
committerSylvain Desbureaux <sylvain.desbureaux@orange.com>
Thu, 5 Dec 2019 16:27:11 +0000 (17:27 +0100)
OOM has now templates in order to create the needed PVC, using:

* a PV with a specific class when using a common nfs mount path between
nodes (sames as today use) --> is the default behavior today
* or a storage class if we want to use dynamic PV.
  On this case, we use (in order of priority):
  - persistence.storageClassOverride if set on the chart
  - global.persistence.storageClass if set globally
  - persistence.storageClass if set on the chart

I've also aligned the PV creation of the different charts.
I've also aligned the PVC creation of the different charts.

I've removed unused mysql chart and (badly) used nfs-provisioner chart.

I've also make cassandra backup work with dynamic PV (but RWX only for
now).

Change-Id: I0ea3f8c7514ca648d94b6c682684c06b822bbe0a
Issue-ID: OOM-2229
Issue-ID: OOM-2228
Issue-ID: OOM-2227
Issue-ID: OOM-1227
Signed-off-by: Sylvain Desbureaux <sylvain.desbureaux@orange.com>
50 files changed:
kubernetes/common/cassandra/templates/backup/cronjob.yaml
kubernetes/common/cassandra/templates/backup/pv.yaml
kubernetes/common/cassandra/templates/backup/pvc.yaml
kubernetes/common/cassandra/templates/pv.yaml
kubernetes/common/cassandra/templates/statefulset.yaml
kubernetes/common/cassandra/values.yaml
kubernetes/common/etcd/templates/pv.yaml
kubernetes/common/etcd/templates/statefulset.yaml
kubernetes/common/etcd/values.yaml
kubernetes/common/mariadb-galera/templates/backup/cronjob.yaml
kubernetes/common/mariadb-galera/templates/backup/pv.yaml
kubernetes/common/mariadb-galera/templates/backup/pvc.yaml
kubernetes/common/mariadb-galera/templates/pv.yaml
kubernetes/common/mariadb-galera/templates/statefulset.yaml
kubernetes/common/mongo/templates/nfs-provisoner.yaml [deleted file]
kubernetes/common/mongo/templates/pv.yaml
kubernetes/common/mongo/templates/pvc.yaml [deleted file]
kubernetes/common/mongo/templates/service.yaml
kubernetes/common/mongo/templates/statefulset.yaml
kubernetes/common/mongo/templates/storageclass.yaml [deleted file]
kubernetes/common/mongo/values.yaml
kubernetes/common/music/charts/music-cassandra/templates/pv.yaml [new file with mode: 0644]
kubernetes/common/music/charts/music-cassandra/templates/statefulset.yaml
kubernetes/common/music/charts/music-cassandra/templates/volumes.yaml [deleted file]
kubernetes/common/music/charts/music-cassandra/values.yaml
kubernetes/common/music/charts/zookeeper/templates/pv.yaml [new file with mode: 0644]
kubernetes/common/music/charts/zookeeper/templates/statefulset.yaml
kubernetes/common/music/charts/zookeeper/templates/volumes.yaml [deleted file]
kubernetes/common/music/charts/zookeeper/values.yaml
kubernetes/common/mysql/.helmignore [deleted file]
kubernetes/common/mysql/Chart.yaml [deleted file]
kubernetes/common/mysql/requirements.yaml [deleted file]
kubernetes/common/mysql/templates/configmap.yaml [deleted file]
kubernetes/common/mysql/templates/nfs-provisoner.yaml [deleted file]
kubernetes/common/mysql/templates/pv.yaml [deleted file]
kubernetes/common/mysql/templates/secrets.yaml [deleted file]
kubernetes/common/mysql/templates/service.yaml [deleted file]
kubernetes/common/mysql/templates/statefulset.yaml [deleted file]
kubernetes/common/mysql/templates/storageclass.yaml [deleted file]
kubernetes/common/mysql/values.yaml [deleted file]
kubernetes/common/nfs-provisioner/Chart.yaml [deleted file]
kubernetes/common/nfs-provisioner/requirements.yaml [deleted file]
kubernetes/common/nfs-provisioner/templates/nfs-provisoner.yaml [deleted file]
kubernetes/common/nfs-provisioner/templates/service.yaml [deleted file]
kubernetes/common/nfs-provisioner/values.yaml [deleted file]
kubernetes/common/postgres/templates/pv.yaml
kubernetes/common/postgres/templates/statefulset.yaml
kubernetes/onap/requirements.yaml
kubernetes/onap/values.yaml
kubernetes/oof/values.yaml

index 630ac43..0d06318 100644 (file)
@@ -75,7 +75,7 @@ spec:
 
                 echo "Executing cleanup!!"
                 command="nodetool cleanup"
-                /root/exec.py -p "cassandra" -c "$command"                
+                /root/exec.py -p "cassandra" -c "$command"
                 echo "Cleaned Node!! Backing up database now!!!"
 
                 command="nodetool snapshot -t $curr_time"
@@ -97,7 +97,7 @@ spec:
                     if [ 1 ] {{- range $t, $keyspace := $root.Values.backup.keyspacesToSkip }} && [ "{{ $keyspace.name }}" != "$keyspace_name" ] {{- end }}; then
                       /root/restore.sh -b $backup_dir/cassandra-{{ $i }}/data -s  /onap-data/cassandra-{{ $i }}/data/$keyspace_name -k $keyspace_name -t $curr_time &
                       pids="$pids $!"
-                    fi                  
+                    fi
                   done
                 {{- end }}
 
@@ -121,7 +121,7 @@ spec:
                   echo "Failed" > /backup/backup.log
                   exit 0
                 fi
-                
+
                 mv /backup/temp /backup/backup-${curr_time}
                 echo "Success" > /backup/backup.log
                 echo "Cassandra Backup Succeeded"
@@ -135,8 +135,10 @@ spec:
               - mountPath: /etc/localtime
                 name: localtime
                 readOnly: true
-              - mountPath: /onap-data
-                name: data-dir
+              {{- range $i := until (int .Values.replicaCount)}}
+              - mountPath: /onap-data/cassandra-{{ $i }}
+                name: data-dir-{{ $i }}
+              {{- end }}
               - mountPath: /backup
                 name: backup-dir
               - name: scripts
@@ -144,7 +146,7 @@ spec:
                 subPath: restore.sh
               - name: scripts
                 mountPath: /root/exec.py
-                subPath: exec.py           
+                subPath: exec.py
           containers:
             - name: cassandra-backup-validate
               image: "{{ .Values.image }}"
@@ -200,7 +202,7 @@ spec:
                   done
                   kill -9 $CASS_PID
                 {{- end }}
-                echo "Validation Successful!!!" 
+                echo "Validation Successful!!!"
                 cd /backup
                 totalFiles=`ls -t | grep "backup-" | wc -l`
                 if [ $totalFiles -gt {{ .Values.backup.retentionPeriod }} ]; then
@@ -230,13 +232,14 @@ spec:
               path: /etc/localtime
           - name: scripts
             configMap:
-              name: {{ include "common.fullname" $ }}-configmap
+              name: {{ include "common.fullname" . }}-configmap
               defaultMode: 0755
-          - name: data-dir
+          {{- range $i := until (int .Values.replicaCount)}}
+          - name: data-dir-{{ $i }}
             persistentVolumeClaim:
-              claimName: {{ include "common.fullname" . }}-db-data
+              claimName: {{ include "common.fullname" . }}-data-{{ $i }}
+          {{- end }}
           - name: backup-dir
             persistentVolumeClaim:
               claimName: {{ include "common.fullname" . }}-backup-data
 {{- end -}}
-              
index 332dc95..10c3100 100644 (file)
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2019 Amdocs, Bell Canada, AT&T
+# Copyright © 2019 Amdocs, Bell Canada, AT&T, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # limitations under the License.
 */}}
 {{- if .Values.backup.enabled }}
-{{ if .Values.persistence.enabled }}
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: {{ include "common.fullname" . }}-db-data
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    heritage: {{ .Release.Service }}
-    name: {{ include "common.fullname" . }}-db-data
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size }}
-  accessModes:
-  - {{ .Values.persistence.accessMode }}
-  hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+{{- if eq "True" (include "common.needPV" .) -}}
 ---
 apiVersion: v1
 kind: PersistentVolume
@@ -49,9 +32,10 @@ spec:
     storage: {{ .Values.persistence.size }}
   accessModes:
   - {{ .Values.persistence.accessMode }}
-  hostPath:
-    path: {{ .Values.global.persistence.backup.mountPath | default .Values.persistence.backup.mountPath }}/{{ include "common.namespace" $ }}/{{ include "common.fullname" $ }}
   persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-{{ end }}
+  storageClassName: "{{ include "common.fullname" . }}-data"
+  hostPath:
+    path: {{ .Values.global.persistence.backup.mountPath | default .Values.persistence.backup.mountPath }}/{{ include "common.namespace" . }}/{{ include "common.fullname" . }}
+{{- end -}}
+{{- end -}}
 {{- end -}}
-
index 1f848c3..dd7f381 100644 (file)
 */}}
 {{- if .Values.backup.enabled }}
 {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolumeClaim
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-db-data
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}-backup
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-{{- if .Values.persistence.annotations }}
-  annotations:
-{{ toYaml .Values.persistence.annotations | indent 4 }}
-{{- end }}
-spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}-db-data
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  resources:
-    requests:
-      storage: {{ .Values.persistence.size }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
-  storageClassName: ""
-{{- else }}
-  storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
 ---
 kind: PersistentVolumeClaim
 apiVersion: v1
@@ -61,20 +31,11 @@ metadata:
 {{ toYaml .Values.persistence.annotations | indent 4 }}
 {{- end }}
 spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}-backup-data
   accessModes:
     - {{ .Values.persistence.accessMode }}
   resources:
     requests:
       storage: {{ .Values.persistence.size }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
-  storageClassName: ""
-{{- else }}
-  storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
+  storageClassName: {{ include "common.storageClass" . }}
 {{- end -}}
 {{- end -}}
index 06f41e7..fbbb5ba 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{ if .Values.persistence.enabled }}
-{{- $root := . -}}
-{{ range $i, $e := until (int $root.Values.replicaCount) }}
+{{- $global := . }}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
 ---
 apiVersion: v1
 kind: PersistentVolume
 metadata:
-  name: {{ $root.Release.Name }}-{{ $root.Values.service.name }}-{{ $i }}
-  namespace: {{ $root.Release.Namespace }}
+  name: {{ $global.Release.Name }}-{{ $global.Values.service.name }}-{{ $i }}
+  namespace: {{ $global.Release.Namespace }}
   labels:
-    type: {{ $root.Values.persistence.storageType }}
-    app: {{ $root.Values.service.name }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
+    type: {{ $global.Values.persistence.storageType }}
+    app: {{ $global.Values.service.name }}
+    chart: {{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}
+    release: {{ $global.Release.Name }}
+    heritage: {{ $global.Release.Service }}
 spec:
   capacity:
-    storage: {{ $root.Values.persistence.size }}
+    storage: {{ $global.Values.persistence.size }}
   accessModes:
-    - {{ $root.Values.persistence.accessMode }}
+  {{- if $global.Values.backup.enabled }}
+  - ReadWriteMany
+  {{- else }}
+  - ReadWriteOnce
+  {{- end }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data"
   hostPath:
-    path: {{ $root.Values.persistence.mountPath }}/{{ $root.Release.Name }}/{{ $root.Values.persistence.mountSubPath }}-{{ $i }}
-  persistentVolumeReclaimPolicy: {{ $root.Values.persistence.volumeReclaimPolicy }}
-{{ end }}
-{{ end }}
+    path: {{ $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }}
+{{- end -}}
+{{- end -}}
+{{- end -}}
index 4be3570..72e886d 100644 (file)
@@ -49,7 +49,7 @@ spec:
         - containerPort: {{ $ports.port }}
         {{- end }}
         volumeMounts:
-          - name: cassandra-data
+          - name: {{ include "common.fullname" . }}-data
             mountPath: /var/lib/cassandra
           - name: localtime
             mountPath: /etc/localtime
@@ -151,25 +151,26 @@ spec:
           name: {{ include "common.fullname" . }}-entrypoint
           defaultMode: 0755
   {{- if not .Values.persistence.enabled }}
-      - name: cassandra-data
+      - name: {{ include "common.fullname" . }}-data
         emptyDir: {}
   {{- else }}
   volumeClaimTemplates:
     - metadata:
-        name: cassandra-data
+        name: {{ include "common.fullname" . }}-data
         labels:
-          app: {{ template "common.fullname" . }}
+          name: {{ include "common.fullname" . }}
+          chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
           release: "{{ .Release.Name }}"
           heritage: "{{ .Release.Service }}"
-      annotations:
-        volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }}
       spec:
         accessModes:
-          - {{ .Values.persistence.accessMode | quote }}
+        {{- if .Values.backup.enabled }}
+        - ReadWriteMany
+        {{- else }}
+        - ReadWriteOnce
+        {{- end }}
+        storageClassName: {{ include "common.storageClass" . }}
         resources:
           requests:
             storage: {{ .Values.persistence.size | quote }}
-        selector:
-          matchLabels:
-            release: "{{ .Release.Name }}"
   {{- end }}
index e568996..c3af7e5 100644 (file)
@@ -115,12 +115,12 @@ persistence:
   ##   GKE, AWS & OpenStack)
   ##
   ## storageClass: "-"
-  accessMode: ReadWriteOnce
+  ## Not set as it depends of the backup enabledment or not.
+  #accessMode: ReadWriteOnce
   size: 2Gi
   mountPath: /dockerdata-nfs
   mountSubPath: cassandra
   storageType: local
-  storageClass: ""
   backup:
       mountPath: /dockerdata-nfs/backup
 
index 65993e5..da8dfb8 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{ if .Values.persistence.enabled }}
-{{- $root := . -}}
-{{ range $i, $e := until (int $root.Values.replicaCount) }}
+{{- $global := . }}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
 ---
 apiVersion: v1
 kind: PersistentVolume
 metadata:
-  name: {{ include "common.fullname" $root }}-data-{{ $i }}
-  namespace: {{ $root.Release.Namespace }}
+  name: {{ include "common.fullname" $global }}-data-{{ $i }}
+  namespace: {{ include "common.namespace" $global }}
   labels:
-    type: {{ $root.Values.persistence.storageType }}
-    app: {{ include "common.fullname" $root }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
+    app: {{ include "common.fullname" $global }}
+    chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}"
+    release: "{{ $global.Release.Name }}"
+    heritage: "{{ $global.Release.Service }}"
+    name: {{ include "common.fullname" $global }}
 spec:
   capacity:
-    storage: {{ $root.Values.persistence.storage }}
+    storage: {{ $global.Values.persistence.storage }}
   accessModes:
-    - {{ $root.Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" $root }}-data"
+    - {{ $global.Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data"
   hostPath:
-    path: {{ $root.Values.persistence.mountPath }}/{{ $root.Release.Name }}/{{ $root.Values.persistence.mountSubPath }}-{{ $i }}
-  persistentVolumeReclaimPolicy: {{ $root.Values.persistence.volumeReclaimPolicy }}
-{{ end }}
-{{ end }}
-
+    path: {{ $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
index 7190c5b..cef1a48 100644 (file)
@@ -213,14 +213,19 @@ spec:
   volumeClaimTemplates:
   - metadata:
       name: {{ include "common.fullname" . }}-data
+      labels:
+        name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
     spec:
       accessModes:
-        - "{{ .Values.persistence.accessMode }}"
+      - "{{ .Values.persistence.accessMode }}"
+      storageClassName: {{ include "common.storageClass" . }}
       resources:
         requests:
           # upstream recommended max is 700M
           storage: "{{ .Values.persistence.storage }}"
-      storageClassName: {{ include "common.fullname" . }}-data
   {{- else }}
       volumes:
       - name: {{ include "common.fullname" . }}-data
@@ -231,4 +236,3 @@ spec:
         emptyDir: {}
       {{- end }}
   {{- end }}
-
index 7f53d22..d994f87 100644 (file)
@@ -45,7 +45,7 @@ liveness:
   enabled: true
 
 persistence:
-  enabled: false
+  enabled: true
   ## etcd data Persistent Volume Storage Class
   ## If defined, storageClassName: <storageClass>
   ## If set to "-", storageClassName: "", which disables dynamic provisioning
@@ -79,4 +79,3 @@ tolerations: []
 affinity: {}
 extraEnv: []
 resources: {}
-
index 7d3ec75..a5f1578 100644 (file)
@@ -91,10 +91,8 @@ spec:
                   name: {{ include "common.fullname" . }}
                   key: db-root-password
             volumeMounts:
-            - name: backup-data
+            - name: backup-dir
               mountPath: /backup
-            - name: db-data
-              mountPath: /var/lib/mysql
           containers:
           - name: mariadb-backup-validate
             image: "{{ include "common.repository" . }}/{{ .Values.backupImage }}"
@@ -130,7 +128,7 @@ spec:
                 remove_dir $target_dir
                 exit 0
               fi
-              
+
               /docker-entrypoint.sh mysqld &
 
               count=0
@@ -163,16 +161,13 @@ spec:
             - mountPath: /etc/localtime
               name: localtime
               readOnly: true
-            - name: backup-data
+            - name: backup-dir
               mountPath: /backup
           volumes:
           - name: localtime
             hostPath:
               path: /etc/localtime
-          - name: db-data
-            persistentVolumeClaim:
-              claimName: {{ include "common.fullname" . }}-db-data
-          - name: backup-data
+          - name: backup-dir
             persistentVolumeClaim:
-              claimName: {{ include "common.fullname" . }}-backup 
+              claimName: {{ include "common.fullname" . }}-backup-data
 {{- end }}
index 2972191..ec6f44d 100644 (file)
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2019 Amdocs, Bell Canada
+# Copyright © 2019 Amdocs, Bell Canada, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 */}}
 {{- if .Values.backup.enabled }}
 {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-backup
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}-backup
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size}}
-  accessModes:
-  - {{ .Values.persistence.accessMode }}
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.global.persistence.backup.mountPath | default .Values.persistence.backup.mountPath }}/{{ include "common.namespace" . }}/{{include "common.name" . }}
+{{- if eq "True" (include "common.needPV" .) -}}
 ---
-kind: PersistentVolume
 apiVersion: v1
+kind: PersistentVolume
 metadata:
-  name: {{ include "common.fullname" . }}-db-data
+  name: {{ include "common.fullname" . }}-backup-data
   namespace: {{ include "common.namespace" . }}
   labels:
     app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}-db-data
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    heritage: {{ .Release.Service }}
+    name: {{ include "common.fullname" . }}-backup-data
 spec:
   capacity:
-    storage: {{ .Values.persistence.size}}
+    storage: {{ .Values.persistence.size }}
   accessModes:
   - {{ .Values.persistence.accessMode }}
   persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" . }}-data-backup"
   hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}{{ sub .Values.replicaCount 1 }}
+    path: {{ .Values.global.persistence.backup.mountPath | default .Values.persistence.backup.mountPath }}/{{ include "common.namespace" $ }}/{{ include "common.fullname" $ }}
+{{- end -}}
 {{- end -}}
 {{- end -}}
-
index a983c8a..06b590c 100644 (file)
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2019 Amdocs, Bell Canada
+# Copyright © 2019 Amdocs, Bell Canada, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 */}}
 {{- if .Values.backup.enabled }}
 {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolumeClaim
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-backup
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}-backup
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-{{- if .Values.persistence.annotations }}
-  annotations:
-{{ toYaml .Values.persistence.annotations | indent 4 }}
-{{- end }}
-spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}-backup
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  resources:
-    requests:
-      storage: {{ .Values.persistence.size }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
-  storageClassName: ""
-{{- else }}
-  storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
 ---
 kind: PersistentVolumeClaim
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" . }}-db-data
+  name: {{ include "common.fullname" . }}-backup-data
   namespace: {{ include "common.namespace" . }}
   labels:
-    app: {{ include "common.name" . }}-db-data
+    app: {{ include "common.name" . }}-backup
     chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
     release: "{{ .Release.Name }}"
     heritage: "{{ .Release.Service }}"
@@ -61,21 +31,15 @@ metadata:
 {{ toYaml .Values.persistence.annotations | indent 4 }}
 {{- end }}
 spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}-db-data
   accessModes:
     - {{ .Values.persistence.accessMode }}
   resources:
     requests:
       storage: {{ .Values.persistence.size }}
-{{- if .Values.persistence.storageClass }}
-{{- if (eq "-" .Values.persistence.storageClass) }}
-  storageClassName: ""
+{{- if eq "True" (include "common.needPV" .) -}}
+  storageClassName: "{{ include "common.fullname" . }}-data-backup"
 {{- else }}
-  storageClassName: "{{ .Values.persistence.storageClass }}"
-{{- end }}
-{{- end }}
+  storageClassName: {{ include "common.storageClass" . }}
+{{- end -}}
 {{- end -}}
 {{- end -}}
-
index 96bd94e..795ad31 100644 (file)
@@ -20,7 +20,7 @@
 kind: PersistentVolume
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" $global }}-data-{{$i}}
+  name: {{ include "common.fullname" $global }}-data-{{ $i }}
   namespace: {{ include "common.namespace" $global }}
   labels:
     app: {{ include "common.fullname" $global }}
index 2e77036..c3cb4aa 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright © 2018 Amdocs, Bell Canada
+# Copyright © 2019 Amdocs, Bell Canada, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ spec:
           - mountPath: /var/lib/mysql
             name: {{ include "common.fullname" . }}-data
       initContainers:
-        - name: mariadb-galera-prepare
+        - name: {{ include "common.name" . }}-prepare
           image: "{{ include "common.repository" . }}/{{ .Values.imageInit }}"
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy | quote}}
           command: ["sh", "-c", "chown -R 27:27 /var/lib/mysql"]
diff --git a/kubernetes/common/mongo/templates/nfs-provisoner.yaml b/kubernetes/common/mongo/templates/nfs-provisoner.yaml
deleted file mode 100644 (file)
index 355ad38..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{ if not .Values.disableNfsProvisioner }}
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
-  name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  #replicas: {{ .Values.replicaCount }}
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      labels:
-        app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-        release: {{ .Release.Name }}
-    spec:
-      containers:
-        - name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-          image: "{{ .Values.global.nfsprovisionerRepository | default .Values.nfsprovisionerRepository }}/{{ .Values.nfsprovisionerImage }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          ports:
-            - name: nfs
-              containerPort: {{ .Values.service.nfsPort }}
-            - name: mountd
-              containerPort: {{ .Values.service.mountdPort }}
-            - name: rpcbind
-              containerPort: {{ .Values.service.rpcbindPort }}
-            - name: rpcbind-udp
-              containerPort: {{ .Values.service.rpcbindUdpPort }}
-              protocol: UDP
-          securityContext:
-            capabilities:
-              add:
-                - DAC_READ_SEARCH
-                - SYS_RESOURCE
-          args:
-            - "-provisioner={{ include "common.fullname" . }}/nfs"
-          env:
-            - name: POD_IP
-              valueFrom:
-                fieldRef:
-                  fieldPath: status.podIP
-            - name: SERVICE_NAME
-              value: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-            - name: POD_NAMESPACE
-              valueFrom:
-                fieldRef:
-                  fieldPath: metadata.namespace
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          volumeMounts:
-            - name: export-volume
-              mountPath: /export
-      volumes:
-        - name: export-volume
-          hostPath:
-            path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
-{{ end }}
index 824dcbb..edc50ae 100644 (file)
 # limitations under the License.
 */}}
 
-{{- if (and (and (.Values.persistence.enabled) (not .Values.persistence.existingClaim)) ( .Values.disableNfsProvisioner)) -}}
+{{- $global := . }}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
 kind: PersistentVolume
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" . }}-data
-  namespace: {{ include "common.namespace" . }}
+  name: {{ include "common.fullname" $global }}-data-{{ $i }}
+  namespace: {{ include "common.namespace" $global }}
   labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
+    app: {{ include "common.fullname" $global }}
+    chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}"
+    release: "{{ $global.Release.Name }}"
+    heritage: "{{ $global.Release.Service }}"
+    name: {{ include "common.fullname" $global }}
 spec:
   capacity:
-    storage: {{ .Values.persistence.size}}
+    storage: {{ $global.Values.persistence.size}}
   accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-data"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+    - {{ $global.Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data"
   hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
 {{- end -}}
diff --git a/kubernetes/common/mongo/templates/pvc.yaml b/kubernetes/common/mongo/templates/pvc.yaml
deleted file mode 100644 (file)
index 372c106..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-kind: PersistentVolumeClaim
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-data
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
-{{- if .Values.persistence.annotations }}
-  annotations:
-{{ toYaml .Values.persistence.annotations | indent 4 }}
-{{- end }}
-spec:
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  resources:
-    requests:
-      storage: {{ .Values.persistence.size }}
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}
-  storageClassName: "{{ include "common.fullname" . }}-data"
-{{- end -}}
index df55854..d59243f 100644 (file)
@@ -32,29 +32,6 @@ spec:
     app: {{ include "common.name" . }}
     release: {{ .Release.Name }}
   clusterIP: None
-#{{ if not .Values.disableNfsProvisioner }}
----
-kind: Service
-apiVersion: v1
-metadata:
-  name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-spec:
-  ports:
-    - name: nfs
-      port: {{ .Values.service.nfsPort }}
-    - name: mountd
-      port: {{ .Values.service.mountdPort }}
-    - name: rpcbind
-      port: {{ .Values.service.rpcbindPort }}
-    - name: rpcbind-udp
-      port: {{ .Values.service.rpcbindUdpPort }}
-      protocol: UDP
-  selector:
-    app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-#{{ end }}
 ---
 # Client service for connecting to any Mongo instance for reads.
 apiVersion: v1
index c79739f..0c6c9f4 100644 (file)
@@ -33,24 +33,6 @@ spec:
         app: {{ include "common.name" . }}
         release: {{ .Release.Name }}
     spec:
-      initContainers:
-#{{ if not .Values.disableNfsProvisioner }}
-      - name: {{ include "common.name" . }}-readiness
-        command:
-        - /root/ready.py
-        args:
-        - --container-name
-        - {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-        env:
-        - name: NAMESPACE
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-#{{ end }}
-
       containers:
         - name: {{ include "common.name" . }}
           image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
@@ -79,8 +61,8 @@ spec:
             initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
             periodSeconds: {{ .Values.readiness.periodSeconds }}
           volumeMounts:
-          - mountPath: /var/lib/mongo
-            name: {{ include "common.fullname" . }}-data
+          - name: {{ include "common.fullname" . }}-data
+            mountPath: /var/lib/mongo
           resources:
 {{ include "common.resources" . | indent 12 }}
         {{- if .Values.nodeSelector }}
@@ -95,10 +77,24 @@ spec:
       - name: localtime
         hostPath:
           path: /etc/localtime
+  {{- if .Values.persistence.enabled }}
+  volumeClaimTemplates:
+  - metadata:
+      name: {{ include "common.fullname" . }}-data
+      labels:
+        name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
+    spec:
+      accessModes:
+      - {{ .Values.persistence.accessMode | quote }}
+      storageClassName: {{ include "common.storageClass" . }}
+      resources:
+        requests:
+          storage: {{ .Values.persistence.size | quote }}
+  {{- else }}
+      volumes:
       - name: {{ include "common.fullname" . }}-data
-#{{ if .Values.persistence.enabled }}
-        persistentVolumeClaim:
-          claimName: {{ include "common.fullname" . }}-data
-#{{ else }}
         emptyDir: {}
-#{{ end }}
+  {{- end }}
diff --git a/kubernetes/common/mongo/templates/storageclass.yaml b/kubernetes/common/mongo/templates/storageclass.yaml
deleted file mode 100644 (file)
index 3cd502e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{ if not .Values.disableNfsProvisioner }}
-kind: StorageClass
-apiVersion: storage.k8s.io/v1
-metadata:
-  name: "{{ include "common.fullname" . }}-data"
-  namespace: {{ include "common.namespace" . }}
-provisioner: {{ include "common.fullname" . }}/nfs
-{{ end }}
index 8a68129..3c04b42 100644 (file)
@@ -40,8 +40,6 @@ nodeSelector: {}
 
 affinity: {}
 
-disableNfsProvisioner: true
-
 # probe configuration parameters
 liveness:
   initialDelaySeconds: 30
@@ -108,11 +106,6 @@ resources: {}
 #    cpu: 2
 #    memory: 4Gi
 
-
-nfsprovisionerRepository: quay.io
-nfsprovisionerImage: kubernetes_incubator/nfs-provisioner:v1.0.8
-nfsprovisionerPrefix: mongo
-
 sdnctlPrefix: mongo
 
 geoEnabled: false
diff --git a/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml b/kubernetes/common/music/charts/music-cassandra/templates/pv.yaml
new file mode 100644 (file)
index 0000000..fb81540
--- /dev/null
@@ -0,0 +1,46 @@
+{{/*
+# Copyright © 2018  AT&T, Amdocs, Bell Canada Intellectual Property.  All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+
+{{- $global := . }}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+  name: {{ include "common.fullname" $global }}-data-{{ $i }}
+  namespace: {{ include "common.namespace" $global }}
+  labels:
+    app: {{ include "common.fullname" $global }}
+    chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}"
+    release: "{{ $global.Release.Name }}"
+    heritage: "{{ $global.Release.Service }}"
+    name: {{ include "common.fullname" $global }}
+spec:
+  capacity:
+    storage: {{ $global.Values.persistence.size}}
+  accessModes:
+    - {{ $global.Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data"
+  hostPath:
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
index 514bccc..c3c56f2 100644 (file)
@@ -1,5 +1,5 @@
 {{/*
-# Copyright © 2018  AT&T, Amdocs, Bell Canada Intellectual Property.  All rights reserved.
+# Copyright © 2019 AT&T, Amdocs, Bell Canada, Orange
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -102,40 +102,33 @@ spec:
             valueFrom:
               fieldRef:
                 fieldPath: status.podIP
+{{- if .Values.persistence.enabled }}
         volumeMounts:
-          - name: {{ template "common.name" . }}-data
+          - name: {{ include "common.fullname" . }}-data
             mountPath: /var/lib/cassandra
+{{- end }}
         resources:
 {{ include "common.resources" . | indent 12 }}
       volumes:
       - name: localtime
         hostPath:
           path: /etc/localtime
-  {{- if not .Values.persistence.enabled }}
-      - name: {{ template "common.name" . }}-data
-        emptyDir: {}
-  {{- else }}
+{{- if .Values.persistence.enabled }}
   volumeClaimTemplates:
-    - metadata:
-        name: {{ template "common.name" . }}-data
-        labels:
-          app: {{ template "common.fullname" . }}
-          chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-          release: "{{ .Release.Name }}"
-          heritage: "{{ .Release.Service }}"
-      annotations:
-        volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }}
-      spec:
-        storageClassName: {{ .Values.persistence.storageClass }}
-        accessModes:
-          - {{ .Values.persistence.accessMode | quote }}
-        resources:
-          requests:
-            storage: {{ .Values.persistence.size | quote }}
-        selector:
-          matchLabels:
-            app: {{ include "common.name" . }}
-            release: "{{ .Release.Name }}"
-  {{- end }}
+  - metadata:
+      name: {{ include "common.fullname" . }}-data
+      labels:
+        name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
+    spec:
+      accessModes:
+      - {{ .Values.persistence.accessMode | quote }}
+      storageClassName: {{ include "common.storageClass" . }}
+      resources:
+        requests:
+          storage: {{ .Values.persistence.size | quote }}
+{{- end }}
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
diff --git a/kubernetes/common/music/charts/music-cassandra/templates/volumes.yaml b/kubernetes/common/music/charts/music-cassandra/templates/volumes.yaml
deleted file mode 100644 (file)
index 83e7e18..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-{{/*
-# Copyright © 2018  AT&T, Amdocs, Bell Canada Intellectual Property.  All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{ if .Values.persistence.enabled }}
-{{- $root := . -}}
-{{ range $i, $e := until (atoi (quote $root.Values.replicaCount) | default 3) }}
----
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: {{ $root.Release.Name }}-{{ $root.Values.service.name }}-{{ $i }}
-  namespace: {{ $root.Release.Namespace }}
-  labels:
-    type: {{ $root.Values.persistence.storageType }}
-    app: {{ $root.Values.service.name }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
-spec:
-  capacity:
-    storage: {{ $root.Values.persistence.size }}
-  accessModes:
-    - {{ $root.Values.persistence.accessMode }}
-  hostPath:
-    path: {{ $root.Values.persistence.mountPath }}/{{ $root.Release.Name }}/{{ $root.Values.persistence.mountSubPath }}-{{$i}}
-  persistentVolumeReclaimPolicy: {{ $root.Values.persistence.volumeReclaimPolicy }}
-  podAntiAffinity:
-    preferredDuringSchedulingIgnoredDuringExecution:
-    - weight: 1
-      podAffinityTerm:
-        labelSelector:
-          matchExpressions:
-            - key: app
-              operator: In
-              values:
-              - "{{ $root.Chart.Name }}"
-        topologyKey: kubernetes.io/hostname
-{{ end }}
-{{ end }}
index f0888c1..460671d 100644 (file)
@@ -107,8 +107,6 @@ persistence:
   size: 2Gi
   mountPath: /dockerdata-nfs/
   mountSubPath: common/cassandra/data
-  storageType: local
-  storageClass: ""
 
 # Resource Limit flavor -By Default using small
 flavor: small
diff --git a/kubernetes/common/music/charts/zookeeper/templates/pv.yaml b/kubernetes/common/music/charts/zookeeper/templates/pv.yaml
new file mode 100644 (file)
index 0000000..795ad31
--- /dev/null
@@ -0,0 +1,45 @@
+{{/*
+# Copyright © 2019 Amdocs, Bell Canada, Orange
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+*/}}
+{{- $global := . }}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
+kind: PersistentVolume
+apiVersion: v1
+metadata:
+  name: {{ include "common.fullname" $global }}-data-{{ $i }}
+  namespace: {{ include "common.namespace" $global }}
+  labels:
+    app: {{ include "common.fullname" $global }}
+    chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}"
+    release: "{{ $global.Release.Name }}"
+    heritage: "{{ $global.Release.Service }}"
+    name: {{ include "common.fullname" $global }}
+spec:
+  capacity:
+    storage: {{ $global.Values.persistence.size}}
+  accessModes:
+    - {{ $global.Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data"
+  hostPath:
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
index 9e3549f..580042d 100644 (file)
@@ -82,7 +82,7 @@ spec:
           resources:
 {{ include "common.resources" . }}
           volumeMounts:
-            - name: zookeeper-data
+            - name: {{ include "common.fullname" . }}-data
               mountPath: /var/lib/zookeeper
 
 {{- if .Values.exporters.jmx.enabled }}
@@ -162,30 +162,21 @@ spec:
           configMap:
             name: {{ .Release.Name }}-jmx-exporter
         {{- end }}
-        {{- if not .Values.persistence.enabled }}
-        - name: zookeeper-data
-          emptyDir: {}
-        {{- end }}
       {{- end }}
   {{- if .Values.persistence.enabled }}
   volumeClaimTemplates:
-    - metadata:
-        name: zookeeper-data
-        labels:
-          app: {{ .Chart.Name }}
-          chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-          release: "{{ .Release.Name }}"
-          heritage: "{{ .Release.Service }}"
-      annotations:
-        volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }}
-      spec:
-        storageClassName: {{ .Values.persistence.storageClass }}
-        accessModes:
-          - {{ .Values.persistence.accessMode | quote }}
-        resources:
-          requests:
-            storage: {{ .Values.persistence.size | quote }}
-        selector:
-          matchLabels:
-            release: "{{ .Release.Name }}"
+  - metadata:
+      name: {{ include "common.fullname" . }}-data
+      labels:
+        name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
+    spec:
+      accessModes:
+      - {{ .Values.persistence.accessMode | quote }}
+      storageClassName: {{ include "common.storageClass" . }}
+      resources:
+        requests:
+          storage: {{ .Values.persistence.size | quote }}
   {{- end }}
diff --git a/kubernetes/common/music/charts/zookeeper/templates/volumes.yaml b/kubernetes/common/music/charts/zookeeper/templates/volumes.yaml
deleted file mode 100644 (file)
index b0c05fd..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-{{ if .Values.persistence.enabled }}
-{{- $root := . -}}
-{{ range $i, $e := until (atoi (quote $root.Values.replicaCount) | default 3) }}
----
-apiVersion: v1
-kind: PersistentVolume
-metadata:
-  name: {{ $root.Release.Name }}-{{ $root.Values.service.name }}-{{ $i }}
-  namespace: {{ $root.Release.Namespace }}
-  labels:
-    type: {{ $root.Values.persistence.storageType }}
-    app: {{ $root.Values.service.name }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
-spec:
-  capacity:
-    storage: {{ $root.Values.persistence.size }}
-  accessModes:
-    - {{ $root.Values.persistence.accessMode }}
-  hostPath:
-    path: {{ $root.Values.persistence.mountPath }}/{{ $root.Release.Name }}/{{ $root.Values.persistence.mountSubPath }}-{{$i}}
-  persistentVolumeReclaimPolicy: {{ $root.Values.persistence.volumeReclaimPolicy }}
-{{ end }}
-{{ end }}
index 550dbf2..28c9711 100644 (file)
@@ -119,8 +119,6 @@ persistence:
   accessMode: ReadWriteOnce
   mountPath: /dockerdata-nfs
   mountSubPath: music/zookeeper
-  storageType: local
-  storageClass: ""
   size: 4Gi
 
 ## Exporters query apps for metrics and make those metrics available for
diff --git a/kubernetes/common/mysql/.helmignore b/kubernetes/common/mysql/.helmignore
deleted file mode 100644 (file)
index f0c1319..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Patterns to ignore when building packages.
-# This supports shell glob matching, relative path matching, and
-# negation (prefixed with !). Only one pattern per line.
-.DS_Store
-# Common VCS dirs
-.git/
-.gitignore
-.bzr/
-.bzrignore
-.hg/
-.hgignore
-.svn/
-# Common backup files
-*.swp
-*.bak
-*.tmp
-*~
-# Various IDEs
-.project
-.idea/
-*.tmproj
diff --git a/kubernetes/common/mysql/Chart.yaml b/kubernetes/common/mysql/Chart.yaml
deleted file mode 100644 (file)
index 7f27229..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-apiVersion: v1
-description: MySQL Server
-name: mysql
-version: 5.0.0
diff --git a/kubernetes/common/mysql/requirements.yaml b/kubernetes/common/mysql/requirements.yaml
deleted file mode 100644 (file)
index 79d7de4..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-dependencies:
-  - name: common
-    version: ~5.x-0
-    repository: '@local'
diff --git a/kubernetes/common/mysql/templates/configmap.yaml b/kubernetes/common/mysql/templates/configmap.yaml
deleted file mode 100644 (file)
index 65ac5f2..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ include "common.fullname" . }}-db-configmap
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-data:
-  master.cnf: |
-    # Apply this config only on the master.
-    [mysqld]
-    sql_mode = "NO_ENGINE_SUBSTITUTION"
-    log-bin
-    [localpathprefix]
-    master
-  slave.cnf: |
-    # Apply this config only on slaves.
-    [mysqld]
-    sql_mode = "NO_ENGINE_SUBSTITUTION"
-    super-read-only
-    [localpathprefix]
-    slave
diff --git a/kubernetes/common/mysql/templates/nfs-provisoner.yaml b/kubernetes/common/mysql/templates/nfs-provisoner.yaml
deleted file mode 100644 (file)
index 355ad38..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{ if not .Values.disableNfsProvisioner }}
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
-  name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  #replicas: {{ .Values.replicaCount }}
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      labels:
-        app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-        release: {{ .Release.Name }}
-    spec:
-      containers:
-        - name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-          image: "{{ .Values.global.nfsprovisionerRepository | default .Values.nfsprovisionerRepository }}/{{ .Values.nfsprovisionerImage }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          ports:
-            - name: nfs
-              containerPort: {{ .Values.service.nfsPort }}
-            - name: mountd
-              containerPort: {{ .Values.service.mountdPort }}
-            - name: rpcbind
-              containerPort: {{ .Values.service.rpcbindPort }}
-            - name: rpcbind-udp
-              containerPort: {{ .Values.service.rpcbindUdpPort }}
-              protocol: UDP
-          securityContext:
-            capabilities:
-              add:
-                - DAC_READ_SEARCH
-                - SYS_RESOURCE
-          args:
-            - "-provisioner={{ include "common.fullname" . }}/nfs"
-          env:
-            - name: POD_IP
-              valueFrom:
-                fieldRef:
-                  fieldPath: status.podIP
-            - name: SERVICE_NAME
-              value: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-            - name: POD_NAMESPACE
-              valueFrom:
-                fieldRef:
-                  fieldPath: metadata.namespace
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          volumeMounts:
-            - name: export-volume
-              mountPath: /export
-      volumes:
-        - name: export-volume
-          hostPath:
-            path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}
-{{ end }}
diff --git a/kubernetes/common/mysql/templates/pv.yaml b/kubernetes/common/mysql/templates/pv.yaml
deleted file mode 100644 (file)
index 3bef651..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{- if (and (and (.Values.persistence.enabled) (not .Values.persistence.existingClaim)) ( .Values.disableNfsProvisioner)) -}}
-{{ $pvNum := default 1 .Values.replicaCount | int }}
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-mysql0
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size}}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-mysql"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}0
-{{ if gt $pvNum 1 }}
----
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-mysql1
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size}}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-mysql"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}1
-{{ end }}
-{{- end -}}
diff --git a/kubernetes/common/mysql/templates/secrets.yaml b/kubernetes/common/mysql/templates/secrets.yaml
deleted file mode 100644 (file)
index 7f9b123..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-apiVersion: v1
-kind: Secret
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-type: Opaque
-data:
-  db-root-password: {{ .Values.config.dbRootPassword | b64enc | quote }}
diff --git a/kubernetes/common/mysql/templates/service.yaml b/kubernetes/common/mysql/templates/service.yaml
deleted file mode 100644 (file)
index e1771c6..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ include "common.servicename" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - port: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.portName }}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
-  clusterIP: None
-#{{ if not .Values.disableNfsProvisioner }}
----
-kind: Service
-apiVersion: v1
-metadata:
-  name: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - name: nfs
-      port: {{ .Values.service.nfsPort }}
-    - name: mountd
-      port: {{ .Values.service.mountdPort }}
-    - name: rpcbind
-      port: {{ .Values.service.rpcbindPort }}
-    - name: rpcbind-udp
-      port: {{ .Values.service.rpcbindUdpPort }}
-      protocol: UDP
-  selector:
-    app: {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-#{{ end }}
----
-# Client service for connecting to any MySQL instance for reads.
-# Only master: sdnc-dbhost-0 accepts the write request.
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ include "common.servicename" . }}-read
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - port: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.portName }}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ .Values.sdnctlPrefix }}-sdnctldb01
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - port: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.portName }}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
-  clusterIP: None
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ .Values.sdnctlPrefix }}-sdnctldb02
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - port: {{ .Values.service.internalPort }}
-      name: {{ .Values.service.portName }}
-  selector:
-    app: {{ include "common.name" . }}
-    release: {{ .Release.Name }}
-  clusterIP: None
----
-{{ if .Values.geoEnabled }}
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ include "common.servicename" . }}-nodeport
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-  - name: {{ .Values.service.portName | default .Values.service.name }}-1
-    port: {{ .Values.service.internalPort }}
-    targetPort: {{ .Values.service.internalPort }}
-    nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodeport1 }}
-  - name: {{ .Values.service.portName | default .Values.service.name }}-2
-    port: {{ .Values.xtrabackup.internalPort }}
-    targetPort: {{ .Values.xtrabackup.internalPort }}
-    nodePort: {{ .Values.global.nodePortPrefix | default .Values.nodePortPrefix }}{{ .Values.service.nodeport2 }}
-  type:  {{ .Values.service.type }}
-  selector:
-    statefulset.kubernetes.io/pod-name: {{ include "common.fullname" . }}-0
-    release: {{ .Release.Name }}
-{{ end }}
diff --git a/kubernetes/common/mysql/templates/statefulset.yaml b/kubernetes/common/mysql/templates/statefulset.yaml
deleted file mode 100644 (file)
index c3f8ae2..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-apiVersion: apps/v1beta1
-kind: StatefulSet
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  serviceName: {{ .Values.service.name }}
-  replicas: {{ .Values.replicaCount }}
-  template:
-    metadata:
-      labels:
-        app: {{ include "common.name" . }}
-        chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-        release: {{ .Release.Name }}
-        heritage: {{ .Release.Service }}
-    spec:
-      initContainers:
-#{{ if not .Values.disableNfsProvisioner }}
-      - name: {{ include "common.name" . }}-readiness
-        command:
-        - /root/ready.py
-        args:
-        - --container-name
-        - {{ .Values.nfsprovisionerPrefix }}-nfs-provisioner
-        env:
-        - name: NAMESPACE
-          valueFrom:
-            fieldRef:
-              apiVersion: v1
-              fieldPath: metadata.namespace
-        image: "{{ .Values.global.readinessRepository }}/{{ .Values.global.readinessImage }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-#{{ end }}
-      - name: init-mysql
-        image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        command:
-        - bash
-        - "-c"
-        - |
-          set -ex
-          # Generate mysql server-id from pod ordinal index.
-          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
-          ordinal=${BASH_REMATCH[1]}
-          siteId={{ .Values.geoSiteId }}
-          echo BASH_REMATCH=${BASH_REMATCH}
-          echo [mysqld] > /mnt/conf.d/server-id.cnf
-          # Add an offset to avoid reserved server-id=0 value.
-          echo server-id=$(($siteId*100 + $ordinal)) >> /mnt/conf.d/server-id.cnf
-          # Copy appropriate conf.d files from config-map to emptyDir.
-          if [[ $ordinal -eq 0 ]]; then
-            cp /mnt/config-map/master.cnf /mnt/conf.d/
-          else
-            cp /mnt/config-map/slave.cnf /mnt/conf.d/
-          fi
-        volumeMounts:
-        - name: conf
-          mountPath: /mnt/conf.d
-        - name: config-map
-          mountPath: /mnt/config-map
-
-      - name: clone-mysql
-        image: "{{ .Values.global.xtrabackupRepository | default .Values.xtrabackupRepository }}/{{ .Values.xtrabackupImage }}"
-        imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        env:
-          - name: MYSQL_ROOT_PASSWORD
-            valueFrom:
-              secretKeyRef:
-                name: {{ template "common.fullname" . }}
-                key: db-root-password
-        command:
-        - bash
-        - "-c"
-        - |
-          set -ex
-          # Skip the clone if data already exists.
-          [[ -d /var/lib/mysql/mysql ]] && exit 0
-          # Skip the clone on master (ordinal index 0).
-          [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
-          ordinal=${BASH_REMATCH[1]}
-          echo ${BASH_REMATCH}
-          [[ $ordinal -eq 0 ]] && exit 0
-          # Clone data from previous peer.
-          ncat --recv-only {{ include "common.fullname" . }}-$(($ordinal-1)).{{ .Values.service.name }}.{{ include "common.namespace" . }} 3307 | xbstream -x -C {{ .Values.persistence.mysqlPath }}
-          # Prepare the backup.
-          xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --prepare --target-dir=/var/lib/mysql
-          ls -l {{ .Values.persistence.mysqlPath }}
-        volumeMounts:
-        - name: {{ include "common.fullname" . }}-mysql
-          mountPath: {{ .Values.persistence.mysqlPath }}
-        - name: conf
-          mountPath: /etc/mysql/conf.d
-
-      containers:
-        - name: {{ include "common.name" . }}
-          image: "{{ .Values.dockerHubRepository }}/{{ .Values.image }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          ports:
-          - containerPort: {{ .Values.service.internalPort }}
-          # disable liveness probe when breakpoints set in debugger
-          # so K8s doesn't restart unresponsive container
-          {{- if eq .Values.liveness.enabled true }}
-          livenessProbe:
-            exec:
-              command: ["mysqladmin", "ping"]
-            initialDelaySeconds: {{ .Values.liveness.initialDelaySeconds }}
-            periodSeconds: {{ .Values.liveness.periodSeconds }}
-            timeoutSeconds: {{ .Values.liveness.timeoutSeconds }}
-          {{end -}}
-          readinessProbe:
-            tcpSocket:
-              port: {{ .Values.service.internalPort }}
-            initialDelaySeconds: {{ .Values.readiness.initialDelaySeconds }}
-            periodSeconds: {{ .Values.readiness.periodSeconds }}
-          env:
-            - name: MYSQL_ROOT_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ template "common.fullname" . }}
-                  key: db-root-password
-            - name: MYSQL_ROOT_HOST
-              value: '%'
-            - name: MYSQL_ALLOW_EMPTY_PASSWORD
-              value: {{ .Values.config.dbAllowEmptyPassword | default "0" | quote }}
-          volumeMounts:
-          - mountPath: {{ .Values.persistence.mysqlPath }}
-            name: {{ include "common.fullname" . }}-mysql
-          - mountPath: /etc/mysql/conf.d
-            name: conf
-          resources:
-{{ include "common.resources" . | indent 12 }}
-        {{- if .Values.nodeSelector }}
-        nodeSelector:
-{{ toYaml .Values.nodeSelector | indent 10 }}
-        {{- end -}}
-        {{- if .Values.affinity }}
-        affinity:
-{{ toYaml .Values.affinity | indent 10 }}
-        {{- end }}
-
-        - name: xtrabackup
-          image: "{{ .Values.global.xtrabackupRepository | default .Values.xtrabackupRepository }}/{{ .Values.xtrabackupImage }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          env:
-            - name: MYSQL_ROOT_PASSWORD
-              valueFrom:
-                secretKeyRef:
-                  name: {{ template "common.fullname" . }}
-                  key: db-root-password
-          ports:
-          - containerPort: {{ .Values.xtrabackup.internalPort }}
-            name: xtrabackup
-          command:
-          - bash
-          - "-c"
-          - |
-            set -ex
-            cd {{ .Values.persistence.mysqlPath }}
-            ls -l
-            # Determine binlog position of cloned data, if any.
-            if [[ -f xtrabackup_slave_info ]]; then
-              echo "Inside xtrabackup_slave_info"
-              # XtraBackup already generated a partial "CHANGE MASTER TO" query
-              # because we're cloning from an existing slave.
-              mv xtrabackup_slave_info change_master_to.sql.in
-              # Ignore xtrabackup_binlog_info in this case (it's useless).
-              rm -f xtrabackup_binlog_info
-            elif [[ -f xtrabackup_binlog_info ]]; then
-              echo "Inside xtrabackup_binlog_info"
-              # We're cloning directly from master. Parse binlog position.
-              [[ `cat xtrabackup_binlog_info` =~ ^(.*?)[[:space:]]+(.*?)$ ]] || exit 1
-              rm xtrabackup_binlog_info
-              echo "CHANGE MASTER TO MASTER_LOG_FILE='${BASH_REMATCH[1]}',\
-                    MASTER_LOG_POS=${BASH_REMATCH[2]}" > change_master_to.sql.in
-            fi
-
-            [[ `hostname` =~ -([0-9]+)$ ]] || exit 1
-            ordinal=${BASH_REMATCH[1]}
-            echo $ordinal
-
-            mysqlhost={{ include "common.fullname" . }}-$(($ordinal)).{{ .Values.service.name }}.{{ include "common.namespace" . }}
-            echo $mysqlhost
-
-            # Check if we need to complete a clone by starting replication.
-            if [[ -f change_master_to.sql.in ]]; then
-              echo "Waiting for mysqld to be ready (accepting connections)"
-              until mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h $mysqlhost -e "SELECT 1"; do sleep 1; done
-
-              echo "Initializing replication from clone position"
-              # In case of container restart, attempt this at-most-once.
-              mv change_master_to.sql.in change_master_to.sql.orig
-              mysql --user=root --password=$MYSQL_ROOT_PASSWORD -h $mysqlhost <<EOF
-            $(<change_master_to.sql.orig),
-              MASTER_HOST="{{ include "common.fullname" . }}-0.{{ .Values.service.name }}.{{ include "common.namespace" . }}",
-              MASTER_USER="root",
-              MASTER_PASSWORD="$MYSQL_ROOT_PASSWORD",
-              MASTER_CONNECT_RETRY=10;
-            START SLAVE;
-            EOF
-            fi
-
-            # Start a server to send backups when requested by peers.
-            exec ncat --listen --keep-open --send-only --max-conns=1 3307 -c \
-              "xtrabackup --user=root --password=$MYSQL_ROOT_PASSWORD --backup --slave-info --stream=xbstream --host=$mysqlhost"
-          volumeMounts:
-          - name: {{ include "common.fullname" . }}-mysql
-            mountPath: {{ .Values.persistence.mysqlPath }}
-          - name: conf
-            mountPath: /etc/mysql/conf.d
-      volumes:
-      - name: conf
-        emptyDir: {}
-      - name: config-map
-        configMap:
-          name: {{ include "common.fullname" . }}-db-configmap
-      - name: localtime
-        hostPath:
-          path: /etc/localtime
-      - name: {{ include "common.fullname" . }}-mysql
-  {{ if not .Values.persistence.enabled }}
-      - name: {{ include "common.fullname" . }}-mysql
-        emptyDir: {}
-  {{ else }}
-  volumeClaimTemplates:
-  - metadata:
-      name: {{ include "common.fullname" . }}-mysql
-      labels:
-        app: {{ include "common.name" . }}
-        chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-        release: {{ .Release.Name }}
-        heritage: {{ .Release.Service }}
-        name: {{ include "common.fullname" . }}
-    spec:
-      accessModes: [ {{ .Values.persistence.accessMode }} ]
-      storageClassName: {{ include "common.fullname" . }}-mysql
-      resources:
-        requests:
-          storage: {{ .Values.persistence.size }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}
-  {{ end }}
diff --git a/kubernetes/common/mysql/templates/storageclass.yaml b/kubernetes/common/mysql/templates/storageclass.yaml
deleted file mode 100644 (file)
index bbe4562..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-{{/*
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-{{ if not .Values.disableNfsProvisioner }}
-kind: StorageClass
-apiVersion: storage.k8s.io/v1
-metadata:
-  name: "{{ include "common.fullname" . }}-mysql"
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-provisioner: {{ include "common.fullname" . }}/nfs
-{{ end }}
diff --git a/kubernetes/common/mysql/values.yaml b/kubernetes/common/mysql/values.yaml
deleted file mode 100644 (file)
index 9fd67fc..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-# Copyright © 2017 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#################################################################
-# Global configuration defaults.
-#################################################################
-global:
-  nodePortPrefix: 302
-  persistence: {}
-  readinessRepository: oomk8s
-  readinessImage: readiness-check:2.0.0
-
-
-#################################################################
-# Application configuration defaults.
-#################################################################
-
-dockerHubRepository: registry.hub.docker.com
-image: library/mysql:5.7
-pullPolicy: Always
-
-# application configuration
-config:
-  dbRootPassword: openECOMP1.0
-
-# default number of instances
-replicaCount: 1
-
-nodeSelector: {}
-
-affinity: {}
-
-disableNfsProvisioner: true
-
-# probe configuration parameters
-liveness:
-  initialDelaySeconds: 30
-  periodSeconds: 10
-  timeoutSeconds: 5
-  # necessary to disable liveness probe when setting breakpoints
-  # in debugger so K8s doesn't restart unresponsive container
-  enabled: true
-
-readiness:
-  initialDelaySeconds: 5
-  periodSeconds: 10
-
-## Persist data to a persitent volume
-persistence:
-  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
-
-  ## database data Persistent Volume Storage Class
-  ## If defined, storageClassName: <storageClass>
-  ## If set to "-", storageClassName: "", which disables dynamic provisioning
-  ## If undefined (the default) or set to null, no storageClassName spec is
-  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
-  ##   GKE, AWS & OpenStack)
-  accessMode: ReadWriteOnce
-  size: 1Gi
-  mountPath: /dockerdata-nfs
-  mountSubPath: "mysql/data"
-  mysqlPath: /var/lib/mysql
-
-service:
-  name: mysql
-  portName: mysql
-  internalPort: 3306
-  # nfs provisioner ports
-  nfsPort: 2049
-  mountdPort: 20048
-  rpcbindPort: 111
-  rpcbindUdpPort: 111
-  type: NodePort
-  nodeport1: 72
-  nodeport2: 73
-
-ingress:
-  enabled: false
-
-resources: {}
-  # We usually recommend not to specify default resources and to leave this as a conscious
-  # choice for the user. This also increases chances charts run on environments with little
-  # resources, such as Minikube. If you do want to specify resources, uncomment the following
-  # lines, adjust them as necessary, and remove the curly braces after 'resources:'.
-  #
-  # Example:
-  # Configure resource requests and limits
-  # ref: http://kubernetes.io/docs/user-guide/compute-resources/
-  # Minimum memory for development is 2 CPU cores and 4GB memory
-  # Minimum memory for production is 4 CPU cores and 8GB memory
-#resources:
-#  limits:
-#    cpu: 2
-#    memory: 4Gi
-#  requests:
-#    cpu: 2
-#    memory: 4Gi
-
-#################################################################
-# Sidecar Configuration.
-#
-# xtrabackup configuration defaults.
-#################################################################
-xtrabackupRepository: gcr.io/google-samples
-xtrabackupImage: xtrabackup:1.0
-xtrabackup:
-  internalPort: 3307
-
-nfsprovisionerRepository: quay.io
-nfsprovisionerImage: kubernetes_incubator/nfs-provisioner:v1.0.8
-nfsprovisionerPrefix: mysql
-
-sdnctlPrefix: mysql
-
-geoEnabled: false
-geoSiteId: 1
diff --git a/kubernetes/common/nfs-provisioner/Chart.yaml b/kubernetes/common/nfs-provisioner/Chart.yaml
deleted file mode 100644 (file)
index ad16ed7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright © 2019 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-apiVersion: v1
-description: NFS provisioner
-name: nfs-provisioner
-version: 5.0.0
diff --git a/kubernetes/common/nfs-provisioner/requirements.yaml b/kubernetes/common/nfs-provisioner/requirements.yaml
deleted file mode 100644 (file)
index 542c262..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright © 2019 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-dependencies:
-  - name: common
-    version: ~5.x-0
-    repository: '@local'
diff --git a/kubernetes/common/nfs-provisioner/templates/nfs-provisoner.yaml b/kubernetes/common/nfs-provisioner/templates/nfs-provisoner.yaml
deleted file mode 100644 (file)
index 58cf7a3..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-{{/*
-# Copyright © 2019 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-apiVersion: extensions/v1beta1
-kind: Deployment
-metadata:
-  name: {{ include "common.fullname" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.name" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  strategy:
-    type: Recreate
-  template:
-    metadata:
-      labels:
-        app: {{ include "common.fullname" . }}
-        release: {{ .Release.Name }}
-    spec:
-      containers:
-        - name: {{ include "common.fullname" . }}
-          image: "{{ .Values.global.nfsprovisionerRepository | default .Values.nfsprovisionerRepository }}/{{ .Values.nfsprovisionerImage }}"
-          imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-          ports:
-            - name: nfs
-              containerPort: {{ .Values.service.nfsPort }}
-            - name: mountd
-              containerPort: {{ .Values.service.mountdPort }}
-            - name: rpcbind
-              containerPort: {{ .Values.service.rpcbindPort }}
-            - name: rpcbind-udp
-              containerPort: {{ .Values.service.rpcbindUdpPort }}
-              protocol: UDP
-          securityContext:
-            capabilities:
-              add:
-                - DAC_READ_SEARCH
-                - SYS_RESOURCE
-          args:
-            - "-provisioner={{ include "common.namespace" . }}/nfs"
-          env:
-            - name: POD_IP
-              valueFrom:
-                fieldRef:
-                  fieldPath: status.podIP
-            - name: SERVICE_NAME
-              value: {{ include "common.servicename" . }}
-            - name: POD_NAMESPACE
-              valueFrom:
-                fieldRef:
-                  fieldPath: metadata.namespace
-          volumeMounts:
-            - name: export-volume
-              mountPath: /export
-      {{- if .Values.affinity }}
-      affinity:
-      {{ toYaml .Values.affinity | indent 8 }}
-      {{- end }}
-      volumes:
-        - name: export-volume
-          hostPath:
-            path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}
diff --git a/kubernetes/common/nfs-provisioner/templates/service.yaml b/kubernetes/common/nfs-provisioner/templates/service.yaml
deleted file mode 100644 (file)
index f9bba0f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-{{/*
-# Copyright © 2019 Amdocs, Bell Canada
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-*/}}
-
-kind: Service
-apiVersion: v1
-metadata:
-  name: {{ include "common.servicename" . }}
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
-    release: {{ .Release.Name }}
-    heritage: {{ .Release.Service }}
-spec:
-  ports:
-    - name: nfs
-      port: {{ .Values.service.nfsPort }}
-    - name: mountd
-      port: {{ .Values.service.mountdPort }}
-    - name: rpcbind
-      port: {{ .Values.service.rpcbindPort }}
-    - name: rpcbind-udp
-      port: {{ .Values.service.rpcbindUdpPort }}
-      protocol: UDP
-  selector:
-    app: {{ include "common.fullname" . }}
\ No newline at end of file
diff --git a/kubernetes/common/nfs-provisioner/values.yaml b/kubernetes/common/nfs-provisioner/values.yaml
deleted file mode 100644 (file)
index 687219d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright © 2019 Amdocs, Bell Canada\r
-#\r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-#\r
-#       http://www.apache.org/licenses/LICENSE-2.0\r
-#\r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-\r
-#################################################################\r
-# Global configuration defaults.\r
-#################################################################\r
-global:\r
-  persistence:\r
-    mountPath: /dockerdata-nfs\r
-\r
-#################################################################\r
-# Application configuration defaults.\r
-#################################################################\r
-\r
-dockerHubRepository: registry.hub.docker.com\r
-pullPolicy: Always\r
-\r
-# default number of instances\r
-\r
-nodeSelector: {}\r
-\r
-affinity: {}\r
-\r
-service:\r
-  name: nfs-provisioner\r
-  nfsPort: 2049\r
-  mountdPort: 20048\r
-  rpcbindPort: 111\r
-  rpcbindUdpPort: 111\r
-\r
-## Persist data to a persitent volume\r
-persistence:\r
-  enabled: true\r
-  mountPath: /dockerdata-nfs\r
-\r
-## NFS provisioner image properties\r
-nfsprovisionerRepository: quay.io\r
-nfsprovisionerImage: kubernetes_incubator/nfs-provisioner:v1.0.8\r
-\r
index 144a3f7..bcd67d7 100644 (file)
 # # See the License for the specific language governing permissions and
 # # limitations under the License.
 */}}
-{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
+{{- $global := . }}
+{{- if and $global.Values.persistence.enabled (not $global.Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{- range $i := until (int $global.Values.replicaCount)}}
 kind: PersistentVolume
 apiVersion: v1
 metadata:
-  name: {{ include "common.fullname" . }}-data0
-  namespace: {{ include "common.namespace" . }}
+  name: {{ include "common.fullname" $global }}-data-{{ $i }}
+  namespace: {{ include "common.namespace" $global }}
   labels:
-    app: {{ include "common.fullname" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
+    app: {{ include "common.fullname" $global }}
+    chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}"
+    release: "{{ $global.Release.Name }}"
+    heritage: "{{ $global.Release.Service }}"
+    name: {{ include "common.fullname" $global }}
 spec:
   capacity:
-    storage: {{ .Values.persistence.size}}
+    storage: {{ $global.Values.persistence.size}}
   accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-data"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
+    - {{ $global.Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data"
   hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}0
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
 ---
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-data1
-  namespace: {{ include "common.namespace" . }}
-  labels:
-    app: {{ include "common.fullname" . }}
-    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
-    release: "{{ .Release.Name }}"
-    heritage: "{{ .Release.Service }}"
-    name: {{ include "common.fullname" . }}
-spec:
-  capacity:
-    storage: {{ .Values.persistence.size}}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-data"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }}1
+{{- end -}}
+{{- end -}}
+{{- end -}}
 {{- end -}}
index db4a256..7c38d1d 100644 (file)
@@ -37,23 +37,13 @@ spec:
         - /bin/sh
         - -c
         - |
-          for i in $(seq 0 $(({{ .Values.replicaCount }}-1))); do
-            if [ ! -d /podroot/data$i ]; then
-              mkdir -p /podroot/data$i;
-              chown 26:26 /podroot/data$i;
-              chmod 700 /podroot/data$i;
-            fi;
-          done
-        env:
-        - name: POD_NAME
-          valueFrom: { fieldRef: { fieldPath: metadata.name } }
-        securityContext:
-          privileged: true
+          chown -R 26:26 /podroot/;
+          chmod 700 /podroot/;
         image: {{ .Values.global.busyboxRepository | default .Values.busyboxRepository }}/{{ .Values.busyboxImage }}
         imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
-        name: init-sysctl
+        name: {{ include "common.name" . }}-prepare
         volumeMounts:
-        - name: {{ include "common.fullname" . }}-init
+        - name: {{ include "common.fullname" . }}-data
           mountPath: /podroot/
       containers:
       - name: {{ include "common.name" . }}
@@ -129,27 +119,25 @@ spec:
       - name: localtime
         hostPath:
           path: /etc/localtime
-      - name: {{ include "common.fullname" . }}-init
-        hostPath:
-          path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountInitPath }}
       - name: {{ include "common.fullname" . }}-backup
         emptyDir: {}
-#{{ if not .Values.persistence.enabled }}
+{{- if not .Values.persistence.enabled }}
       - name: {{ include "common.fullname" . }}-data
         emptyDir: {}
-#{{ else }}
+{{- else }}
   volumeClaimTemplates:
   - metadata:
       name: {{ include "common.fullname" . }}-data
       labels:
         name: {{ include "common.fullname" . }}
+        chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
+        release: "{{ .Release.Name }}"
+        heritage: "{{ .Release.Service }}"
     spec:
-      accessModes: [ {{ .Values.persistence.accessMode }} ]
-      storageClassName: {{ include "common.fullname" . }}-data
+      accessModes:
+      - {{ .Values.persistence.accessMode | quote }}
+      storageClassName: {{ include "common.storageClass" . }}
       resources:
         requests:
-          storage: {{ .Values.persistence.size }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}
-#{{ end }}
+          storage: {{ .Values.persistence.size | quote }}
+{{- end }}
index 70c4721..314622f 100755 (executable)
@@ -92,10 +92,6 @@ dependencies:
     version: ~5.x-0
     repository: '@local'
     condition: nbi.enabled
-  - name: nfs-provisioner
-    version: ~5.x-0
-    repository: '@local'
-    condition: nfs-provisioner.enabled
   - name: pnda
     version: ~5.x-0
     repository: '@local'
index 672ae2e..5ac7978 100755 (executable)
@@ -113,8 +113,6 @@ nbi:
     # openstack configuration
     openStackRegion: "Yolo"
     openStackVNFTenantId: "1234"
-nfs-provisioner:
-  enabled: false
 policy:
   enabled: false
 pomba:
index a9b2b2a..a3050ef 100644 (file)
@@ -21,6 +21,7 @@ global:
   readinessImage: readiness-check:2.0.0
   loggingRepository: docker.elastic.co
   loggingImage: beats/filebeat:5.5.0
+  persistence: {}
 #################################################################
 # Application configuration defaults.
 #################################################################