Skip to content

Commit

Permalink
fix: Clean up MetalLB pod security standards labels (#807)
Browse files Browse the repository at this point in the history
This commit removes the `pod-security.kubernetes.io/audit` and
`pod-security.kubernetes.io/warn` labels as they are redundant when
specifying the `pod-security.kubernetes.io/enforce` label to the same
level.

Also add the `pod-security.kubernetes.io/enforce-version` label to
always enforce the latest pod security policy version, even on upgrade.
This is fine because we are specifying the most privileged pod security
standard, `privileged`, and as such should be safe to always enforce the
latest policy version.
  • Loading branch information
jimmidyson authored Jul 16, 2024
1 parent 552d824 commit 7e04852
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ const (
// These labels allow the MetalLB speaker pod to obtain elevated permissions,
// which it requires in order to perform its network functionalities.
var podSecurityReleaseNamespaceLabels = map[string]string{
"pod-security.kubernetes.io/enforce": "privileged",
"pod-security.kubernetes.io/audit": "privileged",
"pod-security.kubernetes.io/warn": "privileged",
"pod-security.kubernetes.io/enforce": "privileged",
"pod-security.kubernetes.io/enforce-version": "latest",
}

type Config struct {
Expand Down
3 changes: 1 addition & 2 deletions pkg/handlers/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ func EnsureNamespaceWithName(ctx context.Context, c ctrlclient.Client, name stri
func EnsureNamespaceWithMetadata(ctx context.Context,
c ctrlclient.Client,
name string,
labels,
annotations map[string]string,
labels, annotations map[string]string,
) error {
ns := &corev1.Namespace{
TypeMeta: metav1.TypeMeta{
Expand Down

0 comments on commit 7e04852

Please sign in to comment.