Merge "[DMaaP] Use global storage templates for PVC"
authorBorislav Glozman <Borislav.Glozman@amdocs.com>
Wed, 18 Dec 2019 11:35:07 +0000 (11:35 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 18 Dec 2019 11:35:07 +0000 (11:35 +0000)
12 files changed:
kubernetes/dmaap/components/dmaap-dr-node/templates/pv-aaf.yaml [new file with mode: 0644]
kubernetes/dmaap/components/dmaap-dr-node/templates/pv-event.yaml [new file with mode: 0644]
kubernetes/dmaap/components/dmaap-dr-node/templates/pv-spool.yaml [new file with mode: 0644]
kubernetes/dmaap/components/dmaap-dr-node/templates/pv.yaml [deleted file]
kubernetes/dmaap/components/dmaap-dr-node/templates/statefulset.yaml
kubernetes/dmaap/components/dmaap-dr-prov/templates/deployment.yaml
kubernetes/dmaap/components/dmaap-dr-prov/templates/pv.yaml
kubernetes/dmaap/components/dmaap-dr-prov/templates/pvc.yaml
kubernetes/dmaap/components/message-router/charts/message-router-kafka/templates/pv.yaml
kubernetes/dmaap/components/message-router/charts/message-router-kafka/templates/statefulset.yaml
kubernetes/dmaap/components/message-router/charts/message-router-zookeeper/templates/pv.yaml
kubernetes/dmaap/components/message-router/charts/message-router-zookeeper/templates/statefulset.yaml

diff --git a/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-aaf.yaml b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-aaf.yaml
new file mode 100644 (file)
index 0000000..9b71b93
--- /dev/null
@@ -0,0 +1,54 @@
+{{/*
+  # ============LICENSE_START=======================================================
+  #  Copyright (C) 2019 Nordix Foundation.
+  # ================================================================================
+  # 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.
+  #
+  # SPDX-License-Identifier: Apache-2.0
+  # ============LICENSE_END=========================================================
+*/}}
+
+
+{{- if .Values.global.aafEnabled }}
+{{- $global := . }}
+{{- if and .Values.persistence.enabled (not .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 }}-aaf-props-{{ $i }}
+  namespace: {{ include "common.namespace" $global }}
+  labels:
+    app: {{ include "common.name" $global }}
+    chart: "{{ $global.Chart.Name }}-{{ $global.Chart.Version | replace "+" "_" }}"
+    release: "{{ $global.Release.Name }}"
+    heritage: "{{ $global.Release.Service }}"
+    name: {{ include "common.fullname" $global }}-aaf-props
+spec:
+  capacity:
+    storage: {{ $global.Values.persistence.aafCredsSize }}
+  accessModes:
+    - {{ $global.Values.persistence.accessMode }}
+  storageClassName: "{{ include "common.fullname" $global }}-data-aaf-props"
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  hostPath:
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.aafCredsMountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
diff --git a/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-event.yaml b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-event.yaml
new file mode 100644 (file)
index 0000000..1dd7302
--- /dev/null
@@ -0,0 +1,51 @@
+{{/*
+  # ============LICENSE_START=======================================================
+  #  Copyright (C) 2019 Nordix Foundation.
+  # ================================================================================
+  # 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.
+  #
+  # SPDX-License-Identifier: Apache-2.0
+  # ============LICENSE_END=========================================================
+*/}}
+
+---
+{{- $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 }}-event-logs-{{ $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 }}-event-logs
+spec:
+  capacity:
+    storage: {{ $global.Values.persistence.eventLogSize}}
+  accessModes:
+    - {{ $global.Values.persistence.accessMode }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+  storageClassName: "{{ include "common.fullname" $global }}-data-event-logs"
+  hostPath:
+    path: {{ $global.Values.global.persistence.mountPath | default $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.eventLogsMountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
diff --git a/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-spool.yaml b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-spool.yaml
new file mode 100644 (file)
index 0000000..5e1c339
--- /dev/null
@@ -0,0 +1,50 @@
+{{/*
+  # ============LICENSE_START=======================================================
+  #  Copyright (C) 2019 Nordix Foundation.
+  # ================================================================================
+  # 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.
+  #
+  # SPDX-License-Identifier: Apache-2.0
+  # ============LICENSE_END=========================================================
+*/}}
+
+{{- $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 }}-spool-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 }}-spool-data
+spec:
+  capacity:
+    storage: {{ $global.Values.persistence.spoolSize}}
+  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.spoolMountSubPath }}-{{$i}}
+{{if ne $i (int $global.Values.replicaCount) }}
+---
+{{- end -}}
+{{- end -}}
+{{- end -}}
+{{- end -}}
diff --git a/kubernetes/dmaap/components/dmaap-dr-node/templates/pv.yaml b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv.yaml
deleted file mode 100644 (file)
index 90a9c2c..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-{{/*
-  # ============LICENSE_START=======================================================
-  #  Copyright (C) 2019 Nordix Foundation.
-  # ================================================================================
-  # 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.
-  #
-  # SPDX-License-Identifier: Apache-2.0
-  # ============LICENSE_END=========================================================
-*/}}
-
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-spool-data-pv
-  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" . }}-spool-data-pv
-spec:
-  capacity:
-    storage: {{ .Values.persistence.spoolSize }}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-spool-data-stcl"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.spoolMountSubPath }}
----
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-event-logs-pv
-  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" . }}-event-logs-pv
-spec:
-  capacity:
-    storage: {{ .Values.persistence.eventLogSize }}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-event-logs-stcl"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.eventLogsMountSubPath }}
----
-{{- if .Values.global.aafEnabled }}
-kind: PersistentVolume
-apiVersion: v1
-metadata:
-  name: {{ include "common.fullname" . }}-aaf-props-pv
-  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" . }}-aaf-props-pv
-spec:
-  capacity:
-    storage: {{ .Values.persistence.aafCredsSize }}
-  accessModes:
-    - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-aaf-props-stcl"
-  persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
-  hostPath:
-    path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.aafCredsMountSubPath }}
-{{ end -}}
\ No newline at end of file
index 9dd5f20..7ab2f83 100644 (file)
@@ -51,7 +51,7 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           volumeMounts:
           - mountPath: {{ .Values.persistence.aafCredsPath }}
