Skip to content

Commit

Permalink
Format go code
Browse files Browse the repository at this point in the history
Signed-off-by: Knative Automation <[email protected]>
  • Loading branch information
knative-automation committed Nov 3, 2022
1 parent da892df commit 7c62c2e
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/discovery/v1alpha1/clusterducktype_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/discovery/v1alpha1/register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
13 changes: 8 additions & 5 deletions pkg/collection/ducks.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ func (dh *duckHunter) Ducks() map[string][]v1alpha1.ResourceMeta {
}

// setAccessibleViaClusterRole sets the AccessibleViaClusterRole flag on each duck if
// the ClusterRole can preform the expected verbs on the duck
//
// the ClusterRole can preform the expected verbs on the duck
func setAccessibleViaClusterRole(metas []v1alpha1.ResourceMeta, accessibleGroupResources map[string]bool, kindToResource map[string]string) {
for index, meta := range metas {
// TODO: it would be nice if ResourceMeta had a version-free unique hash to do this.
Expand Down Expand Up @@ -333,8 +334,9 @@ func version(meta v1alpha1.ResourceMeta) string {

// accessibleGroupResources finds the rules in the ClusterRole that satisfy the expectedVerbs
// and returns a map of
// key: apiGroup + ":" + resource
// value: true if Rule satisfies the expectedVerbs, false otherwise
//
// key: apiGroup + ":" + resource
// value: true if Rule satisfies the expectedVerbs, false otherwise
func accessibleGroupResources(expectedVerbs []string, clusterRole *rbacv1.ClusterRole) map[string]bool {
groupResources := map[string]bool{}
if clusterRole == nil {
Expand All @@ -355,8 +357,9 @@ func accessibleGroupResources(expectedVerbs []string, clusterRole *rbacv1.Cluste
}

// Returns true if first is a fully contained subset of second
// returns false otherwise
// supports "*" as a wildcard
//
// returns false otherwise
// supports "*" as a wildcard
func isSubset(first, second []string) bool {
set := map[string]bool{}
for _, value := range second {
Expand Down
5 changes: 3 additions & 2 deletions pkg/reconciler/clusterducktype/clusterducktype.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, dt *v1alpha1.ClusterDuck
}

// getAggregatingClusterRole fetches the ClusterRole specified by Spec.Role.RoleRef
// if not set, it will default to using the first LabelSelector in Spec.Selectors to
// match any ClusterRole with a matching AggregationRule
//
// if not set, it will default to using the first LabelSelector in Spec.Selectors to
// match any ClusterRole with a matching AggregationRule
func (r *Reconciler) getAggregatingClusterRole(ctx context.Context, dt *v1alpha1.ClusterDuckType) (*rbacv1.ClusterRole, error) {
if dt.Spec.Role != nil && dt.Spec.Role.RoleRef != nil {
return r.client.RbacV1().ClusterRoles().Get(ctx, dt.Spec.Role.RoleRef.Name, metav1.GetOptions{})
Expand Down

0 comments on commit 7c62c2e

Please sign in to comment.