Skip to content

Commit

Permalink
Add skip-map flag to create config
Browse files Browse the repository at this point in the history
  • Loading branch information
Liujingfang1 committed May 16, 2018
1 parent e45d0d7 commit 5906e25
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions cmd/kubebuilder/create/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ kubebuilder create config --crds --output myextensionname.yaml
fmt.Printf("Must either specify the name of the extension with --name or set --crds.\n")
return
}
CodeGenerator{}.Execute()
CodeGenerator{SkipMap: skipmap}.Execute()
log.Printf("Config written to %s", output)
},
}

var (
controllerType, controllerImage, name, output, crdNamespace string
crds bool
crds, skipmap bool
)

func AddCreateConfig(cmd *cobra.Command) {
Expand All @@ -75,4 +75,5 @@ func AddCreateConfig(cmd *cobra.Command) {
configCmd.Flags().StringVar(&controllerImage, "controller-image", "", "name of the controller container to run.")
configCmd.Flags().StringVar(&name, "name", "", "name of the installation. used to generate the namespace and resource names.")
configCmd.Flags().StringVar(&output, "output", filepath.Join("hack", "install.yaml"), "location to write yaml to")
configCmd.Flags().BoolVar(&skipmap, "skip-map", true, "if set to true, skip validation of map in CRD")
}
6 changes: 4 additions & 2 deletions cmd/kubebuilder/create/config/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ import (
)

// CodeGenerator generates code for Kubernetes resources and controllers
type CodeGenerator struct{}
type CodeGenerator struct{
SkipMap bool
}

var kblabels = map[string]string{
"kubebuilder.k8s.io": version.GetVersion().KubeBuilderVersion,
Expand Down Expand Up @@ -67,7 +69,7 @@ func (g CodeGenerator) Execute() error {
return fmt.Errorf("Failed making a context: %v", err)
}

arguments.CustomArgs = &parse.ParseOptions{SkipMap: true}
arguments.CustomArgs = &parse.ParseOptions{SkipMap: g.SkipMap}

p := parse.NewAPIs(c, arguments)
if crds {
Expand Down

0 comments on commit 5906e25

Please sign in to comment.