-            name: {{ include "common.fullname" . }}-aaf-props-pvc
+            name: {{ include "common.fullname" . }}-aaf-props
           command: ["bash","-c","exec /opt/app/aaf_config/bin/agent.sh"]
           env:
           - name: APP_FQI
@@ -82,12 +82,12 @@ spec:
           imagePullPolicy: {{ .Values.global.pullPolicy | default .Values.pullPolicy }}
           volumeMounts:
           - mountPath: {{ .Values.persistence.spoolPath }}
-            name: {{ include "common.fullname" . }}-spool-data-pvc
+            name: {{ include "common.fullname" . }}-data
           - mountPath: {{ .Values.persistence.eventLogsPath }}
-            name: {{ include "common.fullname" . }}-event-logs-pvc
+            name: {{ include "common.fullname" . }}-event-logs
         {{- if .Values.global.aafEnabled }}
           - mountPath: {{ .Values.persistence.aafCredsPath }}
-            name: {{ include "common.fullname" . }}-aaf-props-pvc
+            name: {{ include "common.fullname" . }}-aaf-props
         {{- end }}
           command: ["chown","-Rf","1000:1001", "/opt/app/"]
       containers:
@@ -112,12 +112,12 @@ spec:
           volumeMounts:
           {{- if .Values.global.aafEnabled }}
           - mountPath: {{ .Values.persistence.aafCredsPath }}
-            name: {{ include "common.fullname" . }}-aaf-props-pvc
+            name: {{ include "common.fullname" . }}-aaf-props
           {{- end }}
           - mountPath: {{ .Values.persistence.spoolPath }}
-            name: {{ include "common.fullname" . }}-spool-data-pvc
+            name: {{ include "common.fullname" . }}-data
           - mountPath: {{ .Values.persistence.eventLogsPath }}
-            name: {{ include "common.fullname" . }}-event-logs-pvc
+            name: {{ include "common.fullname" . }}-event-logs
           - mountPath: /etc/localtime
             name: localtime
             readOnly: false
