-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
splits rolebindingscontroller per capability
- Loading branch information
1 parent
bf7e939
commit d614243
Showing
7 changed files
with
107 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
pkg/authorization/defaultrolebindings/project_policy_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package defaultrolebindings | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/go-cmp/cmp" | ||
"k8s.io/apimachinery/pkg/util/sets" | ||
) | ||
|
||
func TestRoleBindingsForController(t *testing.T) { | ||
tests := map[string]struct { | ||
controller string | ||
expectedRoleBindingsNames sets.Set[string] | ||
}{ | ||
"test-builder": { | ||
controller: "BuilderRoleBindingController", | ||
expectedRoleBindingsNames: sets.Set[string]{"system:image-builders": {}}, | ||
}, | ||
"test-deployer": { | ||
controller: "DeployerRoleBindingController", | ||
expectedRoleBindingsNames: sets.Set[string]{"system:deployers": {}}, | ||
}, | ||
"test-image-puller": { | ||
controller: "ImagePullerRoleBindingController", | ||
expectedRoleBindingsNames: sets.Set[string]{"system:image-pullers": {}}, | ||
}, | ||
"test-default": { | ||
controller: "DefaultRoleBindingController", | ||
expectedRoleBindingsNames: sets.Set[string]{"system:image-pullers": {}, | ||
"system:image-builders": {}, | ||
"system:deployers": {}, | ||
}, | ||
}, | ||
} | ||
|
||
for tName, tCase := range tests { | ||
t.Run(tName, func(t *testing.T) { | ||
controllerRoleBindings := GetRoleBindingsForController(tCase.controller) | ||
roleBindingNames := GetBootstrapServiceAccountProjectRoleBindingNames(controllerRoleBindings) | ||
|
||
if !cmp.Equal(roleBindingNames, tCase.expectedRoleBindingsNames) { | ||
t.Fatalf("expected %v, got %#v", tCase.expectedRoleBindingsNames, roleBindingNames) | ||
} | ||
|
||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
vendor/github.com/openshift/api/openshiftcontrolplane/v1/types.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.