feat: scheduler-k3s renders pvc-backed volumes from storage attachments
Adds a per-entry storage helm chart that owns the PVC and (when host_path is set) the PV, and three triggers for the storage plugin to drive: storage-create installs/upgrades the chart with storage-class existence validation, storage-destroy uninstalls it, storage-status reports the PVC phase. App deployment and cron-job charts now consume storage-app-mounts and reference each PVC by name; the // todo: implement volumes blocks are gone. ProcessVolume gained sub_path, read_only, and persistent_claim fields and the deployment/cron-job templates render them.
This commit is contained in:
10 files changed
+447
-6
No files matched your search
@@ -127,12 +127,44 @@ spec:
|
||||
{{- if $.Values.global.image.working_dir }}
|
||||
workingDir: {{ $.Values.global.image.working_dir }}
|
||||
{{- end }}
|
||||
{{- if $config.volumes }}
|
||||
volumeMounts:
|
||||
{{- range $volume := $config.volumes }}
|
||||
- name: {{ $volume.name }}
|
||||
mountPath: {{ $volume.mount_path }}
|
||||
{{- if $volume.sub_path }}
|
||||
subPath: {{ $volume.sub_path }}
|
||||
{{- end }}
|
||||
{{- if $volume.read_only }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.global.image.image_pull_secrets }}
|
||||
imagePullSecrets:
|
||||
- name: {{ $.Values.global.image.image_pull_secrets }}
|
||||
{{- end }}
|
||||
restartPolicy: Never
|
||||
serviceAccountName: {{ $.Values.global.app_name }}
|
||||
{{- if $config.volumes }}
|
||||
volumes:
|
||||
{{- range $volume := $config.volumes }}
|
||||
- name: {{ $volume.name }}
|
||||
{{- if $volume.empty_dir }}
|
||||
emptyDir:
|
||||
{{- if $volume.empty_dir.medium }}
|
||||
medium: {{ $volume.empty_dir.medium }}
|
||||
{{- end }}
|
||||
{{- if $volume.empty_dir.size_limit }}
|
||||
sizeLimit: {{ $volume.empty_dir.size_limit }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $volume.persistent_claim }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $volume.persistent_claim.claim_name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
schedule: {{ $config.cron.schedule }}
|
||||
startingDeadlineSeconds: 60
|
||||
successfulJobsHistoryLimit: 10
|
||||
|
||||
@@ -152,6 +152,12 @@ spec:
|
||||
{{- range $volume := $config.volumes }}
|
||||
- name: {{ $volume.name }}
|
||||
mountPath: {{ $volume.mount_path }}
|
||||
{{- if $volume.sub_path }}
|
||||
subPath: {{ $volume.sub_path }}
|
||||
{{- end }}
|
||||
{{- if $volume.read_only }}
|
||||
readOnly: true
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.global.image.image_pull_secrets }}
|
||||
@@ -172,6 +178,10 @@ spec:
|
||||
sizeLimit: {{ $volume.empty_dir.size_limit }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $volume.persistent_claim }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ $volume.persistent_claim.claim_name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,29 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ .Values.global.entry_name }}
|
||||
namespace: {{ .Values.global.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ .Values.global.entry_name }}
|
||||
app.kubernetes.io/managed-by: dokku
|
||||
{{- range $k, $v := .Values.global.labels }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
dokku.com/managed: "true"
|
||||
{{- range $k, $v := .Values.global.annotations }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.global.access_mode | default "ReadWriteOnce" }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.global.size }}
|
||||
{{- if .Values.global.storage_class }}
|
||||
storageClassName: {{ .Values.global.storage_class }}
|
||||
{{- end }}
|
||||
{{- if .Values.global.host_path }}
|
||||
volumeName: {{ .Values.global.entry_name }}
|
||||
storageClassName: ""
|
||||
{{- end }}
|
||||
@@ -0,0 +1,29 @@
|
||||
{{- if .Values.global.host_path }}
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: {{ .Values.global.entry_name }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ .Values.global.entry_name }}
|
||||
app.kubernetes.io/managed-by: dokku
|
||||
{{- range $k, $v := .Values.global.labels }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end }}
|
||||
annotations:
|
||||
dokku.com/managed: "true"
|
||||
{{- range $k, $v := .Values.global.annotations }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end }}
|
||||
spec:
|
||||
capacity:
|
||||
storage: {{ .Values.global.size }}
|
||||
accessModes:
|
||||
- {{ .Values.global.access_mode | default "ReadWriteOnce" }}
|
||||
persistentVolumeReclaimPolicy: {{ .Values.global.reclaim_policy | default "Retain" }}
|
||||
hostPath:
|
||||
path: {{ .Values.global.host_path }}
|
||||
storageClassName: ""
|
||||
claimRef:
|
||||
namespace: {{ .Values.global.namespace }}
|
||||
name: {{ .Values.global.entry_name }}
|
||||
{{- end }}
|
||||
Reference in new issue
Block a user