Skip to content

Improve Helm plugin by generating chart from install.yaml (via Kustomize build) #4833

@camilamacedo86

Description

@camilamacedo86

What do you want to happen?

Description:

Currently, Kubebuilder provides support for generating Helm charts to help users package and deploy their operators. This is a great feature and brings real value. However, the current implementation has limitations, especially when changes are made in the config/ directory using Kustomize.

Reference to current implementation:
https://github.com/kubernetes-sigs/kubebuilder/tree/master/pkg/plugins/optional/helm/v1alpha

While the current approach proves that Helm support is possible and useful, it allows us to start discussing and getting feedback from the community about how the chart should be; as add tests to validate to cover its functionalities it is not the easiest to maintain or the best in the long term, especially as the project evolves. Improvements can make this much simpler and more robust.

Proposal:

Update the Helm plugin to:

  • Run the same logic that generates the install.yaml from Kustomize (like we already do for make build-installer) bu on the fly:
.PHONY: build-installer  
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.  
	mkdir -p dist  
	cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}  
	$(KUSTOMIZE) build config/default > dist/install.yaml  
  • Use the resulting install.yaml as input to generate the Helm chart
  • We should still building the chart as it is today

This would make the Helm chart:

Alternative Proposal

Keep the code as it is, but try to replace the templates with logic to generate the files from config/ instead as much as possible.

Extra Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions