Skip to content

Commit a604c90

Browse files
committed
fix: Clean up MetalLB pod security standards labels
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 polify version, even on upgrade. This is fine because we are specifying the omst privileged pod security standard, `privileged`, and as such should be safe to always enfore the latest policy version.
1 parent 552d824 commit a604c90

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

pkg/handlers/generic/lifecycle/serviceloadbalancer/metallb/handler.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ const (
3535
// These labels allow the MetalLB speaker pod to obtain elevated permissions,
3636
// which it requires in order to perform its network functionalities.
3737
var podSecurityReleaseNamespaceLabels = map[string]string{
38-
"pod-security.kubernetes.io/enforce": "privileged",
39-
"pod-security.kubernetes.io/audit": "privileged",
40-
"pod-security.kubernetes.io/warn": "privileged",
38+
"pod-security.kubernetes.io/enforce": "privileged",
39+
"pod-security.kubernetes.io/enforce-version": "latest",
4140
}
4241

4342
type Config struct {

pkg/handlers/utils/utils.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ func EnsureNamespaceWithName(ctx context.Context, c ctrlclient.Client, name stri
103103
func EnsureNamespaceWithMetadata(ctx context.Context,
104104
c ctrlclient.Client,
105105
name string,
106-
labels,
107-
annotations map[string]string,
106+
labels, annotations map[string]string,
108107
) error {
109108
ns := &corev1.Namespace{
110109
TypeMeta: metav1.TypeMeta{

0 commit comments

Comments
 (0)