Skip to content

Commit

Permalink
overriding creating example reconcile bodyoption if not creating reso…
Browse files Browse the repository at this point in the history
…urce
  • Loading branch information
Mengqi Yu committed Jul 19, 2018
1 parent 88726be commit 14bffff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/kubebuilder/v1/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ func (o *apiOptions) RunAddAPI() {
if err != nil {
log.Fatal(err)
}
} else {
// disable generation of example reconcile body if not scaffolding resource
// because this could result in a fork-bomb of k8s resources where watching a
// deployment, replicaset etc. results in generating deployment which
// end up genrating replicaset, pod etc recursively.
r.CreateExampleReconcileBody = false
}

if o.doController {
Expand Down Expand Up @@ -172,6 +178,6 @@ func ResourceForFlags(f *flag.FlagSet) *resource.Resource {
f.StringVar(&r.Version, "version", "", "resource Version")
f.BoolVar(&r.Namespaced, "namespaced", true, "resource is namespaced")
f.BoolVar(&r.CreateExampleReconcileBody, "example", true,
"true if an example reconcile body should be written")
"if true an example reconcile body should be written while scaffolding a resource.")
return r
}

0 comments on commit 14bffff

Please sign in to comment.