Skip to content

Commit fb5fa52

Browse files
committed
Tidy verb vars together with comment & issue link
Signed-off-by: Brett Tofel <[email protected]>
1 parent bd57a65 commit fb5fa52

File tree

1 file changed

+8
-7
lines changed
  • internal/operator-controller/authorization

1 file changed

+8
-7
lines changed

internal/operator-controller/authorization/rbac.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ type ScopedPolicyRules struct {
4646

4747
var objectVerbs = []string{"get", "patch", "update", "delete"}
4848

49+
// Here we are splitting collection verbs based on required scope
50+
// NB: this split is tightly coupled to the requirements of the contentmanager, specifically
51+
// its need for cluster-scoped list/watch permissions.
52+
// TODO: We are accepting this coupling for now, but plan to decouple
53+
// TODO: link for above https://github.com/operator-framework/operator-controller/issues/1911
54+
var namespacedCollectionVerbs = []string{"create"}
55+
var clusterCollectionVerbs = []string{"list", "watch"}
56+
4957
type rbacPreAuthorizer struct {
5058
authorizer authorizer.Authorizer
5159
ruleResolver validation.AuthorizationRuleResolver
@@ -302,13 +310,6 @@ func (dm *decodedManifest) rbacObjects() []client.Object {
302310
func (dm *decodedManifest) asAuthorizationAttributesRecordsForUser(manifestManager user.Info, ext *ocv1.ClusterExtension) []authorizer.AttributesRecord {
303311
var attributeRecords []authorizer.AttributesRecord
304312

305-
// Here we are splitting collection verbs based on required scope
306-
// NB: this split is tightly coupled to the requirements of the contentmanager, specifically
307-
// its need for cluster-scoped list/watch permissions.
308-
// TODO: We are accepting this coupling for now, but plan to decouple
309-
namespacedCollectionVerbs := []string{"create"}
310-
clusterCollectionVerbs := []string{"list", "watch"}
311-
312313
for gvr, keys := range dm.gvrs {
313314
namespaces := sets.New[string]()
314315
for _, k := range keys {

0 commit comments

Comments
 (0)