Skip to content

HelmRelease CRD OpenAPI Schema values property does not have a type defined #1172

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
jknutson opened this issue Feb 16, 2025 · 3 comments
Open
Labels
wontfix This will not be worked on

Comments

@jknutson
Copy link

jknutson commented Feb 16, 2025

It appears that the HelmRelease CRD is missing the type: object field for the values field in the OpenAPI schema.

This does not cause issues with Flux that I have noticed, but when I create a KRO ResourceGraphDefinition,
the ResourceGraphDefinition fails to sync due the values field not having a type defined.

I've confirmed that editing the CRD on my cluster resolves the issue, so I would like to make the necessary changes
to the source.

actual:

...
              values:
                description: Values holds the values for this Helm release.
                x-kubernetes-preserve-unknown-fields: true
...

expected:

...
              values:
                description: Values holds the values for this Helm release.
                x-kubernetes-preserve-unknown-fields: true
                type: object
...

I did a little digging, and it seems kube-builder and/or controller-gen are used to generate the CRD.

I made the below change locally, but I am on a windows machine at the moment and have not had an opportunity
to setup a local dev environment to test the change.

diff --git a/api/v2beta2/helmrelease_types.go b/api/v2beta2/helmrelease_types.go
index 89b9fef..fdc8f96 100644
--- a/api/v2beta2/helmrelease_types.go
+++ b/api/v2beta2/helmrelease_types.go
@@ -208,6 +208,7 @@ type HelmReleaseSpec struct {

        // Values holds the values for this Helm release.
        // +optional
+       // +kubebuilder:Type=string
        Values *apiextensionsv1.JSON `json:"values,omitempty"`

        // PostRenderers holds an array of Helm PostRenderers, which will be applied in order

I could be completely wrong here, but I'd love to help get this fixed so that I can avoid manually editing the CRD.
Any guidance would be greatly appreciated!

@matheuscscp
Copy link
Member

Hi @jknutson, I tried applying this git patch you showed and generate the manifests but kubebuilder doesn't generate the type field on the CRD :/

We also can't just add the field there since it goes away the next time we run make manifests.

You can patch the CRD at bootstrap time.

@stefanprodan
Copy link
Member

stefanprodan commented Feb 18, 2025

I suggest asking the KRO maintainers to handle x-kubernetes-preserve-unknown-fields. This is not something specific to Flux, all controllers who have this attribute have no type specified, see cert-manager for example https://github.com/cert-manager/cert-manager/blob/7b43b7dd6711947b55eed5d2d0f4c3e5fe232b55/deploy/crds/crd-issuers.yaml#L711

@jknutson
Copy link
Author

I've created an issue on the KRO repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants