Draft
Conversation
This was a gap in our testing. Disable the failing linters, that will fix in later commits.
Also restore the maxlength linter.
Fix the missing `omitzero` marker for CloudCredentialsRef. According to the kubernetes API conventions [1]: > Required structs should use omitzero to avoid marshalling the zero value. Also add a missing `omitempty` for the image Download. I left it as a pointer due to reasons explained here [2]. [1] https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#optional-vs-required [2] k-orc#270 (comment)
kube-api-linter prefers using the `+default` marker and will warn about our use of `+kubebuilder:default`. We could switch the API to use `+default`, however `elastic/crd-ref-docs` doesn't yet understand this marker. A patch merged to add support but it's not yet in a release. Let's stick to `+kubebuilder:default` for now.
The `arrayofstruct` linter flags the struct we're using for the Statuses, were we report _exactly_ what OpenStack returns and don't do validation on purpose. From the things this new linter warns about, there's only one struct that is not a struct used in Status, however this struct has validation to ensure it has at least one element. More context on the new check at https://github.com/kubernetes-sigs/kube-api-linter/blob/main/docs/linters.md#arrayofstruct
Non-pointer structs with required fields must be marked as required themselves. Also use omitzero instead of omitempty to properly handle the zero value for the struct.
Bump kube-api-linter version and enable the optionalfields linter check. This enforces that optional fields use pointers to properly distinguish between unset values and zero values. Changes include: - Enable optionalfields linter in .golangci.yml - Convert optional string/bool/int fields to pointers across API types - Update controller code to use ptr.Deref() for pointer fields - Fix test assertions to use HaveValue() for pointer comparisons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some API changes, still WIP.