Skip to content

AUTH-482: Move required-scc annotation from deployment to pod #1343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkg/operator/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package operator
import (
"context"
"fmt"
"maps"
"os"
"slices"
"strings"
Expand All @@ -22,6 +23,7 @@ import (

v1 "github.com/openshift/api/config/v1"
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
securityv1 "github.com/openshift/api/security/v1"
"github.com/openshift/library-go/pkg/operator/events"
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
"github.com/openshift/library-go/pkg/operator/resource/resourcehash"
Expand Down Expand Up @@ -447,8 +449,7 @@ func newDeployment(config *OperatorConfig, features map[string]bool) *appsv1.Dep
Name: "machine-api-controllers",
Namespace: config.TargetNamespace,
Annotations: map[string]string{
maoOwnedAnnotation: "",
"openshift.io/required-scc": "restricted-v2",
maoOwnedAnnotation: "",
},
Labels: map[string]string{
"api": "clusterapi",
Expand Down Expand Up @@ -594,9 +595,15 @@ func newPodTemplateSpec(config *OperatorConfig, features map[string]bool) *corev
}
volumes = append(volumes, newRBACConfigVolumes()...)

annotations := map[string]string{
securityv1.RequiredSCCAnnotation: "restricted-v2",
}

maps.Insert(annotations, maps.All(commonPodTemplateAnnotations))

return &corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Annotations: commonPodTemplateAnnotations,
Annotations: annotations,
Labels: map[string]string{
"api": "clusterapi",
"k8s-app": "controller",
Expand Down