Skip to content

Commit ab8509b

Browse files
committed
set required-scc for openshift workloads
1 parent 41ea2a9 commit ab8509b

6 files changed

+13
-0
lines changed

bindata/nodecadaemon.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ spec:
1515
metadata:
1616
annotations:
1717
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
18+
openshift.io/required-scc: privileged
1819
labels:
1920
name: node-ca
2021
spec:

manifests/07-operator-ibm-cloud-managed.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ spec:
1818
template:
1919
metadata:
2020
annotations:
21+
openshift.io/required-scc: restricted-v2
2122
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
2223
labels:
2324
name: cluster-image-registry-operator

manifests/07-operator.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ spec:
2020
metadata:
2121
annotations:
2222
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
23+
openshift.io/required-scc: restricted-v2
2324
labels:
2425
name: cluster-image-registry-operator
2526
spec:

pkg/resource/azurepathfixjob.go

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
configapiv1 "github.com/openshift/api/config/v1"
2323
imageregistryv1 "github.com/openshift/api/imageregistry/v1"
24+
securityv1 "github.com/openshift/api/security/v1"
2425
configlisters "github.com/openshift/client-go/config/listers/config/v1"
2526
"github.com/openshift/cluster-image-registry-operator/pkg/defaults"
2627
"github.com/openshift/cluster-image-registry-operator/pkg/storage/azure"
@@ -217,6 +218,11 @@ func (gapfj *generatorAzurePathFixJob) expected() (runtime.Object, error) {
217218
Spec: batchv1.JobSpec{
218219
BackoffLimit: &backoffLimit,
219220
Template: kcorev1.PodTemplateSpec{
221+
ObjectMeta: metav1.ObjectMeta{
222+
Annotations: map[string]string{
223+
securityv1.RequiredSCCAnnotation: "restricted-v2",
224+
},
225+
},
220226
Spec: kcorev1.PodSpec{
221227
RestartPolicy: kcorev1.RestartPolicyNever,
222228
ServiceAccountName: defaults.ServiceAccountName,

pkg/resource/deployment.go

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818

1919
imageregistryv1 "github.com/openshift/api/imageregistry/v1"
2020
operatorv1 "github.com/openshift/api/operator/v1"
21+
securityv1 "github.com/openshift/api/security/v1"
2122
configlisters "github.com/openshift/client-go/config/listers/config/v1"
2223
"github.com/openshift/library-go/pkg/operator/events"
2324
"github.com/openshift/library-go/pkg/operator/resource/resourceapply"
@@ -94,6 +95,7 @@ func (gd *generatorDeployment) expected() (runtime.Object, error) {
9495
podTemplateSpec.Annotations = map[string]string{}
9596
}
9697
podTemplateSpec.Annotations[defaults.ChecksumOperatorDepsAnnotation] = depsChecksum
98+
podTemplateSpec.Annotations[securityv1.RequiredSCCAnnotation] = "restricted-v2"
9799

98100
// Strategy defaults to RollingUpdate
99101
deployStrategy := appsapi.DeploymentStrategyType(gd.cr.Spec.RolloutStrategy)

pkg/resource/prunercronjob.go

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
batchlisters "k8s.io/client-go/listers/batch/v1"
1616

1717
imageregistryapiv1 "github.com/openshift/api/imageregistry/v1"
18+
securityv1 "github.com/openshift/api/security/v1"
1819
configv1listers "github.com/openshift/client-go/config/listers/config/v1"
1920
imageregistryv1listers "github.com/openshift/client-go/imageregistry/listers/imageregistry/v1"
2021
"github.com/openshift/library-go/pkg/operator/loglevel"
@@ -174,6 +175,7 @@ done
174175
},
175176
}
176177
cj.Spec.JobTemplate.Labels = map[string]string{"created-by": gcj.GetName()}
178+
cj.Spec.JobTemplate.Annotations = map[string]string{securityv1.RequiredSCCAnnotation: "restricted-v2"}
177179
return cj, nil
178180
}
179181

0 commit comments

Comments
 (0)