Skip to content

Commit

Permalink
Merge pull request #229 from mengqiy/fixrbacbug
Browse files Browse the repository at this point in the history
🐛 ensure defaults are set for controller-gen all
  • Loading branch information
k8s-ci-robot authored Jun 20, 2019
2 parents b8adde9 + 8a9c98e commit 464fbed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions cmd/controller-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,8 @@ Usage:
fmt.Printf("CRD manifests generated under '%s' \n", crdGen.OutputDir)

// RBAC generation
rbacOptions := &rbac.ManifestOptions{
InputDir: filepath.Join(projectDir, "pkg"),
OutputDir: filepath.Join(projectDir, "config", "rbac"),
Name: "manager",
}
rbacOptions := &rbac.ManifestOptions{}
rbacOptions.SetDefaults()
if err := rbac.Generate(rbacOptions); err != nil {
log.Fatal(err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/rbac/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (o *ManifestOptions) RoleName() string {
// RoleFileName returns the name of the manifest file to use for the role.
func (o *ManifestOptions) RoleFileName() string {
if len(o.RoleFile) == 0 {
return o.Name + "_role.yaml"
return "rbac_role.yaml"
}
// TODO: validate file name
return o.RoleFile
Expand All @@ -71,7 +71,7 @@ func (o *ManifestOptions) RoleBindingName() string {
// RoleBindingFileName returns the name of the manifest file to use for the role binding.
func (o *ManifestOptions) RoleBindingFileName() string {
if len(o.BindingFile) == 0 {
return o.Name + "_role_binding.yaml"
return "rbac_role_binding.yaml"
}
// TODO: validate file name
return o.BindingFile
Expand Down

0 comments on commit 464fbed

Please sign in to comment.