@@ -132,7 +132,7 @@ vet: ## Run go vet against code.
132
132
go vet ./...
133
133
134
134
.PHONY : test
135
- test : manifests generate fmt vet envtest image-build # # Run tests.
135
+ test : manifests generate fmt vet envtest image-build verify-crds # # Run tests.
136
136
CGO_ENABLED=1 KUBEBUILDER_ASSETS=" $( shell $( ENVTEST) use $( ENVTEST_K8S_VERSION) --bin-dir $( LOCALBIN) -p path) " go test $$(go list ./... | grep -v /e2e | grep -v /conformance ) -race -coverprofile cover.out
137
137
138
138
.PHONY : test-unit
@@ -163,6 +163,10 @@ ci-lint: golangci-lint
163
163
verify : vet fmt-verify manifests generate ci-lint verify-all
164
164
git --no-pager diff --exit-code config api client-go
165
165
166
+ .PHONY : verify-crds
167
+ verify-crds : kubectl-validate
168
+ hack/verify-manifests.sh
169
+
166
170
# Run static analysis.
167
171
.PHONY : verify-all
168
172
verify-all :
@@ -354,13 +358,15 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
354
358
GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint
355
359
HELM = $(PROJECT_DIR ) /bin/helm
356
360
YQ = $(PROJECT_DIR ) /bin/yq
361
+ KUBECTL_VALIDATE = $(PROJECT_DIR ) /bin/kubectl-validate
357
362
358
363
# # Tool Versions
359
364
KUSTOMIZE_VERSION ?= v5.4.3
360
365
CONTROLLER_TOOLS_VERSION ?= v0.16.1
361
366
ENVTEST_VERSION ?= release-0.19
362
367
GOLANGCI_LINT_VERSION ?= v1.62.2
363
368
HELM_VERSION ?= v3.17.1
369
+ KUBECTL_VALIDATE_VERSION ?= v0.0.4
364
370
365
371
.PHONY : kustomize
366
372
kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
@@ -390,6 +396,11 @@ yq: ## Download yq locally if necessary.
390
396
helm : # # Download helm locally if necessary.
391
397
GOBIN=$(PROJECT_DIR ) /bin GO111MODULE=on go install helm.sh/helm/v3/cmd/helm@$(HELM_VERSION )
392
398
399
+ .PHONY : kubectl-validate
400
+ kubectl-validate : $(KUBECTL_VALIDATE ) # # Download kubectl-validate locally if necessary.
401
+ $(KUBECTL_VALIDATE ) : $(LOCALBIN )
402
+ $(call go-install-tool,$(KUBECTL_VALIDATE ) ,sigs.k8s.io/kubectl-validate,$(KUBECTL_VALIDATE_VERSION ) )
403
+
393
404
# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
394
405
# $1 - target path with name of binary
395
406
# $2 - package url which can be installed
0 commit comments