From 755029db267e04c46419a6afb029d1f508ca3fd5 Mon Sep 17 00:00:00 2001 From: shoce Date: Fri, 13 Mar 2026 02:03:50 +0700 Subject: [PATCH] feat: add persistence.hostPath to Helm chart --- chart/Chart.yaml | 2 +- chart/README.md | 4 ++-- chart/templates/deployment.yaml | 16 ++++++++++++++-- chart/values.yaml | 2 ++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/chart/Chart.yaml b/chart/Chart.yaml index 6b0ca439..7babb6bd 100644 --- a/chart/Chart.yaml +++ b/chart/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: versitygw description: A Helm chart for deploying the Versity S3 Gateway on Kubernetes type: application -version: 0.3.0 +version: 0.3.1 sources: - https://github.com/versity/versitygw icon: https://raw.githubusercontent.com/versity/versitygw/main/webui/web/assets/images/Versity-logo-blue-horizontal.png diff --git a/chart/README.md b/chart/README.md index e92f2723..c515c70b 100644 --- a/chart/README.md +++ b/chart/README.md @@ -84,12 +84,12 @@ The `gateway.backend.type` value selects the storage backend. Use `gateway.backe | **Admin API** | `admin.enabled=true` — exposes a separate management API on `admin.port` (default `7071`) | | **WebUI** | `webui.enabled=true` — browser-based management UI on `webui.port` (default `8080`); set `webui.apiGateways` and `webui.adminGateways` to your externally reachable endpoints | | **IAM** | `iam.enabled=true` — flat-file identity and access management stored alongside backend data | -| **Persistence** | `persistence.enabled=true` — provisions a PVC for backend data and IAM storage; defaults to `10Gi` | +| **Persistence** | `persistence.enabled=true` — provisions a PVC for backend data and IAM storage; defaults to `10Gi`, or uses a hostPath volume specified by `persistence.hostPath` | | **NetworkPolicy** | `networkPolicy.enabled=true` — restricts ingress to selected pods/namespaces; allows all egress | ## Scaling and Persistence -By default, this chart enables persistence via a `PersistentVolumeClaim` (PVC) to ensure data consistency and prevent data loss. +By default, this chart enables persistence via a `PersistentVolumeClaim` (PVC) to ensure data consistency and prevent data loss. To use a hostPath volume set `persistence.hostPath`. ### Horizontal Scaling (replicas > 1) diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml index 396472d5..a25663b9 100644 --- a/chart/templates/deployment.yaml +++ b/chart/templates/deployment.yaml @@ -4,8 +4,14 @@ {{- fail "Multiple replicas with POSIX backend or Internal IAM require persistence.enabled=true to prevent data loss and inconsistency across pods. If using a stateless backend (e.g. S3, Azure) and external IAM, set persistence.enabled=false." }} {{- end }} {{- end }} -{{- if and .Values.persistence.enabled (not .Values.persistence.create) (not .Values.persistence.claimName) }} - {{- fail "persistence.claimName is required when persistence.create is false" }} +{{- if and .Values.persistence.enabled (not .Values.persistence.create) (not .Values.persistence.claimName) (not .Values.persistence.hostPath) }} + {{- fail "persistence.claimName or persistence.hostPath is required when persistence.create is false" }} +{{- end }} +{{- if and .Values.persistence.claimName .Values.persistence.hostPath }} + {{- fail "only persistence.claimName or persistence.hostPath can be set" }} +{{- end }} +{{- if and .Values.persistence.create .Values.persistence.hostPath }} + {{- fail "persistence.create must be false for persistence.hostPath can be set" }} {{- end }} apiVersion: apps/v1 kind: Deployment @@ -195,8 +201,14 @@ spec: volumes: - name: data {{- if .Values.persistence.enabled }} + {{- if .Values.persistence.hostPath }} + hostPath: + path: {{ .Values.persistence.hostPath }} + type: DirectoryOrCreate + {{- else }} persistentVolumeClaim: claimName: {{ include "versitygw.pvcName" . }} + {{- end }} {{- else }} emptyDir: {} {{- end }} diff --git a/chart/values.yaml b/chart/values.yaml index e191687b..1e44d8b1 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -288,6 +288,8 @@ persistence: claimName: "" size: 10Gi storageClassName: "" + # If set then use a hostPath volume, needs `persistence.create=false` + hostPath: "" # Access mode for the PVC. Use ReadWriteMany for multi-replica deployments. accessMode: ReadWriteOnce