Commit 2018c28
authored
BUG/MINOR: kubernetes-ingress: gate PSP Role and RoleBinding on k8s < 1.25 (#384)
The PodSecurityPolicy template is gated behind a semverCompare "<1.25.0-0"
check, but the Role and RoleBinding that grant "use" on it were only gated
on rbac.create and podSecurityPolicy.enabled. On Kubernetes 1.25 and newer
the chart therefore rendered a Role referencing the policy/podsecuritypolicies
resource, plus its RoleBinding, while the PodSecurityPolicy itself was
correctly omitted.
RBAC rules are not validated against discovery, so these objects applied
without error and were merely dead configuration, but they referenced an API
removed in 1.25 and made podSecurityPolicy.enabled=true look effective on
clusters where it can no longer do anything.
Add the same version gate to both templates so all three objects appear and
disappear together. Verified by rendering with --kube-version: PodSecurityPolicy,
Role and RoleBinding are all present on 1.23 and 1.24, and all absent on 1.25,
1.37 and provider-suffixed versions such as v1.37.1-gke.1000.
Signed-off-by: Dinko Korunic <dkorunic@haproxy.com>1 parent b7998ee commit 2018c28
3 files changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
0 commit comments