Skip to content

Do not emit additionalPrinterColumns, categories, shortNames when empty #1751

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JanBerktold
Copy link
Contributor

@JanBerktold JanBerktold commented Apr 25, 2025

Motivation

We are using ArgoCD to deploy our kube-generated CRDs into our K8s clusters. ArgoCD always considers the resources as out of sync as the empty arrays are omitted in the response from the server.

image

Solution

For the relevant fields, only set them in the Values object if the vectors are non-empty. This certainly isn't the prettiest solution, but I couldn't find a good way to include it in the original serde_json::json! invocation since it doesn't seem to support conditionals. Suggestions are very welcome!

@JanBerktold JanBerktold marked this pull request as ready for review April 26, 2025 00:18
@clux clux added the changelog-fix changelog fix category for prs label Apr 27, 2025
@clux clux linked an issue Apr 27, 2025 that may be closed by this pull request
@clux
Copy link
Member

clux commented Apr 27, 2025

Hey thanks for tackling this. Found the open issue associated with it.

It seems to err on the crd_enum_test example, might be worth looking at. (Lint and deny should be unrelated, i'll look at those in a separate PR).

@cirego
Copy link

cirego commented May 5, 2025

FYI, we're also seeing this with x-kubernetes-validations: [] as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-fix changelog fix category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CustomResource derive injects empty defaults for unset fields
3 participants