Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions deploy/helm/DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Developer Guide: Building, Packaging, and Publishing Helm Charts

This guide helps you build a new Helm chart or update an existing chart for configuration changes. See `README.md` for user installation instructions.

---

## Prerequisites
- Helm installed (`helm version`)
- Git access to this repository
- (Optional) GitHub Pages enabled for publishing the Helm repo index

---

## Create a New Helm Chart
```sh
helm create <chart-name>
```
Then customize:
- Chart.yaml - name, version (chart version), appVersion (driver version)
- values.yaml - defaults
- templates/ - manifests

Lint & test:
```sh
helm lint <chart-name>
helm install --dry-run --debug <release-name> <chart-name>
```

---

## Update an Existing Chart
```sh
git pull
# Edit values/templates/Chart.yaml as needed
helm lint <chart-dir>
helm upgrade --dry-run --debug <release-name> <chart-dir>
```

Versioning rules (semantic):
- Bump Chart.yaml:version each release (e.g., 1.2.8 -> 1.2.9)
- Update appVersion when the CSI plugin version changes

---

## Package a New Version

Example layout:
```
deploy/helm/repo/
├─ v1.2.7/ # chart root
├─ index.yaml # Helm repo index (published)
└─ v1.2.7/hammerspace-csi-1.2.7.tgz # packaged chart(s)
```

1) Package the chart
```sh
cd deploy/helm/repo/v1.2.7
helm package ./hammerspace-helm-chart
# Produces hammerspace-csi-<version>.tgz
```

2) Update the repo index
```sh
cd ..
# Replace <GITHUB_PAGES_URL> with the base URL of your Helm repo hosting
helm repo index . --url <GITHUB_PAGES_URL>
```

3) Commit and push the artifacts
```sh
git add *.tgz index.yaml
git commit -m "chore(helm): release csi-driver <version>"
git push
```

### If hosted on GitHub Pages
- Publish index.yaml and all *.tgz to your Pages branch (commonly gh-pages) or /docs folder on main
- Ensure Pages serves the exact directory containing index.yaml
- Optional: add artifacthub-repo.yml next to index.yaml for Artifact Hub

Minimal artifacthub-repo.yml:
```yaml
repositoryID: "hammerspace-csi-helm-repo"
owners:
- name: "Your Name"
email: "[email protected]"
```

---

## Local Smoke Test from the Built Repo
After you publish the new package + index.yaml:
```sh
helm repo remove hscsi || true
helm repo add hscsi <GITHUB_PAGES_URL>
helm repo update
helm search repo hscsi
helm install test-hscsi hscsi/csi-driver --dry-run --debug
```

---

## Optional: Makefile helpers
Create a Makefile in deploy/helm/repo:

```make
CHART_DIR ?= csi-driver
REPO_URL ?= <GITHUB_PAGES_URL>

package:
\tcd $(CHART_DIR) && helm package .

index:
\thelm repo index . --url $(REPO_URL)

release: package index
\tgit add *.tgz index.yaml
\tgit commit -m "chore(helm): release $$(date +%Y.%m.%d-%H%M)"
\tgit push
```

Usage:
```sh
make package
make index
make release
```

---

## Release Checklist
- [ ] Chart.yaml version bumped
- [ ] appVersion set to the intended CSI plugin image tag
- [ ] helm lint passes
- [ ] helm install --dry-run --debug passes
- [ ] New .tgz generated and committed
- [ ] index.yaml updated with correct --url
- [ ] GitHub Pages serves the folder containing index.yaml
100 changes: 100 additions & 0 deletions deploy/helm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Hammerspace CSI Helm Charts

This repository provides Helm charts to deploy the **Hammerspace CSI driver** in a Kubernetes cluster.
The chart installs both the **Controller** and **Node** plugins, and supports configuration of timeouts, retry intervals.

---

## 🚀 Quickstart: Deploy the Chart

### 1) Add the Helm repository
> Replace `<GITHUB_PAGES_URL>` with your GitHub Pages URL where `index.yaml` is hosted (e.g., `https://hammer-space/csi-plugin.github.io/deploy/helm/`).
```bash
helm repo add hscsi https://hammer-space/csi-plugin.github.io/deploy/helm/
helm repo update
helm install my-hammerspace-csi hscsi/hammerspace-csi --version 1.2.8
```

