-
Notifications
You must be signed in to change notification settings - Fork 1.8k
internal/pkg/scaffold/crd.go: overwrite CRD manifests for Go operators #1278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
AlexNPavel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
Also related #1323 |
override PROJECT file check by the CRD generator Gopkg.toml: add controller-tools override (temporary)
aaf0cee to
6dc5d8b
Compare
|
New changes are detected. LGTM label has been removed. |
| IsOperatorGo bool | ||
|
|
||
| once sync.Once | ||
| fs afero.Fs // For testing, ex. afero.NewMemMapFs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm repeating this pattern from CSV generation for easier testing. In the future this should be refactored into Input so all scaffolds can access a test afero.Fs.
|
Worth mentioning this in the CHANGELOG to warn users expecting to preserve manual edits to the CRD manifest. |
hasbro17
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM after nit.
operator-framework#1278) * internal/pkg/scaffold: overwrite CRD's with newly generated ones unless operator is non-go * internal/pkg/scaffold/crd.go: set names if not empty, and set Repo to override PROJECT file check by the CRD generator * Gopkg.toml: add controller-tools override (temporary) * revendor * CHANGELOG.md: added kubebuilder annotation bug and change entries
Description of the change: overwrite on-disk CRD manifests for Go operators.
Motivation for the change:
controller-toolsCRD generator is used for Go operators. This generator supports most OpenAPIv3 validation properties, and other nice-to-have automation, through Go code annotations. Annotations for all validation properties is a WIP. Generating CRD manifests using these annotations is more reproducible and robust than preserving data in on-disk CRD manifests, so they should be overwritten every time a command that scaffolds a CRD manifest is invoked.Closes #1212, closes #1323