@@ -48,55 +48,63 @@ all: build
4848
4949.PHONY : help
5050help : # # Display this help.
51- @awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
51+ @awk ' BEGIN {FS = ":[^#]*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:[^#]*## / { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } ' $(MAKEFILE_LIST )
52+
53+ .PHONY : help-extended
54+ help-extended : # # Display extended help.
55+ @awk ' BEGIN {FS = ":.*###?"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*###?/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
5256
5357# #@ Development
5458
5559.PHONY : manifests
56- manifests : controller-gen # # Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
60+ manifests : controller-gen # ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
5761 $(CONTROLLER_GEN ) rbac:roleName=manager-role crd webhook paths=" ./..." output:crd:artifacts:config=config/crd/bases
5862
5963.PHONY : generate
60- generate : controller-gen # # Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
64+ generate : controller-gen # ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
6165 $(CONTROLLER_GEN ) object:headerFile=" hack/boilerplate.go.txt" paths=" ./..."
6266
6367.PHONY : fmt
64- fmt : # # Run go fmt against code.
68+ fmt : # ## Run go fmt against code.
6569 go fmt ./...
6670
6771.PHONY : vet
68- vet : # # Run go vet against code.
72+ vet : # ## Run go vet against code.
6973 go vet ./...
7074
71- .PHONY : test test-e2e e2e kind-load kind-cluster kind-cluster-cleanup kind-deploy
72- test : manifests generate fmt vet test-unit e2e # # Run all tests.
75+ .PHONY : verify
76+ verify : manifests generate fmt vet # # Verify all generated code is up-to-date
77+ git diff --quiet
78+
79+ .PHONY : test e2e test-e2e kind-load kind-cluster kind-cluster-cleanup kind-deploy
80+ test : manifests generate fmt vet test-unit test-e2e # # Run all tests.
7381
7482FOCUS := $(if $(TEST ) ,-v -focus "$(TEST ) ")
7583E2E_FLAGS ?= ""
76- test- e2e : ginkgo # # Run the e2e tests
84+ e2e : ginkgo # ## Run the e2e tests
7785 $(GINKGO ) --tags $(GO_BUILD_TAGS ) $(E2E_FLAGS ) -trace -progress $(FOCUS ) test/e2e
7886
7987ENVTEST_VERSION = $(shell go list -m k8s.io/client-go | cut -d" " -f2 | sed 's/^v0\.\([[:digit:]]\{1,\}\) \.[[:digit:]]\{1,\}$$/1.\1.x/')
8088UNIT_TEST_DIRS =$(shell go list ./... | grep -v /test/)
8189test-unit : envtest # # Run the unit tests
8290 eval $$($(ENVTEST ) use -p env $(ENVTEST_VERSION ) ) && go test -tags $(GO_BUILD_TAGS ) -count=1 -short $(UNIT_TEST_DIRS ) -coverprofile cover.out
8391
84- e2e : KIND_CLUSTER_NAME=operator-controller-e2e
85- e2e : run test- e2e kind-cluster-cleanup # # Run e2e test suite on local kind cluster
92+ test- e2e : KIND_CLUSTER_NAME=operator-controller-e2e
93+ test- e2e : run e2e kind-cluster-cleanup # # Run e2e test suite on local kind cluster
8694
87- kind-load : kind # # Loads the currently constructed image onto the kind cluster
95+ kind-load : kind # ## Loads the currently constructed image onto the kind cluster
8896 $(KIND ) load docker-image $(IMG ) --name $(KIND_CLUSTER_NAME )
8997
90- kind-cluster : kind kind-cluster-cleanup # # Standup a kind cluster
98+ kind-cluster : kind kind-cluster-cleanup # ## Standup a kind cluster
9199 $(KIND ) create cluster --name ${KIND_CLUSTER_NAME}
92100 $(KIND ) export kubeconfig --name ${KIND_CLUSTER_NAME}
93101
94102kind-deploy : export MANIFEST="./operator-controller.yaml"
95- kind-deploy : kind manifests kustomize # # Install controller and dependencies onto the kind cluster
103+ kind-deploy : kind manifests kustomize # ## Install controller and dependencies onto the kind cluster
96104 kubectl kustomize config/default > operator-controller.yaml
97105 envsubst ' $$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
98106
99- kind-cluster-cleanup : kind # # Delete the kind cluster
107+ kind-cluster-cleanup : kind # ## Delete the kind cluster
100108 $(KIND ) delete cluster --name ${KIND_CLUSTER_NAME}
101109
102110# #@ Build
@@ -106,12 +114,12 @@ BUILDDEPS = manifests generate fmt vet goreleaser
106114
107115.PHONY : build
108116build : BUILDBIN = bin
109- build : $(BUILDDEPS ) # # Build manager binary using goreleaser for current GOOS and GOARCH.
117+ build : $(BUILDDEPS ) # # Build manager binary using goreleaser for current GOOS and GOARCH. Default target.
110118 $(BUILDCMD )
111119
112120.PHONY : build-linux
113121build-linux : BUILDBIN = bin/linux
114- build-linux : $(BUILDDEPS ) # # Build manager binary using goreleaser for GOOS=linux and local GOARCH.
122+ build-linux : $(BUILDDEPS ) # ## Build manager binary using goreleaser for GOOS=linux and local GOARCH.
115123 GOOS=linux $(BUILDCMD )
116124
117125.PHONY : run
@@ -122,7 +130,7 @@ wait:
122130 kubectl wait --for=condition=Available --namespace=$(OPERATOR_CONTROLLER_NAMESPACE ) deployment/operator-controller-controller-manager --timeout=$(WAIT_TIMEOUT )
123131
124132.PHONY : docker-build
125- docker-build : build-linux # # Build docker image for operator-controller with GOOS=linux and local GOARCH.
133+ docker-build : build-linux # ## Build docker image for operator-controller with GOOS=linux and local GOARCH.
126134 docker build -t ${IMG} -f Dockerfile ./bin/linux
127135
128136# ##########
@@ -138,7 +146,7 @@ release: goreleaser ## Runs goreleaser for the operator-controller. By default,
138146 $(GORELEASER ) $(GORELEASER_ARGS )
139147
140148quickstart : export MANIFEST="https://github.com/operator-framework/operator-controller/releases/download/$(VERSION ) /operator-controller.yaml"
141- quickstart : kustomize # # Generate the installation release manifests and scripts with dependencies
149+ quickstart : kustomize # ## Generate the installation release manifests and scripts with dependencies
142150 kubectl kustomize config/default | sed " s/:devel/:$( VERSION) /g" > operator-controller.yaml
143151 envsubst ' $$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh
144152
@@ -153,11 +161,11 @@ ifndef ignore-not-found
153161endif
154162
155163.PHONY : install
156- install : manifests kustomize # # Install CRDs into the K8s cluster specified in ~/.kube/config.
164+ install : manifests kustomize # ## Install CRDs into the K8s cluster specified in ~/.kube/config.
157165 $(KUSTOMIZE ) build config/crd | kubectl apply -f -
158166
159167.PHONY : uninstall
160- 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.
168+ 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.
161169 $(KUSTOMIZE ) build config/crd | kubectl delete --ignore-not-found=$(ignore-not-found ) -f -
162170
163171.PHONY : deploy
@@ -193,23 +201,23 @@ KUSTOMIZE_VERSION ?= v4.5.7
193201CONTROLLER_TOOLS_VERSION ?= v0.10.0
194202
195203.PHONY : kind
196- kind : $(KIND ) # # Download kind locally if necessary.
204+ kind : $(KIND ) # ## Download kind locally if necessary.
197205$(KIND ) : $(LOCALBIN )
198206 test -s
$(LOCALBIN ) /kind
|| GOBIN=
$(LOCALBIN ) go install sigs.k8s.io/
[email protected] 199207
200208.PHONY : ginkgo
201- ginkgo : $(GINKGO ) # # Download ginkgo locally if necessary.
209+ ginkgo : $(GINKGO ) # ## Download ginkgo locally if necessary.
202210$(GINKGO ) : $(LOCALBIN )
203211 test -s
$(LOCALBIN ) /ginkgo
|| GOBIN=
$(LOCALBIN ) go install github.com/onsi/ginkgo/v2/
[email protected] 204212
205213.PHONY : goreleaser
206- goreleaser : $(GORELEASER ) # # Builds a local copy of goreleaser
214+ goreleaser : $(GORELEASER ) # ## Builds a local copy of goreleaser
207215$(GORELEASER ) : $(LOCALBIN )
208216 test -s $(LOCALBIN ) /goreleaser || GOBIN=$(LOCALBIN ) go install github.com/goreleaser/goreleaser@${GORELEASER_VERSION}
209217
210218KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
211219.PHONY : kustomize
212- kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
220+ kustomize : $(KUSTOMIZE ) # ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
213221$(KUSTOMIZE ) : $(LOCALBIN )
214222 @if test -x $(LOCALBIN ) /kustomize && ! $(LOCALBIN ) /kustomize version | grep -q $(KUSTOMIZE_VERSION ) ; then \
215223 echo " $( LOCALBIN) /kustomize version is not expected $( KUSTOMIZE_VERSION) . Removing it before installing." ; \
@@ -218,12 +226,12 @@ $(KUSTOMIZE): $(LOCALBIN)
218226 test -s $(LOCALBIN ) /kustomize || { curl -Ss $( KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $( subst v,,$( KUSTOMIZE_VERSION) ) $( LOCALBIN) ; }
219227
220228.PHONY : controller-gen
221- controller-gen : $(CONTROLLER_GEN ) # # Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
229+ controller-gen : $(CONTROLLER_GEN ) # ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
222230$(CONTROLLER_GEN ) : $(LOCALBIN )
223231 test -s $(LOCALBIN ) /controller-gen && $(LOCALBIN ) /controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION ) || \
224232 GOBIN=$(LOCALBIN ) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION )
225233
226234.PHONY : envtest
227- envtest : $(ENVTEST ) # # Download envtest-setup locally if necessary.
235+ envtest : $(ENVTEST ) # ## Download envtest-setup locally if necessary.
228236$(ENVTEST ) : $(LOCALBIN )
229237 test -s $(LOCALBIN ) /setup-envtest || GOBIN=$(LOCALBIN ) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
0 commit comments