From 0310df9a7c868eddfc0ddac8edeb82ecf17cf40d Mon Sep 17 00:00:00 2001 From: Rub21 Date: Mon, 11 Sep 2023 15:08:06 -0500 Subject: [PATCH] Update osmcha db helm template --- .../templates/osmcha-db/osmcha-db-pd.yaml | 33 +++++++++++++------ .../osmcha-db/osmcha-db-statefulset.yaml | 9 ++++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/osm-seed/templates/osmcha-db/osmcha-db-pd.yaml b/osm-seed/templates/osmcha-db/osmcha-db-pd.yaml index a3a25320..e3ad67da 100644 --- a/osm-seed/templates/osmcha-db/osmcha-db-pd.yaml +++ b/osm-seed/templates/osmcha-db/osmcha-db-pd.yaml @@ -6,17 +6,17 @@ metadata: name: {{ .Release.Name }}-osmcha-db-pv labels: app: {{ template "osm-seed.name" . }} - component: osmcha-db-pd + component: db-osmcha-pv environment: {{ .Values.environment }} release: {{ .Release.Name }} spec: + accessModes: + - ReadWriteOnce ############## Minikube ############## {{- if eq .Values.cloudProvider "minikube" }} storageClassName: local-storage capacity: storage: {{ .Values.osmchaDb.persistenceDisk.localVolumeSize }} - accessModes: - - ReadWriteOnce hostPath: path: {{ .Values.osmchaDb.persistenceDisk.localVolumeHostPath | quote }} {{- end }} @@ -26,8 +26,6 @@ spec: storageClassName: "" capacity: storage: {{ .Values.osmchaDb.persistenceDisk.AWS_ElasticBlockStore_size }} - accessModes: - - ReadWriteOnce awsElasticBlockStore: volumeID: {{ .Values.osmchaDb.persistenceDisk.AWS_ElasticBlockStore_volumeID }} fsType: ext4 @@ -38,12 +36,22 @@ spec: storageClassName: "" capacity: storage: {{ .Values.osmchaDb.persistenceDisk.GCP_gcePersistentDisk_size }} - accessModes: - - ReadWriteOnce gcePersistentDisk: pdName: {{ .Values.osmchaDb.persistenceDisk.GCP_gcePersistentDisk_pdName }} fsType: ext4 {{- end }} + + ############## Azure Provider ############## + {{- if eq .Values.cloudProvider "azure" }} + storageClassName: "" + capacity: + storage: {{ .Values.osmchaDb.persistenceDisk.AZURE_diskSize }} + persistentVolumeReclaimPolicy: Retain + azureDisk: + kind: Managed + diskName: {{ .Values.osmchaDb.persistenceDisk.AZURE_diskName }} + diskURI: {{ .Values.osmchaDb.persistenceDisk.AZURE_diskURI }} + {{- end }} --- apiVersion: v1 kind: PersistentVolumeClaim @@ -51,7 +59,7 @@ metadata: name: {{ .Release.Name }}-osmcha-db-pv-claim labels: app: {{ template "osm-seed.name" . }} - component: db-pd + component: db-osmcha-pvc environment: {{ .Values.environment }} release: {{ .Release.Name }} spec: @@ -67,7 +75,7 @@ spec: - ReadWriteOnce resources: requests: - ############# Minikube ############## + ############## Minikube ############## {{- if eq .Values.cloudProvider "minikube" }} storage: {{ .Values.osmchaDb.persistenceDisk.localVolumeSize }} {{- end }} @@ -81,5 +89,10 @@ spec: {{- if eq .Values.cloudProvider "gcp" }} storage: {{ .Values.osmchaDb.persistenceDisk.GCP_gcePersistentDisk_size }} {{- end }} + + ############## AZURE Provider ############## + {{- if eq .Values.cloudProvider "azure" }} + storage: {{ .Values.osmchaDb.persistenceDisk.AZURE_diskSize }} + {{- end }} +{{- end }} {{- end }} -{{- end }} \ No newline at end of file diff --git a/osm-seed/templates/osmcha-db/osmcha-db-statefulset.yaml b/osm-seed/templates/osmcha-db/osmcha-db-statefulset.yaml index 81d1fe78..78d32dbd 100644 --- a/osm-seed/templates/osmcha-db/osmcha-db-statefulset.yaml +++ b/osm-seed/templates/osmcha-db/osmcha-db-statefulset.yaml @@ -23,6 +23,14 @@ spec: release: {{ .Release.Name }} run: {{ .Release.Name }}-osmcha-db spec: + # Remove lost+found in EBS disk + initContainers: + - name: remove-lost-found + image: busybox + command: ['sh', '-c', 'rm -rf /var/lib/postgresql/data/lost+found'] + volumeMounts: + - name: postgres-storage + mountPath: /var/lib/postgresql/data containers: - name: {{ .Chart.Name }}-osmcha-db image: "{{ .Values.osmchaDb.image.name }}:{{ .Values.osmchaDb.image.tag }}" @@ -66,7 +74,6 @@ spec: volumeMounts: - name: postgres-storage mountPath: {{ .Values.osmchaDb.persistenceDisk.mountPath }} - subPath: {{ .Values.osmchaDb.persistenceDisk.subPath }} {{- if .Values.osmchaDb.resources.enabled }} resources: requests: