mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-19 06:26:44 +00:00
Embed CRD manifests via go:embed instead of codegen (#10329)
config/crd/{v1,v2alpha1}/crds/crds.go were generated files that
gzip-compressed the CRD YAML bases into committed []byte literals via
hack/crd-gen, requiring `go generate` and a dedicated CI drift check
(hack/verify-generated-crd-code.sh). This made the files large,
unreviewable in diffs, and a frequent source of merge conflicts.
Replace the generated files with config/crd/{v1,v2alpha1}/crds.go
using `//go:embed bases/*.yaml` to embed the already-committed YAML
manifests directly, decoding them the same way at init. Since Go's
go:embed can't reach outside a file's own directory tree, the crds
package now lives alongside bases/ instead of in a bases-sibling
subdirectory; import paths in pkg/install and pkg/controller were
updated accordingly.
Drop hack/crd-gen and hack/verify-generated-crd-code.sh entirely, and
trim their references from update-3generated-crd-code.sh and the
codespell skip-list. No codegen step remains, so no drift is possible.
Fixes #10328
AI-Tool-Used: Claude Code
AI-Tool-Use-Level: Category 1 (High)
AI-Code-Category: Category 1 (Production)
Signed-off-by: lubronzhan <lubron.zhan@broadcom.com>
Co-authored-by: Daniel Jiang <daniel.jiang@broadcom.com>
This commit is contained in:
@@ -55,6 +55,6 @@ controller-gen \
|
||||
paths=./pkg/controller/... \
|
||||
rbac:roleName=velero-perms
|
||||
|
||||
go generate ./config/crd/v1/crds
|
||||
|
||||
go generate ./config/crd/v2alpha1/crds
|
||||
# The CRD manifests above are embedded directly into the binary via
|
||||
# go:embed (see config/crd/v1/crds.go and config/crd/v2alpha1/crds.go),
|
||||
# so no further code generation step is required.
|
||||
|
||||
Reference in New Issue
Block a user