@@ -171,53 +171,61 @@ spec:
             name: {{ include "common.fullname" . }}-dmaap-dr-node-filebeat-configmap
         - name: {{ include "common.fullname" . }}-data-filebeat
           emptyDir: {}
+        - name:  {{ include "common.fullname" . }}-logs
+          emptyDir: {}
+      {{- if not .Values.persistence.enabled }}
         - name:  {{ include "common.fullname" . }}-event-logs-pvc
           emptyDir: {}
-        - name:  {{ include "common.fullname" . }}-logs
+        - name: {{ include "common.fullname" . }}-data
           emptyDir: {}
       {{- if .Values.global.aafEnabled }}
         - name:  {{ include "common.fullname" . }}-aaf-props-pvc
           emptyDir: {}
       {{- end }}
+      {{- end }}
+{{- if .Values.persistence.enabled }}
   volumeClaimTemplates:
   - metadata:
-      name: {{ include "common.fullname" . }}-spool-data-pvc
+      name: {{ include "common.fullname" . }}-data
       labels:
         name: {{ include "common.fullname" . }}
     spec:
-      accessModes: [ {{ .Values.persistence.accessMode }} ]
-      storageClassName: {{ include "common.fullname" . }}-spool-data-stcl
+      accessModes:
+      - {{ .Values.persistence.accessMode }}
+      storageClassName: {{ include "common.storageClass" . }}
       resources:
         requests:
           storage: {{ .Values.persistence.spoolSize }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}-spool-data-pv
   - metadata:
-      name: {{ include "common.fullname" . }}-event-logs-pvc
+      name: {{ include "common.fullname" . }}-event-logs
       labels:
         name: {{ include "common.fullname" . }}
     spec:
-      accessModes: [ {{ .Values.persistence.accessMode }} ]
-      storageClassName: {{ include "common.fullname" . }}-event-logs-stcl
+      accessModes:
+      - {{ .Values.persistence.accessMode }}
+      {{- if eq "True" (include "common.needPV" .) }}
+      storageClassName: "{{ include "common.fullname" . }}-data-event-logs"
+      {{- else }}
+      storageClassName: {{ include "common.storageClass" . }}
+      {{- end }}
       resources:
         requests:
           storage: {{ .Values.persistence.eventLogSize }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}-event-logs-pv
 {{- if .Values.global.aafEnabled }}
   - metadata:
-      name: {{ include "common.fullname" . }}-aaf-props-pvc
+      name: {{ include "common.fullname" . }}-aaf-props
       labels:
         name: {{ include "common.fullname" . }}
     spec:
-      accessModes: [ {{ .Values.persistence.accessMode }} ]
-      storageClassName: {{ include "common.fullname" . }}-aaf-props-stcl
+      accessModes:
+      - {{ .Values.persistence.accessMode }}
+      {{- if eq "True" (include "common.needPV" .) }}
+      storageClassName: "{{ include "common.fullname" . }}-data-aaf-props"
+      {{- else }}
+      storageClassName: {{ include "common.storageClass" . }}
+      {{- end }}
       resources:
         requests:
           storage: {{ .Values.persistence.aafCredsSize }}
-      selector:
-        matchLabels:
-          name: {{ include "common.fullname" . }}-aaf-props-pv
+{{- end }}
 {{- end }}
index a1d148d..52ac9eb 100644 (file)
@@ -162,8 +162,12 @@ spec:
         emptyDir: {}
       {{- if .Values.global.aafEnabled }}
       - name: {{ include "common.fullname" . }}-aaf-config-vol
+        {{- if .Values.persistence.enabled }}
         persistentVolumeClaim:
           claimName: {{ include "common.fullname" . }}-aaf-props
-      {{ end }}
+        {{- else }}
+        emptyDir: {}
+        {{- end }}
+      {{- end }}
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
index b82e676..fba1bf9 100644 (file)
@@ -18,6 +18,8 @@
   # ============LICENSE_END=========================================================
 */}}
 {{- if .Values.global.aafEnabled }}
+{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
+{{- if eq "True" (include "common.needPV" .) -}}
 kind: PersistentVolume
 apiVersion: v1
 metadata:
@@ -34,8 +36,10 @@ spec:
     storage: {{ .Values.persistence.aafCredsSize}}
   accessModes:
     - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-aaf-props-stcl"
+  storageClassName: "{{ include "common.fullname" . }}-data"
   persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }}
   hostPath:
     path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.aafCredsMountSubPath }}
 {{ end -}}
