From 60141128dc3b8224b9f414c599d3c8826574c45c Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Fri, 29 Nov 2019 15:55:11 +0100 Subject: [DMaaP] Use global storage templates for PVC 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 split the 3 PV from dr-node into 3 files and used range so the number of PV is the same as number of PODs. Change-Id: I46b4e62042ea8330bef8cdc1561fa8bbf3f25d12 Issue-ID: OOM-1227 Signed-off-by: Sylvain Desbureaux --- .../components/dmaap-dr-node/templates/pv-aaf.yaml | 54 ++++++++++++++ .../dmaap-dr-node/templates/pv-event.yaml | 51 +++++++++++++ .../dmaap-dr-node/templates/pv-spool.yaml | 50 +++++++++++++ .../components/dmaap-dr-node/templates/pv.yaml | 84 ---------------------- .../dmaap-dr-node/templates/statefulset.yaml | 60 +++++++++------- 5 files changed, 189 insertions(+), 110 deletions(-) create mode 100644 kubernetes/dmaap/components/dmaap-dr-node/templates/pv-aaf.yaml create mode 100644 kubernetes/dmaap/components/dmaap-dr-node/templates/pv-event.yaml create mode 100644 kubernetes/dmaap/components/dmaap-dr-node/templates/pv-spool.yaml delete mode 100644 kubernetes/dmaap/components/dmaap-dr-node/templates/pv.yaml (limited to 'kubernetes/dmaap/components/dmaap-dr-node') 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 index 0000000000..9b71b93290 --- /dev/null +++ b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-aaf.yaml @@ -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 index 0000000000..1dd7302695 --- /dev/null +++ b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-event.yaml @@ -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 index 0000000000..5e1c339815 --- /dev/null +++ b/kubernetes/dmaap/components/dmaap-dr-node/templates/pv-spool.yaml @@ -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 index 90a9c2c26b..0000000000 --- a/kubernetes/dmaap/components/dmaap-dr-node/templates/pv.yaml +++ /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 diff --git a/kubernetes/dmaap/components/dmaap-dr-node/templates/statefulset.yaml b/kubernetes/dmaap/components/dmaap-dr-node/templates/statefulset.yaml index 9dd5f20748..7ab2f8356d 100644 --- a/kubernetes/dmaap/components/dmaap-dr-node/templates/statefulset.yaml +++ b/kubernetes/dmaap/components/dmaap-dr-node/templates/statefulset.yaml @@ -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 }} -- cgit 1.2.3-korg