### 2) Create your `values.yaml`
You can override default settings by creating a custom `values.yaml`. Example:

```yaml
# values.yaml (example)

controller:
replicaCount: 2
resources:
requests:
cpu: "200m"
memory: "512Mi"
limits:
cpu: "1"
memory: "1Gi"

node:
# Tolerate control-plane nodes if needed
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"

```

### 3) Install the chart
```bash
helm install hscsi hscsi/hammerspace-csi \
--namespace kube-system \
--create-namespace \
-f values.yaml
```

Alternatively, override values inline:
```bash
helm install hscsi hscsi/hammerspace-csi \
--namespace kube-system \
--create-namespace \
--set controller.replicaCount=2
```

### 4) Verify the deployment
```bash
kubectl get pods -n kube-system -l app.kubernetes.io/name=hscsi
kubectl get csidrivers | grep hammerspace || true
```

You should see both **csi-provisioner-0** and **csi-node-<uuid>** plugin pods running.
---

## 🔧 Upgrade
```bash
helm upgrade hscsi -n kube-system -f values.yaml
```

## 🗑 Uninstall
```bash
helm uninstall hscsi -n kube-system
```

---

## ⚙️ Configuration Reference (common)
| Key | Type | Description |
| --- | --- | --- |
| `controller.replicaCount` | int | Number of controller replicas |
| `controller.resources` | map | Requests/limits for controller pods |
| `node.tolerations` | list | Tolerations for node daemonset |

> For all options, see `values.yaml` in the chart.

---

## 🧰 Troubleshooting
- Pods stuck in ImagePullBackOff: Verify image registry access and tag in the chart values.
- "csi-driver" not found: Run `helm repo update` and check that your `<GITHUB_PAGES_URL>/index.yaml` is accessible.
- No nodes provisioned: Check node plugin DaemonSet tolerations/affinity and that nodes can reach the NFS endpoints.

---

## 📚 References
- Helm: https://helm.sh/docs/
- Kubernetes CSI: https://kubernetes-csi.github.io/docs/
5 changes: 5 additions & 0 deletions deploy/helm/repo/artifacthub-repo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repositoryID: ba19dd93-de8e-41da-b66c-4f5c557ee0f3 # use `uuidgen` to generate
name: hammerspace-csi-chart
displayName: Hammerspace CSI Helm Chart
description: Helm chart for deploying the Hammerspace CSI plugin
url: https://github.com/hammer-space/csi-plugin/deploy/helm/repo
24 changes: 24 additions & 0 deletions deploy/helm/repo/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v1
entries:
hammerspace-csi:
- apiVersion: v2
appVersion: v1.2.8
created: "2025-08-26T06:46:19.212057988Z"
description: A Helm chart for the Hammerspace CSI driver
digest: b7f41604ea1d1b9b35bc183c5d5f1b8fd0d771a1887565b8a348982824fae058
icon: https://www.hammerspace.com/favicon.ico
name: hammerspace-csi
urls:
- v1.2.8/hammerspace-csi-1.2.8.tgz
version: 1.2.8
- apiVersion: v2
appVersion: v1.2.7
created: "2025-08-26T06:46:19.211443051Z"
description: A Helm chart for the Hammerspace CSI driver
digest: 1db738079a744d44fb7e25c70636568d4c136000b564b4845666071ef901b58c
icon: https://www.hammerspace.com/favicon.ico
name: hammerspace-csi
urls:
- v1.2.7/hammerspace-csi-1.2.7.tgz
version: 1.2.7
generated: "2025-08-26T06:46:19.210659997Z"
Binary file added deploy/helm/repo/v1.2.7/hammerspace-csi-1.2.7.tgz
Binary file not shown.
6 changes: 6 additions & 0 deletions deploy/helm/repo/v1.2.7/hammerspace-helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v2
name: hammerspace-csi
description: A Helm chart for the Hammerspace CSI driver
version: 1.2.7
appVersion: "v1.2.7"
icon: https://www.hammerspace.com/favicon.ico
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: csi-env-config
namespace: {{ .Values.namespace | default "kube-system" }}
data:
MOUNT_CHECK_TIMEOUT: "{{ .Values.env.MOUNT_CHECK_TIMEOUT }}"
UNMOUNT_RETRY_COUNT: "{{ .Values.env.UNMOUNT_RETRY_COUNT }}"
UNMOUNT_RETRY_INTERVAL: "{{ .Values.env.UNMOUNT_RETRY_INTERVAL }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This file is part of the Hammerspace CSI Driver project.
# It defines the RBAC roles and bindings for the CSI provisioner component.
# The provisioner is responsible for creating and managing PersistentVolumes
# based on PersistentVolumeClaims in Kubernetes.
apiVersion: v1
kind: ServiceAccount
metadata:
name: csi-provisioner
namespace: {{ .Values.namespace }}
---
# This ClusterRole defines the permissions required by the CSI provisioner.
# It allows the provisioner to manage PersistentVolumes, PersistentVolumeClaims,
# and other related resources in the Kubernetes cluster.
# It also allows the provisioner to interact with storage classes and volume snapshots.
# The ClusterRole is bound to the csi-provisioner ServiceAccount.
# This ClusterRoleBinding binds the csi-provisioner ServiceAccount to the csi-provisioner ClusterRole.
# This allows the provisioner to perform the actions defined in the ClusterRole.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# The ClusterRoleBinding is necessary for the provisioner to have the required permissions
# to manage storage resources in the cluster.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# This ClusterRoleBinding is specifically for the provisioner to manage volume attachments.
# It allows the provisioner to update the status of volume attachments.
# This is necessary for the provisioner to properly manage the lifecycle of volumes
# and ensure that they are correctly attached to nodes.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# This ClusterRoleBinding is specifically for the provisioner to manage volume attachment status.
# It allows the provisioner to update the status of volume attachments.
# This is necessary for the provisioner to properly manage the lifecycle of volumes
# and ensure that they are correctly attached to nodes.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# The ClusterRoleBinding is necessary for the provisioner to have the required permissions
# to manage storage resources in the cluster.

apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: csi-provisioner
rules:
- apiGroups: [""]
resources: ["pods", "persistentvolumes", "persistentvolumeclaims", "nodes", "events", "endpoints", "secrets"]
verbs: ["list", "watch", "get", "create", "delete", "update", "patch"]
- apiGroups: ["storage.k8s.io", "snapshot.storage.k8s.io", "apiextensions.k8s.io"]
resources: ["storageclasses", "volumeattachments", "volumeattachments/status", "volumesnapshotcontents/status", "volumesnapshots", "volumesnapshotcontents", "volumesnapshotclasses", "customresourcedefinitions"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
---
# This ClusterRoleBinding binds the csi-provisioner ServiceAccount to the csi-provisioner ClusterRole.
# It allows the provisioner to perform the actions defined in the ClusterRole.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# This ClusterRoleBinding is necessary for the provisioner to have the required permissions
# to manage storage resources in the cluster.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# This ClusterRoleBinding is specifically for the provisioner to manage volume attachments.
# It allows the provisioner to update the status of volume attachments.
# This is necessary for the provisioner to properly manage the lifecycle of volumes
# and ensure that they are correctly attached to nodes.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# This ClusterRoleBinding is specifically for the provisioner to manage volume attachment status.
# It allows the provisioner to update the status of volume attachments.
# This is necessary for the provisioner to properly manage the lifecycle of volumes
# and ensure that they are correctly attached to nodes.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: csi-provisioner-binding
subjects:
- kind: ServiceAccount
name: csi-provisioner
namespace: {{ .Values.namespace }}
roleRef:
kind: ClusterRole
name: csi-provisioner
apiGroup: rbac.authorization.k8s.io
---
# This ClusterRoleBinding is specifically for the provisioner to manage volume attachment status.
# It allows the provisioner to update the status of volume attachments.
# This is necessary for the provisioner to properly manage the lifecycle of volumes
# and ensure that they are correctly attached to nodes.
# The ClusterRoleBinding is created in the same namespace as the provisioner ServiceAccount.
# This ClusterRoleBinding is necessary for the provisioner to have the required permissions
# to manage storage resources in the cluster.
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: csi-provisioner
subjects:
- kind: ServiceAccount
name: csi-provisioner
namespace: {{ .Values.namespace }}
roleRef:
kind: ClusterRole
name: csi-provisioner
apiGroup: rbac.authorization.k8s.io
Loading