Skip to content

Commit

Permalink
Fix #210 - Add kubebuilder annotations to preserve metadata fields (#211
Browse files Browse the repository at this point in the history
)

Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
  • Loading branch information
ricardozanini authored Oct 9, 2024
1 parent 3560eeb commit 17bb30b
Show file tree
Hide file tree
Showing 12 changed files with 2,155 additions and 33 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ bin
*.out
.vscode

# ignore config directory generated by the controller-gen tool
config
38 changes: 25 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,52 @@
addheaders:
@command -v addlicense > /dev/null || go install -modfile=tools.mod -v github.com/google/addlicense
@command -v addlicense > /dev/null || (echo "🚀 Installing addlicense..."; go install -modfile=tools.mod -v github.com/google/addlicense)
@addlicense -c "The Serverless Workflow Specification Authors" -l apache .

fmt:
@go vet ./...
@go fmt ./...

goimports:
@command -v goimports > /dev/null || go install golang.org/x/tools/cmd/goimports@latest
@command -v goimports > /dev/null || (echo "🚀 Installing goimports..."; go install golang.org/x/tools/cmd/goimports@latest)
@goimports -w .


lint:
@command -v golangci-lint > /dev/null || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin"
make addheaders
make goimports
make fmt
./hack/go-lint.sh ${params}
@echo "🚀 Running lint..."
@command -v golangci-lint > /dev/null || (echo "🚀 Installing golangci-lint..."; curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin")
@make addheaders
@make goimports
@make fmt
@./hack/go-lint.sh ${params}
@echo "✅ Linting completed!"

.PHONY: test
coverage="false"

test: deepcopy buildergen
make lint
@echo "🧪 Running tests..."
@go test ./...
@echo "✅ Tests completed!"

.PHONY: deepcopy buildergen
deepcopy: $(DEEPCOPY_GEN) ## Download deepcopy-gen locally if necessary.
./hack/deepcopy-gen.sh deepcopy
@echo "📦 Running deepcopy-gen..."
@./hack/deepcopy-gen.sh deepcopy > /dev/null
@make lint
@echo "✅ Deepcopy generation and linting completed!"

buildergen: $(BUILDER_GEN) ## Download builder-gen locally if necessary.
./hack/builder-gen.sh buildergen
@echo "📦 Running builder-gen..."
@./hack/builder-gen.sh buildergen > /dev/null
@make lint
@echo "✅ Builder generation and linting completed!"

.PHONY: kube-integration
kube-integration: controller-gen
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
@echo "📦 Generating Kubernetes objects..."
@$(CONTROLLER_GEN) object:headerFile="./hack/boilerplate.txt" paths="./kubernetes/api/..."
@echo "📦 Generating Kubernetes CRDs..."
@$(CONTROLLER_GEN) rbac:roleName=manager-role crd:allowDangerousTypes=true webhook paths="./kubernetes/..." output:crd:artifacts:config=config/crd/bases
@make lint
@echo "✅ Kubernetes integration completed!"


####################################
Expand Down
Loading

0 comments on commit 17bb30b

Please sign in to comment.