Skip to content

Commit

Permalink
add explicit securityContexts to the controller and namespace label f…
Browse files Browse the repository at this point in the history
…or privileged

This does not really change the configuration, it just makes it explicit and enforce
the defaults, except for the seccompPolicy which changes from Unconfined to RuntimeDefault.
Syscalls filtered by RuntimeDefault policy are 95% namespaced and require capabilities
(which we drop) in the first place, so no practical change there either.

This allows the controller to be compatible to the restricted pod security admission profile.
However, the nmi daemonset requires the privileged profile which is why this also adds the
corresponding label to the namespace, to allow cluster-wide enforcement of a policy lower
than privileged, while preserving privileged for the capz-system namespace.

This is a recommendation in the CAPI v1.3->1.4 upgrade guide.
  • Loading branch information
chrischdi committed Apr 6, 2023
1 parent c125458 commit aff2982
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/default/namespace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@ apiVersion: v1
kind: Namespace
metadata:
name: system
labels:
# this is required due to the nmi daemonset
pod-security.kubernetes.io/enforce: privileged
11 changes: 11 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsUser: 65532
runAsGroup: 65532
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 10
serviceAccountName: manager
tolerations:
Expand Down

0 comments on commit aff2982

Please sign in to comment.