+{{- end -}}
+{{- end -}}
index 6ff9e6d..b75daf5 100644 (file)
@@ -18,6 +18,7 @@
   # ============LICENSE_END=========================================================
 */}}
 {{- if .Values.global.aafEnabled }}
+{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
 kind: PersistentVolumeClaim
 apiVersion: v1
 metadata:
@@ -33,13 +34,11 @@ metadata:
 {{ toYaml .Values.persistence.annotations | indent 4 }}
 {{- end }}
 spec:
-  selector:
-    matchLabels:
-      name: {{ include "common.fullname" . }}-aaf-props
   accessModes:
     - {{ .Values.persistence.accessMode }}
-  storageClassName: "{{ include "common.fullname" . }}-aaf-props-stcl"
+  storageClassName: {{ include "common.storageClass" . }}
   resources:
     requests:
       storage: {{ .Values.persistence.aafCredsSize }}
-{{ end -}}
\ No newline at end of file
+{{ end -}}
+{{ end -}}
index 44c9576..3dca738 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- $root := . -}}
+{{- $global := . -}}
 {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-{{ range $i, $e := until (atoi (quote $root.Values.replicaCount) | default 3) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{ range $i, $e := until (atoi (quote $global.Values.replicaCount) | default 3) }}
 ---
 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:
-    app: {{ $root.Values.service.name }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
+    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 }}
+    - {{ $global.Values.persistence.accessMode }}
+  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 }}
+    path: {{ $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+{{ end }}
 {{ end }}
 {{ end }}
-
index 3be8d5d..104a46b 100644 (file)
@@ -187,15 +187,10 @@ spec:
       spec:
         accessModes:
           - {{ .Values.persistence.accessMode | quote }}
+        storageClassName: {{ include "common.storageClass" . }}
         resources:
           requests:
             storage: {{ .Values.persistence.size | quote }}
-        selector:
-          matchLabels:
-            release: "{{ .Release.Name }}"
-            app: {{ .Values.service.name }}
-            chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-            heritage: "{{ .Release.Service }}"
 {{ end }}
       imagePullSecrets:
-      - name: "{{ include "common.namespace" . }}-docker-registry-key"
\ No newline at end of file
+      - name: "{{ include "common.namespace" . }}-docker-registry-key"
index 44c9576..3dca738 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- $root := . -}}
+{{- $global := . -}}
 {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
-{{ range $i, $e := until (atoi (quote $root.Values.replicaCount) | default 3) }}
+{{- if eq "True" (include "common.needPV" .) -}}
+{{ range $i, $e := until (atoi (quote $global.Values.replicaCount) | default 3) }}
 ---
 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:
-    app: {{ $root.Values.service.name }}
-    chart: {{ $root.Chart.Name }}-{{ $root.Chart.Version | replace "+" "_" }}
-    release: {{ $root.Release.Name }}
-    heritage: {{ $root.Release.Service }}
+    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 }}
+    - {{ $global.Values.persistence.accessMode }}
+  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 }}
+    path: {{ $global.Values.persistence.mountPath }}/{{ $global.Release.Name }}/{{ $global.Values.persistence.mountSubPath }}-{{ $i }}
+  persistentVolumeReclaimPolicy: {{ $global.Values.persistence.volumeReclaimPolicy }}
+{{ end }}
 {{ end }}
 {{ end }}
-
index df17ca8..17b87f8 100644 (file)
@@ -133,17 +133,10 @@ spec:
       spec:
         accessModes:
           - {{ .Values.persistence.accessMode | quote }}
+        storageClassName: {{ include "common.storageClass" . }}
         resources:
           requests:
             storage: {{ .Values.persistence.size | quote }}
-        selector:
-          matchLabels:
-            release: "{{ .Release.Name }}"
-            app: {{ .Values.service.name }}
-            chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
-            heritage: "{{ .Release.Service }}"
 {{ end }}
       imagePullSecrets:
       - name: "{{ include "common.namespace" . }}-docker-registry-key"
-
-