Skip to content

Commit ddc429c

Browse files
test(e2e): pre-apply cozy-system namespace before helm install
The chart fix (3a87485, be0a668) removes the chart-defined Namespace without replacing it. On the Talos E2E cluster the apiserver enforces PodSecurity baseline-by-default on bare namespaces, so the cozystack- operator pod (hostNetwork=true) is rejected if cozy-system is created without enforce=privileged. Apply the namespace from the bats with the labels the operator depends on, then run helm install without --create-namespace. Mirrors the documented production install procedure for the new chart shape. Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent be0a668 commit ddc429c

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

‎hack/e2e-install-cozystack.bats‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,30 @@
88
}
99

1010
@test "Install Cozystack" {
11+
# Pre-create the cozy-system namespace with the labels the operator pod needs.
12+
# The chart no longer ships a Namespace resource (helm v3's --create-namespace
13+
# collides with chart-defined Namespace). On Talos clusters that enforce PSA
14+
# baseline-by-default, the cozystack-operator pod (hostNetwork=true) is
15+
# rejected unless the namespace is labelled enforce=privileged BEFORE the
16+
# pod is scheduled. A pre-install hook can't bootstrap that label because
17+
# the hook itself runs in the same namespace and faces the same PSA gate.
18+
# So apply the namespace from the caller (this bats / production install docs)
19+
# — same pattern as kube-prometheus-stack, argo-cd, cert-manager.
20+
kubectl apply -f - <<'EOF'
21+
apiVersion: v1
22+
kind: Namespace
23+
metadata:
24+
name: cozy-system
25+
labels:
26+
cozystack.io/system: "true"
27+
cozystack.io/deletion-protected: "true"
28+
pod-security.kubernetes.io/enforce: privileged
29+
EOF
30+
1131
# Install cozy-installer chart (operator installs CRDs on startup via --install-crds).
12-
# The chart's pre-install hook patches PSA + cozystack labels onto cozy-system
13-
# after --create-namespace bootstraps it.
1432
helm upgrade installer packages/core/installer \
1533
--install \
1634
--namespace cozy-system \
17-
--create-namespace \
1835
--set cozystackOperator.helmReleaseInterval=30s \
1936
--wait \
2037
--timeout 2m

0 commit comments

Comments
 (0)