2019-05-23 04:41:24 +00:00
|
|
|
.DEFAULT_GOAL: build
|
2019-05-29 21:44:21 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
|
|
|
# DEFAULTS
|
|
|
|
##################################
|
2021-09-14 08:06:56 +00:00
|
|
|
GIT_VERSION := $(shell git describe --match "v[0-9]*")
|
2020-01-11 02:52:11 +00:00
|
|
|
GIT_BRANCH := $(shell git branch | grep \* | cut -d ' ' -f2)
|
|
|
|
GIT_HASH := $(GIT_BRANCH)/$(shell git log -1 --pretty=format:"%H")
|
|
|
|
TIMESTAMP := $(shell date '+%Y-%m-%d_%I:%M:%S%p')
|
2021-07-10 01:01:46 +00:00
|
|
|
CONTROLLER_GEN=controller-gen
|
2021-02-19 04:53:53 +00:00
|
|
|
CONTROLLER_GEN_REQ_VERSION := v0.4.0
|
2021-09-14 08:06:56 +00:00
|
|
|
VERSION ?= $(shell git describe --match "v[0-9]*")
|
2020-01-11 02:52:11 +00:00
|
|
|
|
2020-11-24 19:49:08 +00:00
|
|
|
REGISTRY?=ghcr.io
|
|
|
|
REPO=$(REGISTRY)/kyverno
|
2020-05-15 20:11:28 +00:00
|
|
|
IMAGE_TAG?=$(GIT_VERSION)
|
2019-11-18 19:41:37 +00:00
|
|
|
GOOS ?= $(shell go env GOOS)
|
2020-10-07 22:09:52 +00:00
|
|
|
PACKAGE ?=github.com/kyverno/kyverno
|
2019-11-18 19:41:37 +00:00
|
|
|
LD_FLAGS="-s -w -X $(PACKAGE)/pkg/version.BuildVersion=$(GIT_VERSION) -X $(PACKAGE)/pkg/version.BuildHash=$(GIT_HASH) -X $(PACKAGE)/pkg/version.BuildTime=$(TIMESTAMP)"
|
2019-05-29 21:44:21 +00:00
|
|
|
|
2021-07-10 01:01:46 +00:00
|
|
|
# Used to disable inclusion of cloud provider code in k8schain
|
|
|
|
# https://github.com/google/go-containerregistry/tree/main/pkg/authn/k8schain
|
|
|
|
TAGS=disable_aws,disable_azure,disable_gcp
|
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
|
|
|
# KYVERNO
|
|
|
|
##################################
|
2019-05-29 21:44:21 +00:00
|
|
|
|
2021-03-11 18:14:46 +00:00
|
|
|
.PHONY: unused-package-check
|
|
|
|
unused-package-check:
|
|
|
|
@echo "------------------"
|
|
|
|
@echo "--> Check unused packages for the all kyverno components"
|
|
|
|
@echo "------------------"
|
|
|
|
@tidy=$$(go mod tidy); \
|
|
|
|
if [ -n "$${tidy}" ]; then \
|
|
|
|
echo "go mod tidy checking failed!"; echo "$${tidy}"; echo; \
|
|
|
|
fi
|
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
KYVERNO_PATH:= cmd/kyverno
|
2019-12-30 23:50:47 +00:00
|
|
|
build: kyverno
|
2020-02-03 21:38:24 +00:00
|
|
|
PWD := $(CURDIR)
|
2019-05-23 04:41:24 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
2021-04-08 23:14:08 +00:00
|
|
|
# INIT CONTAINER
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
|
|
|
INITC_PATH := cmd/initContainer
|
|
|
|
INITC_IMAGE := kyvernopre
|
2020-08-14 19:21:06 +00:00
|
|
|
initContainer: fmt vet
|
2019-11-18 19:41:37 +00:00
|
|
|
GOOS=$(GOOS) go build -o $(PWD)/$(INITC_PATH)/kyvernopre -ldflags=$(LD_FLAGS) $(PWD)/$(INITC_PATH)/main.go
|
2019-05-23 04:41:24 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
.PHONY: docker-build-initContainer docker-push-initContainer
|
2019-05-29 21:44:21 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-publish-initContainer: docker-build-initContainer docker-push-initContainer
|
2019-11-18 19:41:37 +00:00
|
|
|
|
|
|
|
docker-build-initContainer:
|
2021-02-19 02:09:01 +00:00
|
|
|
@docker buildx build --file $(PWD)/$(INITC_PATH)/Dockerfile --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
2019-05-23 04:41:24 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-build-initContainer-amd64:
|
|
|
|
@docker build -f $(PWD)/$(INITC_PATH)/Dockerfile -t $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TARGETPLATFORM="linux/amd64"
|
2019-05-23 04:41:24 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
docker-push-initContainer:
|
2021-03-10 22:47:09 +00:00
|
|
|
@docker buildx build --file $(PWD)/$(INITC_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(INITC_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
|
|
|
@docker buildx build --file $(PWD)/$(INITC_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(INITC_IMAGE):latest . --build-arg LD_FLAGS=$(LD_FLAGS)
|
2019-05-29 21:44:21 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
|
|
|
# KYVERNO CONTAINER
|
|
|
|
##################################
|
2021-02-19 02:09:01 +00:00
|
|
|
.PHONY: docker-build-kyverno docker-push-kyverno
|
2019-11-18 19:41:37 +00:00
|
|
|
KYVERNO_PATH := cmd/kyverno
|
|
|
|
KYVERNO_IMAGE := kyverno
|
2020-05-17 16:51:46 +00:00
|
|
|
|
|
|
|
local:
|
2021-07-10 01:01:46 +00:00
|
|
|
go build -tags $(TAGS) -ldflags=$(LD_FLAGS) $(PWD)/$(KYVERNO_PATH)
|
|
|
|
go build -tags $(TAGS) -ldflags=$(LD_FLAGS) $(PWD)/$(CLI_PATH)
|
2020-05-17 16:51:46 +00:00
|
|
|
|
2020-08-14 19:21:06 +00:00
|
|
|
kyverno: fmt vet
|
2021-07-10 01:01:46 +00:00
|
|
|
GOOS=$(GOOS) go build -o $(PWD)/$(KYVERNO_PATH)/kyverno -tags $(TAGS) -ldflags=$(LD_FLAGS) $(PWD)/$(KYVERNO_PATH)/main.go
|
2019-12-30 23:50:47 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-publish-kyverno: docker-build-kyverno docker-push-kyverno
|
2019-05-29 21:44:21 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
docker-build-kyverno:
|
2021-07-10 01:01:46 +00:00
|
|
|
@docker buildx build --file $(PWD)/$(KYVERNO_PATH)/Dockerfile --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TAGS=$(TAGS)
|
2019-06-05 01:05:10 +00:00
|
|
|
|
2021-07-10 01:01:46 +00:00
|
|
|
docker-build-kyverno-local:
|
|
|
|
CGO_ENABLED=0 GOOS=linux go build -o $(PWD)/$(KYVERNO_PATH)/kyverno -tags $(TAGS) -ldflags=$(LD_FLAGS) $(PWD)/$(KYVERNO_PATH)/main.go
|
2021-02-08 03:46:50 +00:00
|
|
|
@docker build -f $(PWD)/$(KYVERNO_PATH)/localDockerfile -t $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) $(PWD)/$(KYVERNO_PATH)
|
2021-02-22 20:08:26 +00:00
|
|
|
@docker tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) $(REPO)/$(KYVERNO_IMAGE):latest
|
2021-02-08 03:46:50 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-build-kyverno-amd64:
|
2021-07-10 01:01:46 +00:00
|
|
|
@docker build -f $(PWD)/$(KYVERNO_PATH)/Dockerfile -t $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TARGETPLATFORM="linux/amd64" --build-arg TAGS=$(TAGS)
|
2019-06-05 01:05:10 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
docker-push-kyverno:
|
2021-07-10 01:01:46 +00:00
|
|
|
@docker buildx build --file $(PWD)/$(KYVERNO_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TAGS=$(TAGS)
|
|
|
|
@docker buildx build --file $(PWD)/$(KYVERNO_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_IMAGE):latest . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TAGS=$(TAGS)
|
2019-06-05 01:05:10 +00:00
|
|
|
|
2020-07-20 14:35:06 +00:00
|
|
|
##################################
|
2020-08-06 06:26:31 +00:00
|
|
|
|
2020-07-20 14:35:06 +00:00
|
|
|
# Generate Docs for types.go
|
|
|
|
##################################
|
|
|
|
|
|
|
|
generate-api-docs:
|
|
|
|
go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./pkg/api -config documentation/api/config.json -template-dir documentation/api/template -out-file documentation/index.html
|
|
|
|
|
2019-06-05 01:05:10 +00:00
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
|
|
|
# CLI
|
|
|
|
##################################
|
2021-02-19 02:09:01 +00:00
|
|
|
.PHONY: docker-build-cli docker-push-cli
|
2020-02-20 03:13:05 +00:00
|
|
|
CLI_PATH := cmd/cli/kubectl-kyverno
|
2020-08-21 16:45:04 +00:00
|
|
|
KYVERNO_CLI_IMAGE := kyverno-cli
|
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
cli:
|
2020-02-20 03:13:05 +00:00
|
|
|
GOOS=$(GOOS) go build -o $(PWD)/$(CLI_PATH)/kyverno -ldflags=$(LD_FLAGS) $(PWD)/$(CLI_PATH)/main.go
|
2019-06-05 01:05:10 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-publish-cli: docker-build-cli docker-push-cli
|
2020-08-21 16:45:04 +00:00
|
|
|
|
|
|
|
docker-build-cli:
|
2021-02-19 02:09:01 +00:00
|
|
|
@docker buildx build --file $(PWD)/$(CLI_PATH)/Dockerfile --progress plane --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
2020-08-21 16:45:04 +00:00
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-build-cli-amd64:
|
|
|
|
@docker build -f $(PWD)/$(CLI_PATH)/Dockerfile -t $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS) --build-arg TARGETPLATFORM="linux/amd64"
|
2020-08-21 16:45:04 +00:00
|
|
|
|
|
|
|
docker-push-cli:
|
2021-03-10 22:47:09 +00:00
|
|
|
@docker buildx build --file $(PWD)/$(CLI_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_CLI_IMAGE):$(IMAGE_TAG) . --build-arg LD_FLAGS=$(LD_FLAGS)
|
|
|
|
@docker buildx build --file $(PWD)/$(CLI_PATH)/Dockerfile --progress plane --push --platform linux/arm64,linux/amd64 --tag $(REPO)/$(KYVERNO_CLI_IMAGE):latest . --build-arg LD_FLAGS=$(LD_FLAGS)
|
2021-04-08 23:14:08 +00:00
|
|
|
|
2020-08-06 06:26:31 +00:00
|
|
|
##################################
|
2020-08-21 16:45:04 +00:00
|
|
|
docker-publish-all: docker-publish-initContainer docker-publish-kyverno docker-publish-cli
|
2020-08-11 16:32:51 +00:00
|
|
|
|
2020-08-21 16:45:04 +00:00
|
|
|
docker-build-all: docker-build-initContainer docker-build-kyverno docker-build-cli
|
|
|
|
|
2021-02-19 02:09:01 +00:00
|
|
|
docker-build-all-amd64: docker-build-initContainer-amd64 docker-build-kyverno-amd64 docker-build-cli-amd64
|
2020-11-09 19:26:12 +00:00
|
|
|
|
2020-08-21 16:45:04 +00:00
|
|
|
##################################
|
2020-12-15 19:46:53 +00:00
|
|
|
# Create e2e Infrastruture
|
2020-08-21 16:45:04 +00:00
|
|
|
##################################
|
2020-08-11 16:32:51 +00:00
|
|
|
|
2020-12-15 19:46:53 +00:00
|
|
|
create-e2e-infrastruture:
|
|
|
|
chmod a+x $(PWD)/scripts/create-e2e-infrastruture.sh
|
|
|
|
$(PWD)/scripts/create-e2e-infrastruture.sh
|
2020-08-11 00:16:13 +00:00
|
|
|
|
|
|
|
|
2020-08-06 06:26:31 +00:00
|
|
|
##################################
|
|
|
|
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
2021-04-08 23:14:08 +00:00
|
|
|
# Testing & Code-Coverage
|
2019-11-18 19:41:37 +00:00
|
|
|
##################################
|
2019-06-07 18:50:12 +00:00
|
|
|
|
|
|
|
## variables
|
|
|
|
BIN_DIR := $(GOPATH)/bin
|
|
|
|
GO_ACC := $(BIN_DIR)/go-acc
|
|
|
|
CODE_COVERAGE_FILE:= coverage
|
|
|
|
CODE_COVERAGE_FILE_TXT := $(CODE_COVERAGE_FILE).txt
|
|
|
|
CODE_COVERAGE_FILE_HTML := $(CODE_COVERAGE_FILE).html
|
|
|
|
|
|
|
|
## targets
|
|
|
|
$(GO_ACC):
|
|
|
|
@echo " downloading testing tools"
|
|
|
|
go get -v github.com/ory/go-acc
|
|
|
|
$(eval export PATH=$(GO_ACC):$(PATH))
|
|
|
|
# go test provides code coverage per packages only.
|
2021-04-08 23:14:08 +00:00
|
|
|
# go-acc merges the result for pks so that it be used by
|
2019-06-07 18:50:12 +00:00
|
|
|
# go tool cover for reporting
|
|
|
|
|
2021-07-10 01:01:46 +00:00
|
|
|
test: test-unit test-e2e test-cmd
|
|
|
|
|
|
|
|
|
2019-06-07 18:50:12 +00:00
|
|
|
# go get downloads and installs the binary
|
|
|
|
# we temporarily add the GO_ACC to the path
|
2021-07-10 01:01:46 +00:00
|
|
|
test-unit: $(GO_ACC)
|
2019-06-07 18:50:12 +00:00
|
|
|
@echo " running unit tests"
|
|
|
|
go-acc ./... -o $(CODE_COVERAGE_FILE_TXT)
|
|
|
|
|
|
|
|
code-cov-report: $(CODE_COVERAGE_FILE_TXT)
|
|
|
|
# transform to html format
|
|
|
|
@echo " generating code coverage report"
|
|
|
|
go tool cover -html=coverage.txt
|
2020-06-04 18:45:37 +00:00
|
|
|
if [ -a $(CODE_COVERAGE_FILE_HTML) ]; then open $(CODE_COVERAGE_FILE_HTML); fi;
|
|
|
|
|
2020-08-06 05:16:10 +00:00
|
|
|
# Test E2E
|
|
|
|
test-e2e:
|
|
|
|
$(eval export E2E="ok")
|
2021-05-13 23:16:24 +00:00
|
|
|
go test ./test/e2e/metrics -v
|
2021-04-08 23:14:08 +00:00
|
|
|
go test ./test/e2e/mutate -v
|
|
|
|
go test ./test/e2e/generate -v
|
2020-08-06 05:16:10 +00:00
|
|
|
$(eval export E2E="")
|
|
|
|
|
2021-07-27 06:49:28 +00:00
|
|
|
test-e2e-local:
|
|
|
|
$(eval export E2E="ok")
|
|
|
|
kubectl apply -f https://raw.githubusercontent.com/kyverno/kyverno/main/definitions/github/rbac.yaml
|
|
|
|
kubectl port-forward -n kyverno service/kyverno-svc-metrics 8000:8000 &
|
|
|
|
go test ./test/e2e/metrics -v
|
|
|
|
go test ./test/e2e/mutate -v
|
|
|
|
go test ./test/e2e/generate -v
|
|
|
|
kill $!
|
|
|
|
$(eval export E2E="")
|
|
|
|
|
2021-03-16 21:35:32 +00:00
|
|
|
#Test TestCmd Policy
|
2021-07-10 01:01:46 +00:00
|
|
|
test-cmd: cli
|
2021-05-07 23:27:15 +00:00
|
|
|
$(PWD)/$(CLI_PATH)/kyverno test https://github.com/kyverno/policies/main
|
|
|
|
$(PWD)/$(CLI_PATH)/kyverno test ./test/cli/test
|
|
|
|
$(PWD)/$(CLI_PATH)/kyverno test ./test/cli/test-fail/missing-policy && exit 1 || exit 0
|
|
|
|
$(PWD)/$(CLI_PATH)/kyverno test ./test/cli/test-fail/missing-rule && exit 1 || exit 0
|
|
|
|
$(PWD)/$(CLI_PATH)/kyverno test ./test/cli/test-fail/missing-resource && exit 1 || exit 0
|
2021-03-16 21:35:32 +00:00
|
|
|
|
2020-06-05 20:42:53 +00:00
|
|
|
# godownloader create downloading script for kyverno-cli
|
2020-06-04 18:45:37 +00:00
|
|
|
godownloader:
|
2020-10-08 20:10:52 +00:00
|
|
|
godownloader .goreleaser.yml --repo kyverno/kyverno -o ./scripts/install-cli.sh --source="raw"
|
2020-06-05 20:42:53 +00:00
|
|
|
|
2021-04-08 23:14:08 +00:00
|
|
|
# kustomize-crd will create install.yaml
|
2020-06-05 20:42:53 +00:00
|
|
|
kustomize-crd:
|
2021-04-08 23:14:08 +00:00
|
|
|
# Create CRD for helm deployment Helm
|
2021-09-22 20:56:10 +00:00
|
|
|
kustomize build ./definitions/release | kustomize cfg grep kind=CustomResourceDefinition > ./charts/kyverno/templates/crds.yaml
|
2020-06-05 20:44:47 +00:00
|
|
|
# Generate install.yaml that have all resources for kyverno
|
2020-06-05 20:42:53 +00:00
|
|
|
kustomize build ./definitions > ./definitions/install.yaml
|
2020-06-05 20:44:47 +00:00
|
|
|
# Generate install_debug.yaml that for developer testing
|
2020-08-12 14:54:45 +00:00
|
|
|
kustomize build ./definitions/debug > ./definitions/install_debug.yaml
|
|
|
|
|
2020-10-07 18:12:31 +00:00
|
|
|
# guidance https://github.com/kyverno/kyverno/wiki/Generate-a-Release
|
2020-11-29 08:37:36 +00:00
|
|
|
release:
|
2020-08-12 14:54:45 +00:00
|
|
|
kustomize build ./definitions > ./definitions/install.yaml
|
2021-09-02 01:53:28 +00:00
|
|
|
kustomize build ./definitions/release > ./definitions/release/install.yaml
|
2020-08-14 19:21:06 +00:00
|
|
|
|
2021-08-10 16:07:46 +00:00
|
|
|
release-notes:
|
2021-08-12 16:58:25 +00:00
|
|
|
@bash -c 'while IFS= read -r line ; do if [[ "$$line" == "## "* && "$$line" != "## $(VERSION)" ]]; then break ; fi; echo "$$line"; done < "CHANGELOG.md"' \
|
2021-08-10 16:07:46 +00:00
|
|
|
true
|
|
|
|
|
2020-11-13 03:48:39 +00:00
|
|
|
kyverno-crd: controller-gen
|
2021-09-10 00:13:16 +00:00
|
|
|
$(CONTROLLER_GEN) crd paths=./pkg/api/kyverno/... crd:crdVersions=v1 output:dir=./definitions/crds
|
2020-11-13 03:48:39 +00:00
|
|
|
|
2020-11-09 19:26:12 +00:00
|
|
|
report-crd: controller-gen
|
2021-09-10 00:13:16 +00:00
|
|
|
$(CONTROLLER_GEN) crd paths=./pkg/api/policyreport/... crd:crdVersions=v1 output:dir=./definitions/crds
|
2020-11-09 19:26:12 +00:00
|
|
|
|
2021-04-08 23:14:08 +00:00
|
|
|
# install the right version of controller-gen
|
2021-02-19 04:53:53 +00:00
|
|
|
install-controller-gen:
|
2020-11-09 19:26:12 +00:00
|
|
|
@{ \
|
|
|
|
set -e ;\
|
|
|
|
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
|
|
|
|
cd $$CONTROLLER_GEN_TMP_DIR ;\
|
|
|
|
go mod init tmp ;\
|
2021-02-19 04:53:53 +00:00
|
|
|
go get sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_REQ_VERSION) ;\
|
2020-11-09 19:26:12 +00:00
|
|
|
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
|
|
|
|
}
|
2021-02-19 04:53:53 +00:00
|
|
|
CONTROLLER_GEN=$(GOPATH)/bin/controller-gen
|
|
|
|
|
|
|
|
# setup controller-gen with the right version, if necessary
|
|
|
|
controller-gen:
|
|
|
|
ifeq (, $(shell which controller-gen))
|
|
|
|
@{ \
|
|
|
|
echo "controller-gen not found!";\
|
|
|
|
echo "installing controller-gen $(CONTROLLER_GEN_REQ_VERSION)...";\
|
|
|
|
make install-controller-gen;\
|
|
|
|
}
|
|
|
|
else ifneq (Version: $(CONTROLLER_GEN_REQ_VERSION), $(shell controller-gen --version))
|
|
|
|
@{ \
|
|
|
|
echo "controller-gen $(shell controller-gen --version) found!";\
|
|
|
|
echo "required controller-gen $(CONTROLLER_GEN_REQ_VERSION)";\
|
|
|
|
echo "installing controller-gen $(CONTROLLER_GEN_REQ_VERSION)...";\
|
|
|
|
make install-controller-gen;\
|
|
|
|
}
|
2020-11-09 19:26:12 +00:00
|
|
|
else
|
|
|
|
CONTROLLER_GEN=$(shell which controller-gen)
|
|
|
|
endif
|
|
|
|
|
2021-03-01 18:58:58 +00:00
|
|
|
# Bootstrap auto-generable code associated with deepcopy
|
|
|
|
deepcopy-autogen: controller-gen
|
|
|
|
$(CONTROLLER_GEN) object:headerFile="scripts/boilerplate.go.txt" paths="./..."
|
|
|
|
|
2020-08-14 19:21:06 +00:00
|
|
|
# Run go fmt against code
|
|
|
|
fmt:
|
2021-02-09 19:34:13 +00:00
|
|
|
gofmt -s -w .
|
2020-08-14 19:21:06 +00:00
|
|
|
|
|
|
|
vet:
|
|
|
|
go vet ./...
|