Skip to content

Commit e031f92

Browse files
committed
Allow setting the pod security labels on the Flux namespace
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
1 parent b8661d4 commit e031f92

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

modules/flux-aio/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ flux -n flux-system uninstall
8888
| `imagePullSecret: username:` | `string` | `null` | Registry username for the generated image pull secret |
8989
| `imagePullSecret: password:` | `string` | `null` | Registry password for the generated image pull secret |
9090
| `compatibility:` | `string` | `kubernetes` | Can be set to `openshift` to make the security context compatible with RedHat OpenShift | |
91+
| `podSecurityProfile:` | `string` | `""` | Can be `privileged` or `restricted`, used for setting the `pod-security.kubernetes.io` labels on the namespace |
9192

9293
### Controllers
9394

modules/flux-aio/debug_values.cue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ values: {
6363
identity: "arn:aws:iam::111122223333:role/my-role"
6464
provider: "aws"
6565
}
66-
hostNetwork: true
67-
securityProfile: "privileged"
66+
hostNetwork: true
67+
podSecurityProfile: "privileged"
68+
securityProfile: "privileged"
6869
resources: {
6970
requests: {
7071
cpu: "250m"

modules/flux-aio/templates/config.cue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ import (
6464

6565
securityProfile: "restricted" | "privileged"
6666

67+
podSecurityProfile: *"" | "restricted" | "privileged"
68+
6769
logLevel: *"info" | string
6870

6971
hostNetwork: *true | bool

modules/flux-aio/templates/namespace.cue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ import (
1010
kind: "Namespace"
1111
metadata: {
1212
name: #config.metadata.namespace
13-
labels: #config.metadata.labels
1413
annotations: #config.metadata.annotations
14+
labels: #config.metadata.labels
15+
if #config.podSecurityProfile != "" {
16+
labels: {
17+
"pod-security.kubernetes.io/enforce": #config.podSecurityProfile
18+
"pod-security.kubernetes.io/warn": #config.podSecurityProfile
19+
"pod-security.kubernetes.io/audit": #config.podSecurityProfile
20+
}
21+
}
1522
}
1623
}

0 commit comments

Comments
 (0)