From 87384c8b635d1b031d236d9bd980fb18bbd861ab Mon Sep 17 00:00:00 2001 From: Lars Scheibling Date: Thu, 29 Jun 2023 22:04:37 +0200 Subject: [PATCH] Added local disk --- .gitlab-ci.yml | 2 +- Chart/templates/deployment.yaml | 24 ++++++++++++++++++---- Chart/templates/persistentvolume.yaml | 16 ++++++++++++++- Chart/templates/persistentvolumeclaim.yaml | 18 +++++++++++++++- Chart/values.yaml | 2 +- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 227188c..f7d6643 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,5 @@ variables: - HELM_CHART_VERSION: "0.6.12" + HELM_CHART_VERSION: "99.6.12" stages: - deploy diff --git a/Chart/templates/deployment.yaml b/Chart/templates/deployment.yaml index ee1584f..626ee1a 100644 --- a/Chart/templates/deployment.yaml +++ b/Chart/templates/deployment.yaml @@ -29,12 +29,28 @@ spec: - name: cloud persistentVolumeClaim: claimName: pvc-{{ include "..fullname" . }} + - name: cloud-local + persistentVolumeClaim: + claimName: pvc-{{ include "..fullname" . }}-local - name: serverconfig configMap: name: {{ include "..fullname" . }}-cfg imagePullSecrets: - name: pull-secret initContainers: + - name: init-storage + securityContext: + allowPrivilegeEscalation: false + runAsUser: 0 + image: cloudyne/ubuntu-ci:latest + command: ["storage-clone"] + args: ["/full-cloud", "/full-cloud-local"] + imagePullPolicy: Always + volumeMounts: + - name: cloud + mountPath: /full-cloud + - name: cloud-local + mountPath: /full-cloud-local - name: deploy securityContext: allowPrivilegeEscalation: false @@ -49,14 +65,14 @@ spec: subPath: init.json {{- if .Values.storage.wpContent }} {{- range $v := .Values.storage.wpContent }} - - name: cloud + - name: cloud-local mountPath: "/app/web/app/{{ $v }}" subPath: "{{ $v }}" {{- end }} {{- end }} {{- if .Values.storage.additionalMounts }} {{- range $v := .Values.storage.additionalMounts }} - - name: cloud + - name: cloud-local mountPath: {{ $v.localPath }} subPath: {{ $v.cloudPath }} {{- end }} @@ -81,14 +97,14 @@ spec: subPath: unit.json {{- if .Values.storage.wpContent }} {{- range $v := .Values.storage.wpContent }} - - name: cloud + - name: cloud-local mountPath: "/app/web/app/{{ $v }}" subPath: "{{ $v }}" {{- end }} {{- end }} {{- if .Values.storage.additionalMounts }} {{- range $v := .Values.storage.additionalMounts }} - - name: cloud + - name: cloud-local mountPath: {{ $v.localPath }} subPath: {{ $v.cloudPath }} {{- end }} diff --git a/Chart/templates/persistentvolume.yaml b/Chart/templates/persistentvolume.yaml index bc86d81..35332ac 100644 --- a/Chart/templates/persistentvolume.yaml +++ b/Chart/templates/persistentvolume.yaml @@ -35,4 +35,18 @@ spec: persistentVolumeReclaimPolicy: Retain storageClassName: {{ .Values.storage.class | default "premium01" }}-retain volumeMode: Filesystem ---- \ No newline at end of file +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv-{{ include "..fullname" }}-local + labels: + {{- include "..labels" . | nindent 8 }} +spec: + accessModes: + - ReadWriteOnce + capacity: + storage: {{ .Values.site.resources.disk | default "5Gi" }} + persistentVolumeReclaimPolicy: Retain + storageClassName: "longhorn" + volumeMode: Filesystem \ No newline at end of file diff --git a/Chart/templates/persistentvolumeclaim.yaml b/Chart/templates/persistentvolumeclaim.yaml index f30c488..27446ed 100644 --- a/Chart/templates/persistentvolumeclaim.yaml +++ b/Chart/templates/persistentvolumeclaim.yaml @@ -19,4 +19,20 @@ spec: {{- if and .Values.storage .Values.storage.class }} storageClassName: {{ .Values.storage.class | default "premium01" }}-retain -{{- end }} \ No newline at end of file +{{- end }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + labels: + {{- include "..labels" . | nindent 8 }} + name: pvc-{{ include "..fullname" . }}-local +spec: + volumeMode: Filesystem + volumeName: pv-{{ include "..fullname" }}-local + accessModes: + - ReadWriteOnce + resources: + requests: + storage: {{ .Values.site.resources.disk | default "5Gi" }} + storageClassName: "longhorn" \ No newline at end of file diff --git a/Chart/values.yaml b/Chart/values.yaml index 2a8ea83..edea658 100644 --- a/Chart/values.yaml +++ b/Chart/values.yaml @@ -37,7 +37,7 @@ database: # Storage Settings storage: - # The storage class to use for the site + # The storage class used for the cloud part of the storage # Default: premium01 class: "premium01"