diff --git a/helm/kube-image-keeper/templates/checks.tpl b/helm/kube-image-keeper/templates/checks.tpl new file mode 100644 index 00000000..1f843b5c --- /dev/null +++ b/helm/kube-image-keeper/templates/checks.tpl @@ -0,0 +1,33 @@ +# High availability +# ================= +{{ if and + (eq (include "kube-image-keeper.registry-stateless-mode" .) "false") + (gt (int .Values.registry.replicas) 1) + (ne .Values.registry.persistence.accessModes "ReadWriteMany") +}} + {{ fail "Registry needs a configured S3/GCS/Azure storage driver or a PVC which supports ReadWriteMany to enable HA mode (>1 replicas), please enable minio, configure an external storage driver or provide a supported PVC." }} +{{ end }} + +# Multiple storage +# ================ +{{ $enabledOptions := list }} + +{{ if .Values.registry.persistence.enabled }} + {{ $enabledOptions = append $enabledOptions "registry.persistence.enabled" }} +{{ end }} +{{ if .Values.minio.enabled }} + {{ $enabledOptions = append $enabledOptions "minio.enabled" }} +{{ end }} +{{ if .Values.registry.persistence.s3 }} + {{ $enabledOptions = append $enabledOptions "registry.persistence.s3" }} +{{ end }} +{{ if .Values.registry.persistence.gcs }} + {{ $enabledOptions = append $enabledOptions "registry.persistence.gcs" }} +{{ end }} +{{ if .Values.registry.persistence.azure }} + {{ $enabledOptions = append $enabledOptions "registry.persistence.azure" }} +{{ end }} + +{{ if gt (len $enabledOptions) 1 }} + {{ fail (printf "Multiple storage options enabled: %v. Please enable only one." $enabledOptions) }} +{{ end }} diff --git a/helm/kube-image-keeper/templates/registry-statefulset.yaml b/helm/kube-image-keeper/templates/registry-statefulset.yaml index 6077b5f6..f061694b 100644 --- a/helm/kube-image-keeper/templates/registry-statefulset.yaml +++ b/helm/kube-image-keeper/templates/registry-statefulset.yaml @@ -1,9 +1,4 @@ {{- if eq (include "kube-image-keeper.registry-stateless-mode" .) "false" }} - -{{- if and (gt (int .Values.registry.replicas) 1) (ne .Values.registry.persistence.accessModes "ReadWriteMany") -}} -{{ fail "registry needs a configured S3 endpoint or a PVC which supports ReadWriteMany to enable HA mode (>1 replicas), please enable minio or configure an external S3 endpoint" }} -{{- end }} - apiVersion: apps/v1 kind: StatefulSet metadata: