Skip to content

Commit 5906e25

Browse files
committed
Add skip-map flag to create config
1 parent e45d0d7 commit 5906e25

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cmd/kubebuilder/create/config/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ kubebuilder create config --crds --output myextensionname.yaml
5757
fmt.Printf("Must either specify the name of the extension with --name or set --crds.\n")
5858
return
5959
}
60-
CodeGenerator{}.Execute()
60+
CodeGenerator{SkipMap: skipmap}.Execute()
6161
log.Printf("Config written to %s", output)
6262
},
6363
}
6464

6565
var (
6666
controllerType, controllerImage, name, output, crdNamespace string
67-
crds bool
67+
crds, skipmap bool
6868
)
6969

7070
func AddCreateConfig(cmd *cobra.Command) {
@@ -75,4 +75,5 @@ func AddCreateConfig(cmd *cobra.Command) {
7575
configCmd.Flags().StringVar(&controllerImage, "controller-image", "", "name of the controller container to run.")
7676
configCmd.Flags().StringVar(&name, "name", "", "name of the installation. used to generate the namespace and resource names.")
7777
configCmd.Flags().StringVar(&output, "output", filepath.Join("hack", "install.yaml"), "location to write yaml to")
78+
configCmd.Flags().BoolVar(&skipmap, "skip-map", true, "if set to true, skip validation of map in CRD")
7879
}

cmd/kubebuilder/create/config/gen.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ import (
3636
)
3737

3838
// CodeGenerator generates code for Kubernetes resources and controllers
39-
type CodeGenerator struct{}
39+
type CodeGenerator struct{
40+
SkipMap bool
41+
}
4042

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

70-
arguments.CustomArgs = &parse.ParseOptions{SkipMap: true}
72+
arguments.CustomArgs = &parse.ParseOptions{SkipMap: g.SkipMap}
7173

7274
p := parse.NewAPIs(c, arguments)
7375
if crds {

0 commit comments

Comments
 (0)