Skip to content

Commit 1b55127

Browse files
authored
fix(security): switch node daemonset to --mode=node (#49)
* fix(security): switch node daemonset to --mode=node * fix(helm): add node.zone Helm value with fallback to controller.zone * fix: controller doesn't need mode helm value * chore(helm): add global clusterZone value * chore(ci): move cert-manager install to makefile * chore(test): move e2e ClusterIssuer manifest to separate file
1 parent 303b121 commit 1b55127

9 files changed

Lines changed: 43 additions & 73 deletions

File tree

.github/workflows/_reusable-e2e.yaml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,6 @@ jobs:
4949
with:
5050
version: 1.36.2
5151

52-
- name: Install cert-manager
53-
run: |
54-
helm repo add jetstack https://charts.jetstack.io
55-
helm upgrade --install cert-manager jetstack/cert-manager \
56-
--namespace cert-manager --create-namespace \
57-
--version v1.20.3 \
58-
--set crds.enabled=true
59-
kubectl wait --namespace cert-manager --for=condition=Available deployment cert-manager --timeout=180s
60-
kubectl wait --namespace cert-manager --for=condition=Available deployment cert-manager-webhook --timeout=180s
61-
62-
- name: Create e2e ClusterIssuer for webhook test
63-
run: |
64-
kubectl apply -f - <<EOF
65-
apiVersion: cert-manager.io/v1
66-
kind: ClusterIssuer
67-
metadata:
68-
name: e2e-selfsigned
69-
spec:
70-
selfSigned: {}
71-
EOF
72-
7352
- name: Deploy CSI driver via Helm
7453
run: |
7554
make deploy-test \

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,27 @@ helm-deploy:
2626
$(if $(HELM_VALUES),--values $(HELM_VALUES),) \
2727
$(HELM_OPTS) --wait --timeout 180s
2828

29+
CERT_MANAGER_VERSION ?= v1.20.3
30+
31+
.PHONY: install-cert-manager
32+
install-cert-manager:
33+
helm repo add jetstack https://charts.jetstack.io
34+
helm upgrade --install cert-manager jetstack/cert-manager \
35+
--namespace cert-manager --create-namespace \
36+
--version $(CERT_MANAGER_VERSION) \
37+
--set crds.enabled=true
38+
kubectl wait --namespace cert-manager --for=condition=Available deployment cert-manager --timeout=180s
39+
kubectl wait --namespace cert-manager --for=condition=Available deployment cert-manager-webhook --timeout=180s
40+
41+
.PHONY: create-e2e-clusterissuer
42+
create-e2e-clusterissuer:
43+
kubectl apply -f test/e2e/clusterissuer.yaml
44+
2945
.PHONY: deploy-test
30-
deploy-test:
46+
deploy-test: install-cert-manager create-e2e-clusterissuer
3147
helm upgrade --install upcloud-csi $(HELM_CHART_DIR) --namespace kube-system \
3248
--set networkPolicy.enabled=true \
49+
--set clusterZone=de-fra1 \
3350
$(if $(HELM_VALUES),--values $(HELM_VALUES),) \
3451
$(HELM_OPTS) --wait --timeout 180s
3552

deploy/helm/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Helm chart changelog
22

3+
## [1.11.0] - 2026-06-30
4+
5+
### Added
6+
- `clusterZone` value for both controller and node. Setting it avoids an API call on the controller startup, since it's needed for the DaemonSet already.
7+
8+
### Changed
9+
- Node DaemonSet runs `--mode=node` now instead of `--mode=monolith`. UpCloud API credentials are no longer deployed to every cluster node, reducing credential blast radius
10+
- Controller StatefulSet and Node DaemonSet use `clusterZone` for the `--zone` flag
11+
312
## [1.10.0] - 2026-06-28
413

514
### Added

deploy/helm/Chart.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: upcloud-csi
33
description: CSI driver for UpCloud block storage
44
type: application
5-
version: "1.10.0"
5+
version: "1.11.0"
66
appVersion: "v2.8.3"
77
kubeVersion: ">=1.21.0"
88
keywords:
@@ -25,4 +25,5 @@ annotations:
2525
- name: Support
2626
url: https://github.com/upcloud-tools/upcloud-csi/issues
2727
artifacthub.io/changes: |
28-
- "Chart packages are signed too now"
28+
- "Node DaemonSet switches to --mode=node — credentials no longer deployed to every node"
29+
- "Add root-level clusterZone for both controller and node"

deploy/helm/templates/controller-statefulset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ spec:
214214
- "--endpoint=$(CSI_ENDPOINT)"
215215
- "--nodehost=$(NODE_ID)"
216216
- "--mode=monolith"
217-
{{- with .Values.controller.zone }}
217+
{{- with .Values.clusterZone }}
218218
- "--zone={{ . }}"
219219
{{- end }}
220220
- "--address=tcp://0.0.0.0:13071"

deploy/helm/templates/node-daemonset.yaml

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ spec:
3030
{{ tpl (toYaml .) $ | indent 8 }}
3131
{{- end }}
3232
annotations:
33-
checksum/credentials: {{ include "upcloud-csi.credentialsChecksum" . | quote }}
3433
{{- with .Values.node.podAnnotations }}
3534
{{ tpl (toYaml .) $ | indent 8 }}
3635
{{- end }}
@@ -119,8 +118,8 @@ spec:
119118
args:
120119
- "--endpoint=$(CSI_ENDPOINT)"
121120
- "--nodehost=$(NODE_ID)"
122-
- "--mode=monolith"
123-
{{- with .Values.controller.zone }}
121+
- "--mode=node"
122+
{{- with .Values.clusterZone }}
124123
- "--zone={{ . }}"
125124
{{- end }}
126125
- "--address=tcp://0.0.0.0:13071"
@@ -130,24 +129,6 @@ spec:
130129
env:
131130
- name: CSI_ENDPOINT
132131
value: unix:///csi/csi.sock
133-
- name: UPCLOUD_USERNAME
134-
valueFrom:
135-
secretKeyRef:
136-
name: {{ include "upcloud-csi.credentialsSecret" . }}
137-
key: username
138-
optional: true
139-
- name: UPCLOUD_PASSWORD
140-
valueFrom:
141-
secretKeyRef:
142-
name: {{ include "upcloud-csi.credentialsSecret" . }}
143-
key: password
144-
optional: true
145-
- name: UPCLOUD_TOKEN
146-
valueFrom:
147-
secretKeyRef:
148-
name: {{ include "upcloud-csi.credentialsSecret" . }}
149-
key: {{ .Values.credentials.tokenKey }}
150-
optional: true
151132
- name: NODE_ID
152133
valueFrom:
153134
fieldRef:

deploy/helm/tests/credentials_test.yaml

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,3 @@ tests:
8787
path: spec.template.spec.containers[4].env[3].valueFrom.secretKeyRef.key
8888
value: my-token
8989

90-
- it: node should have UPCLOUD_TOKEN env var
91-
template: node-daemonset.yaml
92-
asserts:
93-
- equal:
94-
path: spec.template.spec.containers[1].env[3].name
95-
value: UPCLOUD_TOKEN
96-
- equal:
97-
path: spec.template.spec.containers[1].env[3].valueFrom.secretKeyRef.key
98-
value: token
99-
- equal:
100-
path: spec.template.spec.containers[1].env[3].valueFrom.secretKeyRef.name
101-
value: upcloud
102-
103-
- it: node UPCLOUD_TOKEN should use custom tokenKey
104-
set:
105-
credentials:
106-
tokenKey: my-token
107-
template: node-daemonset.yaml
108-
asserts:
109-
- equal:
110-
path: spec.template.spec.containers[1].env[3].name
111-
value: UPCLOUD_TOKEN
112-
- equal:
113-
path: spec.template.spec.containers[1].env[3].valueFrom.secretKeyRef.key
114-
value: my-token

deploy/helm/values.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ fullnameOverride: ""
77
# -- Common labels added to all resources.
88
commonLabels: {}
99

10+
# -- UpCloud zone (e.g. de-fra1). Passed to both controller and node pods.
11+
# The controller discovers it automatically if empty.
12+
clusterZone: "" # @schema type:string
13+
1014
# -- Default log verbosity, overridable per component.
1115
logLevel: 5
1216

@@ -37,8 +41,6 @@ image: # @schema additionalProperties: false
3741

3842
# Controller StatefulSet settings.
3943
controller: # @schema additionalProperties: false
40-
# -- UpCloud zone (e.g. de-fra1). Auto-detected from node hostname if empty.
41-
zone: "" # @schema type:string
4244
# -- Log verbosity (inherits global logLevel when null).
4345
logLevel: # @schema type:[integer, null]; minimum:0; maximum:10
4446

test/e2e/clusterissuer.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: cert-manager.io/v1
2+
kind: ClusterIssuer
3+
metadata:
4+
name: e2e-selfsigned
5+
spec:
6+
selfSigned: {}

0 commit comments

Comments
 (0)