Skip to content

Commit b366df2

Browse files
committed
Move required-scc annotation from the deployment to the pod where it is required.
1 parent 56773e1 commit b366df2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pkg/operator/sync.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package operator
33
import (
44
"context"
55
"fmt"
6+
"maps"
67
"os"
78
"slices"
89
"strings"
@@ -22,6 +23,7 @@ import (
2223

2324
v1 "github.com/openshift/api/config/v1"
2425
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
26+
securityv1 "github.com/openshift/api/security/v1"
2527
"github.com/openshift/library-go/pkg/operator/events"
2628
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
2729
"github.com/openshift/library-go/pkg/operator/resource/resourcehash"
@@ -447,8 +449,7 @@ func newDeployment(config *OperatorConfig, features map[string]bool) *appsv1.Dep
447449
Name: "machine-api-controllers",
448450
Namespace: config.TargetNamespace,
449451
Annotations: map[string]string{
450-
maoOwnedAnnotation: "",
451-
"openshift.io/required-scc": "restricted-v2",
452+
maoOwnedAnnotation: "",
452453
},
453454
Labels: map[string]string{
454455
"api": "clusterapi",
@@ -594,9 +595,15 @@ func newPodTemplateSpec(config *OperatorConfig, features map[string]bool) *corev
594595
}
595596
volumes = append(volumes, newRBACConfigVolumes()...)
596597

598+
annotations := map[string]string{
599+
securityv1.RequiredSCCAnnotation: "restricted-v2",
600+
}
601+
602+
maps.Insert(annotations, maps.All(commonPodTemplateAnnotations))
603+
597604
return &corev1.PodTemplateSpec{
598605
ObjectMeta: metav1.ObjectMeta{
599-
Annotations: commonPodTemplateAnnotations,
606+
Annotations: annotations,
600607
Labels: map[string]string{
601608
"api": "clusterapi",
602609
"k8s-app": "controller",

0 commit comments

Comments
 (0)