Skip to content

Commit

Permalink
feat(helm): improve checks on storage drivers configuration and high …
Browse files Browse the repository at this point in the history
…availability
  • Loading branch information
plaffitt committed Nov 7, 2024
1 parent e6fdf32 commit 4371274
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
33 changes: 33 additions & 0 deletions helm/kube-image-keeper/templates/checks.tpl
Original file line number Diff line number Diff line change
@@ -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 }}
5 changes: 0 additions & 5 deletions helm/kube-image-keeper/templates/registry-statefulset.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 4371274

Please sign in to comment.