Skip to content

Conversation

@manuelbuil
Copy link
Contributor

@manuelbuil manuelbuil commented Nov 5, 2025

This PR does several things:

1 - Adds a way to easily generate new CRDs if we change some of the fields in pkg/apis/helm.cattle.io/types.go: it adds a new target in the Makefile (generate-crd) that is considered as a dependency of the build target. It also adds a new target in the Dockerfile which copies over the new crds

2 - Related to 1, this PR moves the installation of controller-gen to the builder stage because this is where it makes sense to have the new CRDs, as we need them to build helm-controller here

3 - Adds go generate in the builder stage and also installs crd-ref-docs because we need it as part of the code generation here. I picked github.com/elastic because that seems to be the best project right now to get crd-ref-docs as apposed to "ahmetb/gen-crd-api-reference-docs" that is unmaintained

4 - Removes "goimports@gopls" installation. We are executing go fmt and golangci-lint in the validation step but no goimports

5 - Adds manifests/crd.yaml because we are talking about it in the README and improves the README a bit because it was slightly outdated

6 - Updates controller-gen to v0.19.0

7 - Removes gcc and musl-dev from the dev stage as the build is happening in the builder stage

README.md Outdated

#### Locally
### Build
Run `make build` to build the binary and, opitonally, generate new CRDs if the API changed. We recommend execute `make` to additionally run validation and testing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Run `make build` to build the binary and, opitonally, generate new CRDs if the API changed. We recommend execute `make` to additionally run validation and testing.
Run `make build` to build the binary and, optionally, generate new CRDs if the API changed. We recommend just running `make`, as the default target will also perform validation and testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Copy link
Member

@brandond brandond Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it Just because the README talks about ./manifests/crd.yaml. But now thinking about this, it's better if we change the README

@brandond
Copy link
Member

brandond commented Nov 5, 2025

I picked github.com/elastic because that seems to be the best project right now to get crd-ref-docs as apposed to "ahmetb/gen-crd-api-reference-docs" that is unmaintained

That is exactly what I used to generate the existing docs pages - did I forget to check that in?

See for example what I added to system-upgrade controller: rancher/system-upgrade-controller@42e0dc3

@manuelbuil manuelbuil requested a review from brandond November 6, 2025 09:27
@brandond
Copy link
Member

brandond commented Nov 6, 2025

oh no I did add that to go generate:

//go:generate crd-ref-docs --config=crd-ref-docs.yaml --renderer=markdown --output-path=doc/helmchart.md

I just didn't add it to the Dockerfile.

@manuelbuil manuelbuil merged commit 4918a04 into k3s-io:master Nov 10, 2025
3 checks passed
@manuelbuil manuelbuil deleted the HowToChangeCRD branch November 10, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants