Skip to content

Commit a7fc753

Browse files
committed
Add updated testdata
1 parent c988208 commit a7fc753

File tree

4 files changed

+152
-120
lines changed

4 files changed

+152
-120
lines changed

testdata/project-v3-addon/Makefile

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,78 @@ endif
1313

1414
all: manager
1515

16-
# Run tests
16+
##@ Targets
17+
18+
# The help target prints out all targets with their descriptions organized
19+
# beneath their categories. The categories are represented by '##@' and the
20+
# target descriptions by '##'. The awk commands is responsible for reading the
21+
# entire set of makefiles included in this invocation, looking for lines of the
22+
# file as xyz: ## something, and then pretty-format the target and help. Then,
23+
# if there's a line with ##@ something, that gets pretty-printed as a category.
24+
# More info on the usage of ANSI control characters for terminal formatting:
25+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
26+
# More info on the awk command:
27+
# http://linuxcommand.org/lc3_adv_awk.php
28+
29+
.PHONY: help
30+
help: ## Display this help.
31+
@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)
32+
1733
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
18-
test: generate fmt vet manifests
34+
test: generate fmt vet manifests ## Run tests.
1935
mkdir -p ${ENVTEST_ASSETS_DIR}
2036
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
2137
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
2238

23-
# Build manager binary
24-
manager: generate fmt vet
39+
manager: generate fmt vet ## Build manager binary.
2540
go build -o bin/manager main.go
2641

27-
# Run against the configured Kubernetes cluster in ~/.kube/config
28-
run: generate fmt vet manifests
42+
run: generate fmt vet manifests ## Run a controller from your host.
2943
go run ./main.go
3044

31-
# Install CRDs into a cluster
32-
install: manifests kustomize
45+
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
3346
$(KUSTOMIZE) build config/crd | kubectl apply -f -
3447

35-
# Uninstall CRDs from a cluster
36-
uninstall: manifests kustomize
48+
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
3749
$(KUSTOMIZE) build config/crd | kubectl delete -f -
3850

39-
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
40-
deploy: manifests kustomize
51+
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
4152
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
4253
$(KUSTOMIZE) build config/default | kubectl apply -f -
4354

44-
# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config
45-
undeploy:
55+
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
4656
$(KUSTOMIZE) build config/default | kubectl delete -f -
4757

48-
# Generate manifests e.g. CRD, RBAC etc.
49-
manifests: controller-gen
58+
59+
manifests: controller-gen ## Generate manifests e.g. CRD, RBAC, etc.
5060
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
5161

52-
# Run go fmt against code
53-
fmt:
62+
fmt: ## Run go fmt against code.
5463
go fmt ./...
5564

56-
# Run go vet against code
57-
vet:
65+
66+
vet: ## Run go vet against code.
5867
go vet ./...
5968

60-
# Generate code
61-
generate: controller-gen
69+
generate: controller-gen ## Generate code.
6270
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
6371

64-
# Build the docker image
65-
docker-build: test
72+
73+
docker-build: test ## Build the docker image for the controller.
6674
docker build -t ${IMG} .
6775

68-
# Push the docker image
69-
docker-push:
76+
77+
docker-push: ## Push the docker image for the controller.
7078
docker push ${IMG}
7179

72-
# Download controller-gen locally if necessary
80+
7381
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
74-
controller-gen:
82+
controller-gen: ## Download controller-gen locally if necessary.
7583
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
7684

77-
# Download kustomize locally if necessary
85+
7886
KUSTOMIZE = $(shell pwd)/bin/kustomize
79-
kustomize:
87+
kustomize: ## Download kustomize locally if necessary.
8088
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
8189

8290
# go-get-tool will 'go get' any package $2 and install it to $1.

testdata/project-v3-config/Makefile

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,78 @@ endif
1313

1414
all: manager
1515

16-
# Run tests
16+
##@ Targets
17+
18+
# The help target prints out all targets with their descriptions organized
19+
# beneath their categories. The categories are represented by '##@' and the
20+
# target descriptions by '##'. The awk commands is responsible for reading the
21+
# entire set of makefiles included in this invocation, looking for lines of the
22+
# file as xyz: ## something, and then pretty-format the target and help. Then,
23+
# if there's a line with ##@ something, that gets pretty-printed as a category.
24+
# More info on the usage of ANSI control characters for terminal formatting:
25+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
26+
# More info on the awk command:
27+
# http://linuxcommand.org/lc3_adv_awk.php
28+
29+
.PHONY: help
30+
help: ## Display this help.
31+
@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)
32+
1733
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
18-
test: generate fmt vet manifests
34+
test: generate fmt vet manifests ## Run tests.
1935
mkdir -p ${ENVTEST_ASSETS_DIR}
2036
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
2137
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
2238

23-
# Build manager binary
24-
manager: generate fmt vet
39+
manager: generate fmt vet ## Build manager binary.
2540
go build -o bin/manager main.go
2641

27-
# Run against the configured Kubernetes cluster in ~/.kube/config
28-
run: generate fmt vet manifests
42+
run: generate fmt vet manifests ## Run a controller from your host.
2943
go run ./main.go
3044

31-
# Install CRDs into a cluster
32-
install: manifests kustomize
45+
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
3346
$(KUSTOMIZE) build config/crd | kubectl apply -f -
3447

35-
# Uninstall CRDs from a cluster
36-
uninstall: manifests kustomize
48+
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
3749
$(KUSTOMIZE) build config/crd | kubectl delete -f -
3850

39-
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
40-
deploy: manifests kustomize
51+
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
4152
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
4253
$(KUSTOMIZE) build config/default | kubectl apply -f -
4354

44-
# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config
45-
undeploy:
55+
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
4656
$(KUSTOMIZE) build config/default | kubectl delete -f -
4757

48-
# Generate manifests e.g. CRD, RBAC etc.
49-
manifests: controller-gen
58+
59+
manifests: controller-gen ## Generate manifests e.g. CRD, RBAC, etc.
5060
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
5161

52-
# Run go fmt against code
53-
fmt:
62+
fmt: ## Run go fmt against code.
5463
go fmt ./...
5564

56-
# Run go vet against code
57-
vet:
65+
66+
vet: ## Run go vet against code.
5867
go vet ./...
5968

60-
# Generate code
61-
generate: controller-gen
69+
generate: controller-gen ## Generate code.
6270
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
6371

64-
# Build the docker image
65-
docker-build: test
72+
73+
docker-build: test ## Build the docker image for the controller.
6674
docker build -t ${IMG} .
6775

68-
# Push the docker image
69-
docker-push:
76+
77+
docker-push: ## Push the docker image for the controller.
7078
docker push ${IMG}
7179

72-
# Download controller-gen locally if necessary
80+
7381
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
74-
controller-gen:
82+
controller-gen: ## Download controller-gen locally if necessary.
7583
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
7684

77-
# Download kustomize locally if necessary
85+
7886
KUSTOMIZE = $(shell pwd)/bin/kustomize
79-
kustomize:
87+
kustomize: ## Download kustomize locally if necessary.
8088
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
8189

8290
# go-get-tool will 'go get' any package $2 and install it to $1.

testdata/project-v3-multigroup/Makefile

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,70 +13,78 @@ endif
1313

1414
all: manager
1515

16-
# Run tests
16+
##@ Targets
17+
18+
# The help target prints out all targets with their descriptions organized
19+
# beneath their categories. The categories are represented by '##@' and the
20+
# target descriptions by '##'. The awk commands is responsible for reading the
21+
# entire set of makefiles included in this invocation, looking for lines of the
22+
# file as xyz: ## something, and then pretty-format the target and help. Then,
23+
# if there's a line with ##@ something, that gets pretty-printed as a category.
24+
# More info on the usage of ANSI control characters for terminal formatting:
25+
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
26+
# More info on the awk command:
27+
# http://linuxcommand.org/lc3_adv_awk.php
28+
29+
.PHONY: help
30+
help: ## Display this help.
31+
@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)
32+
1733
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
18-
test: generate fmt vet manifests
34+
test: generate fmt vet manifests ## Run tests.
1935
mkdir -p ${ENVTEST_ASSETS_DIR}
2036
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.7.0/hack/setup-envtest.sh
2137
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
2238

23-
# Build manager binary
24-
manager: generate fmt vet
39+
manager: generate fmt vet ## Build manager binary.
2540
go build -o bin/manager main.go
2641

27-
# Run against the configured Kubernetes cluster in ~/.kube/config
28-
run: generate fmt vet manifests
42+
run: generate fmt vet manifests ## Run a controller from your host.
2943
go run ./main.go
3044

31-
# Install CRDs into a cluster
32-
install: manifests kustomize
45+
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
3346
$(KUSTOMIZE) build config/crd | kubectl apply -f -
3447

35-
# Uninstall CRDs from a cluster
36-
uninstall: manifests kustomize
48+
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
3749
$(KUSTOMIZE) build config/crd | kubectl delete -f -
3850

39-
# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
40-
deploy: manifests kustomize
51+
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
4152
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
4253
$(KUSTOMIZE) build config/default | kubectl apply -f -
4354

44-
# UnDeploy controller from the configured Kubernetes cluster in ~/.kube/config
45-
undeploy:
55+
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
4656
$(KUSTOMIZE) build config/default | kubectl delete -f -
4757

48-
# Generate manifests e.g. CRD, RBAC etc.
49-
manifests: controller-gen
58+
59+
manifests: controller-gen ## Generate manifests e.g. CRD, RBAC, etc.
5060
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
5161

52-
# Run go fmt against code
53-
fmt:
62+
fmt: ## Run go fmt against code.
5463
go fmt ./...
5564

56-
# Run go vet against code
57-
vet:
65+
66+
vet: ## Run go vet against code.
5867
go vet ./...
5968

60-
# Generate code
61-
generate: controller-gen
69+
generate: controller-gen ## Generate code.
6270
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
6371

64-
# Build the docker image
65-
docker-build: test
72+
73+
docker-build: test ## Build the docker image for the controller.
6674
docker build -t ${IMG} .
6775

68-
# Push the docker image
69-
docker-push:
76+
77+
docker-push: ## Push the docker image for the controller.
7078
docker push ${IMG}
7179

72-
# Download controller-gen locally if necessary
80+
7381
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
74-
controller-gen:
82+
controller-gen: ## Download controller-gen locally if necessary.
7583
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/[email protected])
7684

77-
# Download kustomize locally if necessary
85+
7886
KUSTOMIZE = $(shell pwd)/bin/kustomize
79-
kustomize:
87+
kustomize: ## Download kustomize locally if necessary.
8088
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/[email protected])
8189

8290
# go-get-tool will 'go get' any package $2 and install it to $1.

0 commit comments

Comments
 (0)