# Build and development commands for kubeclaw operator

.PHONY: generate
generate:
	controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./api/..."

.PHONY: manifests
manifests: generate
	controller-gen rbac:roleName=kubeclaw-manager crd:maxDescLen=0,outputDir=config/crd webhook paths="./..."

.PHONY: install
install: manifests
	kubectl apply -f config/crd/

.PHONY: uninstall
uninstall:
	kubectl delete -f config/crd/

.PHONY: run
run: generate
	go run ./main.go

.PHONY: test
test: generate
	go test ./... -v -count=1

.PHONY: test-integration
test-integration:
	go test ./... -tags=integration -v -count=1

.PHONY: test-e2e
test-e2e:
	go test ./... -tags=e2e -v -count=1

.PHONY: docker-build
docker-build:
	docker build -t kubeclaw/controller:latest .

.PHONY: helm-package
helm-package:
	helm package ./charts/kubeclaw

.PHONY: deploy
deploy: docker-build helm-package
	helm upgrade --install kubeclaw ./charts/kubeclaw --namespace kubeclaw-system --create-namespace
