From 8a9c98ea6b894a9918ae90f977cfc2b50855b26f Mon Sep 17 00:00:00 2001 From: Mengqi Yu Date: Wed, 19 Jun 2019 17:59:12 -0700 Subject: [PATCH] :bug: ensure defaults are set for controller-gen all Set defaults. And revert the name change, though it's not a breaking change. --- cmd/controller-gen/main.go | 7 ++----- pkg/rbac/manifests.go | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/controller-gen/main.go b/cmd/controller-gen/main.go index 74c29d21d..b28113ec0 100644 --- a/cmd/controller-gen/main.go +++ b/cmd/controller-gen/main.go @@ -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) } diff --git a/pkg/rbac/manifests.go b/pkg/rbac/manifests.go index 629480ec1..5800fbeb8 100644 --- a/pkg/rbac/manifests.go +++ b/pkg/rbac/manifests.go @@ -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 @@ -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