You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Makefile
+81-31Lines changed: 81 additions & 31 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,7 @@
1
-
2
1
# Image URL to use all building/pushing image targets
3
-
LATEST = controller:latest
4
-
IMG ?= $(LATEST)
2
+
IMG ?= controller:latest
5
3
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
6
-
ENVTEST_K8S_VERSION = 1.27.3
4
+
ENVTEST_K8S_VERSION = 1.31.0
7
5
8
6
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
9
7
ifeq (,$(shell go env GOBIN))
@@ -64,7 +62,32 @@ vet: ## Run go vet against code.
64
62
.PHONY: test
65
63
test: build envtest ## Run tests.
66
64
go test$(shell pwd)/internal/test -run $(shell pwd)/internal/test/suite_test.go -v -test.timeout 10000s
67
-
#KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out
65
+
#KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
66
+
67
+
# TODO(user): To use a different vendor for e2e tests, modify the setup under 'tests/e2e'.
68
+
# The default setup assumes Kind is pre-installed and builds/loads the Manager Docker image locally.
69
+
# Prometheus and CertManager are installed by default; skip with:
70
+
# - PROMETHEUS_INSTALL_SKIP=true
71
+
# - CERT_MANAGER_INSTALL_SKIP=true
72
+
.PHONY: test-e2e
73
+
test-e2e: manifests generate fmt vet ## Run the e2e tests. Expected an isolated environment using Kind.
74
+
@command -v kind >/dev/null 2>&1|| { \
75
+
echo"Kind is not installed. Please install Kind manually.";\
76
+
exit 1;\
77
+
}
78
+
@kind get clusters | grep -q 'kind'|| { \
79
+
echo"No Kind cluster is running. Please start a Kind cluster before running the e2e tests.";\
80
+
exit 1;\
81
+
}
82
+
go test ./test/e2e/ -v -ginkgo.v
83
+
84
+
.PHONY: lint
85
+
lint: golangci-lint ## Run golangci-lint linter
86
+
$(GOLANGCI_LINT) run
87
+
88
+
.PHONY: lint-fix
89
+
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
90
+
$(GOLANGCI_LINT) run --fix
68
91
69
92
##@ Build
70
93
@@ -80,13 +103,13 @@ run: install ## Run a controller from your host.
80
103
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
81
104
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
82
105
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
83
-
#.PHONY: docker-build
84
-
#docker-build: ## Build docker image with the manager.
85
-
# $(CONTAINER_TOOL) build -t ${IMG} .
106
+
.PHONY: docker-build
107
+
docker-build: ## Build docker image with the manager.
108
+
$(CONTAINER_TOOL) build -t ${IMG}.
86
109
87
-
#.PHONY: docker-push
88
-
#docker-push: ## Push docker image with the manager.
89
-
# $(CONTAINER_TOOL) push ${IMG}
110
+
.PHONY: docker-push
111
+
docker-push: ## Push docker image with the manager.
112
+
$(CONTAINER_TOOL) push ${IMG}
90
113
91
114
# PLATFORMS defines the target platforms for the manager image be built to provide support to multiple
92
115
# architectures. (i.e. make docker-buildx IMG=myregistry/mypoperator:0.0.1). To use this option you need to:
@@ -119,16 +148,18 @@ install: build kustomize ## Install CRDs into the K8s cluster specified in ~/.ku
119
148
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
## Run acceptance tests then deploy into Docker Hub the controller as the Docker image provided in arg ${IMG}
133
164
## and update the local file "kubegres.yaml" with the image ${IMG}
134
165
.PHONY: deploy
@@ -138,10 +169,10 @@ deploy: deploy-check docker-buildx kustomize ## Deploy controller to the K8s clu
138
169
@echo "DEPLOYED $(IMG) INTO DOCKER HUB. UPDATED 'kubegres.yaml' WITH '$(IMG)'. YOU CAN COMMIT 'kubegres.yaml' AND CREATE A RELEASE IN GITHUB."
139
170
140
171
.PHONY: undeploy
141
-
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
172
+
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
0 commit comments