@@ -45,11 +45,14 @@ help: ## Display this help.
4545
4646.PHONY : manifests
4747manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
48- $(CONTROLLER_GEN ) rbac:roleName=manager-role crd webhook paths=" ./..." output:crd:artifacts:config=config/crd/bases
48+ $(CONTROLLER_GEN ) rbac:roleName=manager-role crd webhook paths=" ./internal/controller/rbac/..." output:crd:artifacts:config=config/crd/bases
49+ $(CONTROLLER_GEN ) rbac:roleName=upstream-manager-role crd webhook paths=" ./internal/controller/rbac/upstream" output:rbac:artifacts:config=config/rbac_upstream
50+ $(CONTROLLER_GEN ) rbac:roleName=downstream-manager-role crd webhook paths=" ./internal/controller/rbac/downstream" output:rbac:artifacts:config=config/rbac_downstream
4951
5052.PHONY : generate
51- generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
53+ generate : controller-gen defaulter-gen
5254 $(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
55+ $(DEFAULTER_GEN ) ./internal/config --output-file=zz_generated.defaults.go
5356
5457.PHONY : fmt
5558fmt : # # Run go fmt against code.
@@ -94,8 +97,7 @@ build: manifests generate fmt vet ## Build manager binary.
9497.PHONY : run
9598run : manifests generate fmt vet # # Run a controller from your host.
9699 go run ./cmd/main.go -health-probe-bind-address 0 \
97- --upstream-kubeconfig=$(shell pwd) /upstream.kubeconfig \
98- --infra-namespace=default
100+ --server-config ./config/dev/config.yaml
99101
100102# If you wish to build the manager image targeting other platforms you can use the --platform flag.
101103# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
@@ -165,14 +167,16 @@ $(LOCALBIN):
165167KUBECTL ?= kubectl
166168KUSTOMIZE ?= $(LOCALBIN ) /kustomize
167169CONTROLLER_GEN ?= $(LOCALBIN ) /controller-gen
170+ DEFAULTER_GEN ?= $(LOCALBIN ) /defaulter-gen
168171ENVTEST ?= $(LOCALBIN ) /setup-envtest
169172GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint
170173
171174# # Tool Versions
172175KUSTOMIZE_VERSION ?= v5.4.3
173176CONTROLLER_TOOLS_VERSION ?= v0.16.1
177+ DEFAULTER_GEN_VERSION ?= v0.32.3
174178ENVTEST_VERSION ?= release-0.19
175- GOLANGCI_LINT_VERSION ?= v1.62.0
179+ GOLANGCI_LINT_VERSION ?= v2.1.5
176180
177181.PHONY : kustomize
178182kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -184,6 +188,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
184188$(CONTROLLER_GEN ) : $(LOCALBIN )
185189 $(call go-install-tool,$(CONTROLLER_GEN ) ,sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION ) )
186190
191+ .PHONY : defaulter-gen
192+ defaulter-gen : $(DEFAULTER_GEN ) # # Download defaulter-gen locally if necessary.
193+ $(DEFAULTER_GEN ) : $(LOCALBIN )
194+ $(call go-install-tool,$(DEFAULTER_GEN ) ,k8s.io/code-generator/cmd/defaulter-gen,$(DEFAULTER_GEN_VERSION ) )
195+
187196.PHONY : envtest
188197envtest : $(ENVTEST ) # # Download setup-envtest locally if necessary.
189198$(ENVTEST ) : $(LOCALBIN )
@@ -192,7 +201,7 @@ $(ENVTEST): $(LOCALBIN)
192201.PHONY : golangci-lint
193202golangci-lint : $(GOLANGCI_LINT ) # # Download golangci-lint locally if necessary.
194203$(GOLANGCI_LINT ) : $(LOCALBIN )
195- $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
204+ $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/v2/ cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
196205
197206# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
198207# $1 - target path with name of binary
0 commit comments