Skip to content

Commit 14bffff

Browse files
author
Mengqi Yu
committed
overriding creating example reconcile bodyoption if not creating resource
1 parent 88726be commit 14bffff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/kubebuilder/v1/api.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ func (o *apiOptions) RunAddAPI() {
7777
if err != nil {
7878
log.Fatal(err)
7979
}
80+
} else {
81+
// disable generation of example reconcile body if not scaffolding resource
82+
// because this could result in a fork-bomb of k8s resources where watching a
83+
// deployment, replicaset etc. results in generating deployment which
84+
// end up genrating replicaset, pod etc recursively.
85+
r.CreateExampleReconcileBody = false
8086
}
8187

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

0 commit comments

Comments
 (0)