-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
What do you want to happen?
When using the Helm plugin (kubebuilder edit --plugins=helm/v2-alpha), a Helm chart is generated in dist/chart/, but no corresponding Makefile targets are added to work with it. This creates an inconsistency with the Kustomize workflow, which has dedicated targets like make deploy, make undeploy, etc.
Users are left to manually craft helm upgrade --install commands or write their own Makefile targets, which defeats the purpose of scaffolding and creates friction in adoption.
Current Behavior
After running kubebuilder edit --plugins=helm/v2-alpha:
- Helm chart is generated in
dist/chart/ - No Makefile targets are added
- README mentions the chart exists but provides no usage examples
- Users must manually write helm commands with proper flags
Expected Behavior
Similar to Kustomize targets (deploy, undeploy, install, uninstall), Helm-specific targets should be scaffolded when the Helm plugin is used.
Proposed Solution
Add a new Makefile section when Helm plugin is active:
##@ Helm Deployment
HELM ?= helm
HELM_NAMESPACE ?= <project>-system
HELM_RELEASE ?= <project>
HELM_VALUES ?= dist/chart/values.yaml
.PHONY: helm-deploy
helm-deploy: ## Deploy controller via Helm
$(HELM) upgrade --install $(HELM_RELEASE) dist/chart \
--namespace $(HELM_NAMESPACE) \
--create-namespace \
--set manager.image.repository=$(shell echo ${IMG} | cut -d: -f1) \
--set manager.image.tag=$(shell echo ${IMG} | cut -d: -f2) \
--values $(HELM_VALUES) \
--wait \
--timeout 5m
.PHONY: helm-uninstall
helm-uninstall: ## Uninstall Helm release
$(HELM) uninstall $(HELM_RELEASE) --namespace $(HELM_NAMESPACE)
.PHONY: helm-status
helm-status: ## Show Helm release status
$(HELM) status $(HELM_RELEASE) --namespace $(HELM_NAMESPACE)
.PHONY: helm-history
helm-history: ## Show Helm release history
$(HELM) history $(HELM_RELEASE) --namespace $(HELM_NAMESPACE)
.PHONY: helm-rollback
helm-rollback: ## Rollback to previous Helm release
$(HELM) rollback $(HELM_RELEASE) --namespace $(HELM_NAMESPACE)Benefits
- Consistency - Aligns with existing Kustomize workflow patterns
- Discoverability - Shows up in
make helpoutput - Best practices - Demonstrates proper helm upgrade/rollback usage
- Reduced friction - Users can immediately use Helm after generation
- Zero-downtime deployments - Makes rolling updates easy out of the box
- Documentation by example - Makefile serves as executable documentation
Additional Context
The Helm plugin promotes zero-downtime deployments and proper CRD lifecycle management (as mentioned in the docs), but without Makefile integration, many users stick with make deploy (Kustomize) because it's simpler, even though Helm would be better for their use case.
Adding these targets would:
- Encourage Helm adoption for production deployments
- Reduce the learning curve
- Match user expectations (if there's a plugin, the Makefile should know about it)
Alternative Considered
Users can manually add these targets, but:
- It's not obvious what the best practices are
- Defeats the scaffolding benefit
- Creates inconsistency across projects
Related
- The Helm plugin already generates values.yaml with sensible defaults
- README could be updated to reference
make helm-deployinstead of raw helm commands - Could also add environment-specific targets like
helm-deploy-dev,helm-deploy-prod(though that might be too opinionated)
Extra Labels
No response