From f3a81ad78d4f9e46576b5e119b951708a555bb63 Mon Sep 17 00:00:00 2001 From: kfox1111 Date: Mon, 13 Mar 2023 06:12:37 -0700 Subject: [PATCH] Make csi driver configurable to be able to run multiple instances (#115) Co-authored-by: Marco Franssen --- charts/spire/charts/spiffe-csi-driver/README.md | 2 ++ .../charts/spiffe-csi-driver/templates/daemonset.yaml | 9 +++++---- .../spiffe-csi-driver/templates/spiffe-csi-driver.yaml | 2 +- charts/spire/charts/spiffe-csi-driver/values.yaml | 6 ++++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/charts/spire/charts/spiffe-csi-driver/README.md b/charts/spire/charts/spiffe-csi-driver/README.md index 41cd407..833800a 100644 --- a/charts/spire/charts/spiffe-csi-driver/README.md +++ b/charts/spire/charts/spiffe-csi-driver/README.md @@ -14,6 +14,7 @@ A Helm chart to install the SPIFFE CSI driver. | Key | Type | Default | Description | |-----|------|---------|-------------| | fullnameOverride | string | `""` | | +| healthChecks.port | int | `9809` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.registry | string | `"ghcr.io"` | | | image.repository | string | `"spiffe/spiffe-csi-driver"` | | @@ -27,6 +28,7 @@ A Helm chart to install the SPIFFE CSI driver. | nodeDriverRegistrar.image.version | string | `"v2.6.2"` | | | nodeDriverRegistrar.resources | object | `{}` | | | nodeSelector | object | `{}` | | +| pluginName | string | `"csi.spiffe.io"` | Set the csi driver name deployed to Kubernetes. | | podAnnotations | object | `{}` | | | podSecurityContext | object | `{}` | | | priorityClassName | string | `""` | Priority class assigned to daemonset pods | diff --git a/charts/spire/charts/spiffe-csi-driver/templates/daemonset.yaml b/charts/spire/charts/spiffe-csi-driver/templates/daemonset.yaml index 339f728..daad453 100644 --- a/charts/spire/charts/spiffe-csi-driver/templates/daemonset.yaml +++ b/charts/spire/charts/spiffe-csi-driver/templates/daemonset.yaml @@ -35,6 +35,7 @@ spec: imagePullPolicy: {{ .Values.image.pullPolicy }} args: [ "-workload-api-socket-dir", "/spire-agent-socket", + "-plugin-name", "{{ .Values.pluginName }}", "-csi-socket-path", "/spiffe-csi/csi.sock", ] env: @@ -74,8 +75,8 @@ spec: imagePullPolicy: {{ .Values.nodeDriverRegistrar.image.pullPolicy }} args: [ "-csi-address", "/spiffe-csi/csi.sock", - "-kubelet-registration-path", "/var/lib/kubelet/plugins/csi.spiffe.io/csi.sock", - "-health-port", "9809" + "-kubelet-registration-path", "/var/lib/kubelet/plugins/{{ .Values.pluginName }}/csi.sock", + "-health-port", "{{ .Values.healthChecks.port }}" ] volumeMounts: # The registrar needs access to the SPIFFE CSI driver socket @@ -86,7 +87,7 @@ spec: - name: kubelet-plugin-registration-dir mountPath: /registration ports: - - containerPort: 9809 + - containerPort: {{ .Values.healthChecks.port }} name: healthz livenessProbe: httpGet: @@ -104,7 +105,7 @@ spec: # This volume is where the socket for kubelet->driver communication lives - name: spiffe-csi-socket-dir hostPath: - path: /var/lib/kubelet/plugins/csi.spiffe.io + path: /var/lib/kubelet/plugins/{{ .Values.pluginName }} type: DirectoryOrCreate # This volume is where the SPIFFE CSI driver mounts volumes - name: mountpoint-dir diff --git a/charts/spire/charts/spiffe-csi-driver/templates/spiffe-csi-driver.yaml b/charts/spire/charts/spiffe-csi-driver/templates/spiffe-csi-driver.yaml index e9d07bc..4c1d51d 100644 --- a/charts/spire/charts/spiffe-csi-driver/templates/spiffe-csi-driver.yaml +++ b/charts/spire/charts/spiffe-csi-driver/templates/spiffe-csi-driver.yaml @@ -1,7 +1,7 @@ apiVersion: storage.k8s.io/v1 kind: CSIDriver metadata: - name: "csi.spiffe.io" + name: {{ .Values.pluginName | quote }} spec: # Only ephemeral, inline volumes are supported. There is no need for a # controller to provision and attach volumes. diff --git a/charts/spire/charts/spiffe-csi-driver/values.yaml b/charts/spire/charts/spiffe-csi-driver/values.yaml index bae9f2d..3011595 100644 --- a/charts/spire/charts/spiffe-csi-driver/values.yaml +++ b/charts/spire/charts/spiffe-csi-driver/values.yaml @@ -1,3 +1,6 @@ +# -- Set the csi driver name deployed to Kubernetes. +pluginName: csi.spiffe.io + image: registry: ghcr.io repository: spiffe/spiffe-csi-driver @@ -15,6 +18,9 @@ resources: {} # cpu: 100m # memory: 64Mi +healthChecks: + port: 9809 + imagePullSecrets: [] nameOverride: "" namespaceOverride: ""