From 18747ec29947084c571d66f37f1a0fe85fbe4702 Mon Sep 17 00:00:00 2001 From: Sylvain Desbureaux Date: Thu, 28 Nov 2019 13:28:35 +0100 Subject: 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 created a PV/PVC for elasticsearch has it was hardcoded to hostPath. I've also removed hostPath for job logs (aai-traversal logs were not put into the desired hostPath) And I moved the 3 jobs of aai-graphadmin into 3 files as it's a better practice (several object in the same file can lead to unexpected behavior). Behavior is supposed to be exactly the same as before. Issue-ID: OOM-1227 Signed-off-by: Sylvain Desbureaux Change-Id: I71c6cee8d7c33ef7bd39c40a43c26b377d4ceec3 --- .../aai-elasticsearch/templates/deployment.yaml | 7 ++-- components/aai-elasticsearch/templates/pv.yaml | 42 ++++++++++++++++++++++ components/aai-elasticsearch/templates/pvc.yaml | 36 +++++++++++++++++++ 3 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 components/aai-elasticsearch/templates/pv.yaml create mode 100644 components/aai-elasticsearch/templates/pvc.yaml (limited to 'components/aai-elasticsearch/templates') diff --git a/components/aai-elasticsearch/templates/deployment.yaml b/components/aai-elasticsearch/templates/deployment.yaml index 0c54738..3b8141c 100644 --- a/components/aai-elasticsearch/templates/deployment.yaml +++ b/components/aai-elasticsearch/templates/deployment.yaml @@ -60,7 +60,7 @@ spec: - name: elasticsearch-data mountPath: /logroot/ containers: - - name: {{ include "common.name" . }} + - name: {{ include "common.name" . }} image: "{{ .Values.global.loggingRepository }}/{{ .Values.image }}" imagePullPolicy: {{ .Values.pullPolicy | default .Values.global.pullPolicy }} ports: @@ -105,7 +105,6 @@ spec: affinity: {{ toYaml .Values.affinity | indent 8 }} {{- end }} - volumes: - name: localtime hostPath: @@ -114,8 +113,8 @@ spec: configMap: name: {{ include "common.fullname" . }}-es-config - name: elasticsearch-data - hostPath: - path: {{ .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} + persistentVolumeClaim: + claimName: {{ include "common.fullname" . }}-data restartPolicy: {{ .Values.restartPolicy }} imagePullSecrets: - name: "{{ include "common.namespace" . }}-docker-registry-key" diff --git a/components/aai-elasticsearch/templates/pv.yaml b/components/aai-elasticsearch/templates/pv.yaml new file mode 100644 index 0000000..f62c040 --- /dev/null +++ b/components/aai-elasticsearch/templates/pv.yaml @@ -0,0 +1,42 @@ +{{/* +# 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 eq "True" (include "common.needPV" .) -}} +kind: PersistentVolume +apiVersion: v1 +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 }}" + name: {{ include "common.fullname" . }} + annotations: + "helm.sh/hook": pre-upgrade,pre-install + "helm.sh/hook-weight": "0" + "helm.sh/hook-delete-policy": before-hook-creation +spec: + capacity: + storage: {{ .Values.persistence.size}} + accessModes: + - {{ .Values.persistence.accessMode }} + persistentVolumeReclaimPolicy: {{ .Values.persistence.volumeReclaimPolicy }} + storageClassName: "{{ include "common.fullname" . }}-data" + hostPath: + path: {{ .Values.global.persistence.mountPath | default .Values.persistence.mountPath }}/{{ .Release.Name }}/{{ .Values.persistence.mountSubPath }} +{{- end -}} \ No newline at end of file diff --git a/components/aai-elasticsearch/templates/pvc.yaml b/components/aai-elasticsearch/templates/pvc.yaml new file mode 100644 index 0000000..a3425d3 --- /dev/null +++ b/components/aai-elasticsearch/templates/pvc.yaml @@ -0,0 +1,36 @@ +{{/* +# 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. +*/}} + +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ include "common.fullname" . }}-data + namespace: {{ include "common.namespace" . }} + labels: + app: {{ include "common.name" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +{{- if .Values.persistence.annotations }} +{{ toYaml .Values.persistence.annotations | indent 4 }} +{{- end }} +spec: + accessModes: + - {{ .Values.persistence.accessMode }} + resources: + requests: + storage: {{ .Values.persistence.size }} + storageClassName: {{ include "common.storageClass" . }} -- cgit 1.2.3-korg