Skip to content

Commit 6897ce1

Browse files
Merge pull request #1214 from Miciah/OCPBUGS-54650-desiredSubscription-specify-annotations-and-SCC
OCPBUGS-54650, OCPBUGS-54651, OCPBUGS-54652: desiredSubscription: Specify annotations and SCC
2 parents 9537a3f + 4c5265c commit 6897ce1

File tree

18 files changed

+752
-194
lines changed

18 files changed

+752
-194
lines changed

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ require (
2525
github.com/openshift/api v0.0.0-20250305225826-b8da3bfeaf77
2626
github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8
2727
github.com/openshift/library-go v0.0.0-20240419113445-f1541d628746
28-
github.com/operator-framework/api v0.15.0
28+
github.com/operator-framework/api v0.30.0
2929
github.com/pkg/errors v0.9.1
3030
github.com/prometheus/client_golang v1.21.1
3131
github.com/prometheus/common v0.62.0
32-
github.com/spf13/cobra v1.8.1
32+
github.com/spf13/cobra v1.9.1
3333
github.com/stretchr/testify v1.10.0
3434
github.com/summerwind/h2spec v0.0.0-20200804131034-70ac22940108
3535
github.com/tcnksm/go-httpstat v0.2.1-0.20191008022543-e866bb274419
@@ -136,7 +136,7 @@ require (
136136
golang.org/x/text v0.23.0 // indirect
137137
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
138138
google.golang.org/appengine v1.6.8 // indirect
139-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4 // indirect
139+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250227231956-55c901821b1e // indirect
140140
google.golang.org/protobuf v1.36.5 // indirect
141141
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
142142
gopkg.in/inf.v0 v0.9.1 // indirect

go.sum

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH
6464
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
6565
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI=
6666
github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
67-
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
67+
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
6868
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
6969
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7070
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -330,8 +330,8 @@ github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8 h1:HGfbllzRcrJ
330330
github.com/openshift/client-go v0.0.0-20240405120947-c67c8325cdd8/go.mod h1:+VvvaMSTUhOt+rBq7NwRLSNxq06hTeRCBqm0j0PQEq8=
331331
github.com/openshift/library-go v0.0.0-20240419113445-f1541d628746 h1:MyLp0GgPyIgeVd1scI0iUasVgd6Xpy/t04Rk+I23wRE=
332332
github.com/openshift/library-go v0.0.0-20240419113445-f1541d628746/go.mod h1:m/HsttSi90vSixwoy5mPUBHcZid2YRw/QbsLErLxF9s=
333-
github.com/operator-framework/api v0.15.0 h1:4f9i0drtqHj7ykLoHxv92GR43S7MmQHhmFQkfm5YaGI=
334-
github.com/operator-framework/api v0.15.0/go.mod h1:scnY9xqSeCsOdtJtNoHIXd7OtHZ14gj1hkDA4+DlgLY=
333+
github.com/operator-framework/api v0.30.0 h1:44hCmGnEnZk/Miol5o44dhSldNH0EToQUG7vZTl29kk=
334+
github.com/operator-framework/api v0.30.0/go.mod h1:FYxAPhjtlXSAty/fbn5YJnFagt6SpJZJgFNNbvDe5W0=
335335
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
336336
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
337337
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
@@ -367,10 +367,9 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
367367
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
368368
github.com/spf13/cobra v0.0.0-20170118185516-dc208f4211e7/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
369369
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
370-
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
371-
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
370+
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
371+
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
372372
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
373-
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
374373
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
375374
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
376375
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -562,10 +561,10 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98
562561
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
563562
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
564563
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ=
565-
google.golang.org/genproto/googleapis/api v0.0.0-20250122153221-138b5a5a4fd4 h1://y4MHaM7tNLqTeWKyfBIeoAMxwKwRm/nODb5IKA3BE=
566-
google.golang.org/genproto/googleapis/api v0.0.0-20250122153221-138b5a5a4fd4/go.mod h1:AfA77qWLcidQWywD0YgqfpJzf50w2VjzBml3TybHeJU=
567-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4 h1:yrTuav+chrF0zF/joFGICKTzYv7mh/gr9AgEXrVU8ao=
568-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250122153221-138b5a5a4fd4/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50=
564+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950=
565+
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg=
566+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250227231956-55c901821b1e h1:YA5lmSs3zc/5w+xsRcHqpETkaYyK63ivEPzNTcUUlSA=
567+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250227231956-55c901821b1e/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
569568
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
570569
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
571570
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=

pkg/operator/controller/gatewayclass/istio.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ func desiredIstio(name types.NamespacedName, ownerRef metav1.OwnerReference) *sa
119119
Enabled: ptr.To(true),
120120
Env: pilotContainerEnv,
121121
ExtraContainerArgs: []string{},
122+
PodAnnotations: map[string]string{
123+
WorkloadPartitioningManagementAnnotationKey: WorkloadPartitioningManagementPreferredScheduling,
124+
},
122125
},
123126
SidecarInjectorWebhook: &sailv1.SidecarInjectorConfig{
124127
EnableNamespacesByDefault: ptr.To(false),

pkg/operator/controller/gatewayclass/subscription.go

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,27 @@ import (
1010

1111
operatorsv1alpha1 "github.com/operator-framework/api/pkg/operators/v1alpha1"
1212

13+
securityv1 "github.com/openshift/api/security/v1"
1314
operatorcontroller "github.com/openshift/cluster-ingress-operator/pkg/operator/controller"
1415

16+
corev1 "k8s.io/api/core/v1"
1517
"k8s.io/apimachinery/pkg/api/errors"
18+
"k8s.io/apimachinery/pkg/api/resource"
1619
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1720
"k8s.io/apimachinery/pkg/types"
1821
)
1922

23+
const (
24+
// RequiredSCCRestrictedV2 is name of the "restricted-v2" SCC.
25+
RequiredSCCRestrictedV2 = "restricted-v2"
26+
// WorkloadPartitioningManagementAnnotationKey is the annotation key for
27+
// workload partitioning.
28+
WorkloadPartitioningManagementAnnotationKey = "target.workload.openshift.io/management"
29+
// WorkloadPartitioningManagementPreferredScheduling is the annotation
30+
// value for preferred scheduling of workload.
31+
WorkloadPartitioningManagementPreferredScheduling = `{"effect": "PreferredDuringScheduling"}`
32+
)
33+
2034
// ensureServiceMeshOperatorSubscription attempts to ensure that a subscription
2135
// for servicemeshoperator is present and returns a Boolean indicating whether
2236
// it exists, the subscription if it exists, and an error value.
@@ -59,7 +73,24 @@ func desiredSubscription(name types.NamespacedName, gwapiOperatorChannel, gwapiO
5973
},
6074
},
6175
Spec: &operatorsv1alpha1.SubscriptionSpec{
62-
Channel: gwapiOperatorChannel,
76+
Channel: gwapiOperatorChannel,
77+
Config: &operatorsv1alpha1.SubscriptionConfig{
78+
// Resources is the default resources minus
79+
// limits, which pods in platform namespaces
80+
// are not permitted by OpenShift conventions
81+
// to set.
82+
Resources: &corev1.ResourceRequirements{
83+
Limits: corev1.ResourceList{},
84+
Requests: corev1.ResourceList{
85+
corev1.ResourceCPU: resource.MustParse("10m"),
86+
corev1.ResourceMemory: resource.MustParse("64Mi"),
87+
},
88+
},
89+
Annotations: map[string]string{
90+
securityv1.RequiredSCCAnnotation: RequiredSCCRestrictedV2,
91+
WorkloadPartitioningManagementAnnotationKey: WorkloadPartitioningManagementPreferredScheduling,
92+
},
93+
},
6394
InstallPlanApproval: operatorsv1alpha1.ApprovalManual,
6495
Package: "servicemeshoperator3",
6596
CatalogSource: "redhat-operators",

vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/catalogsource_types.go

Lines changed: 63 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/clusterserviceversion.go

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/clusterserviceversion_types.go

Lines changed: 34 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/operator-framework/api/pkg/operators/v1alpha1/installplan_types.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)