Skip to content

Commit 9e1eda8

Browse files
committed
internal/pkg/scaffold/crd.go: remove controller-gen annotation
1 parent 1a8d2d1 commit 9e1eda8

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

internal/pkg/scaffold/crd.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,21 @@ func (s *CRD) CustomRender() ([]byte, error) {
114114
if err = yaml.Unmarshal(b, crd); err != nil {
115115
return nil, err
116116
}
117-
// controller-tools does not set ListKind or Singular names.
118-
setCRDNamesForResource(crd, s.Resource)
117+
118+
// controller-tools inserts an annotation and assumes that the binary
119+
// that creates the CRD is controller-gen. In this case, we don't use
120+
// controller-gen. Instead, we vendor and use the same library that
121+
// controller-gen does.
122+
//
123+
// The value that gets populated in the annotation is based on the
124+
// build info of the compiled binary, not on the version of the
125+
// vendored controller-tools library.
126+
//
127+
// See: https://github.com/kubernetes-sigs/controller-tools/issues/348
128+
//
129+
// TODO(joelanford): Sort out what to do with this. Until then, let's
130+
// just remove it.
131+
delete(crd.Annotations, "controller-gen.kubebuilder.io/version")
119132
} else {
120133
// There are currently no commands to update CRD manifests for non-Go
121134
// operators, so if a CRD manifest already exists for this gvk, this

0 commit comments

Comments
 (0)