Skip to content

Commit f58f593

Browse files
committed
Update Makefile targets for consistency
Fixes #226 * Rename the `install` target to `kind-deploy` * Remove the `generate` target from `kind-deplpoy` * Create a new `install` target that installs CRD; corollary to `uninstall` * Update help descriptions Signed-off-by: Todd Short <[email protected]>
1 parent 7929907 commit f58f593

File tree

2 files changed

+48
-8
lines changed

2 files changed

+48
-8
lines changed

.github/workflows/deploy.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: deploy-test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
deploy-basic:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- uses: actions/checkout@v3
16+
17+
- uses: actions/setup-go@v4
18+
with:
19+
go-version-file: go.mod
20+
21+
- name: Run basic unit tests
22+
run: |
23+
make kind-cluster
24+
make install
25+
kubectl get crds operators.operators.operatorframework.io
26+
make uninstall
27+
! kubectl get crds operators.operators.operatorframework.io
28+
make deploy
29+
kubectl get ns operator-controller-system
30+
make undeploy
31+
! kubectl get ns operator-controller-system

Makefile

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ fmt: ## Run go fmt against code.
6868
vet: ## Run go vet against code.
6969
go vet ./...
7070

71-
.PHONY: test test-e2e e2e kind-load kind-cluster kind-cluster-cleanup
71+
.PHONY: test test-e2e e2e kind-load kind-cluster kind-cluster-cleanup kind-deploy
7272
test: manifests generate fmt vet test-unit e2e ## Run all tests.
7373

7474
FOCUS := $(if $(TEST),-v -focus "$(TEST)")
@@ -84,13 +84,18 @@ test-unit: envtest ## Run the unit tests
8484
e2e: KIND_CLUSTER_NAME=operator-controller-e2e
8585
e2e: run test-e2e kind-cluster-cleanup ## Run e2e test suite on local kind cluster
8686

87-
kind-load: kind ## Loads the currently constructed image onto the cluster
87+
kind-load: kind ## Loads the currently constructed image onto the kind cluster
8888
$(KIND) load docker-image $(IMG) --name $(KIND_CLUSTER_NAME)
8989

9090
kind-cluster: kind kind-cluster-cleanup ## Standup a kind cluster
9191
$(KIND) create cluster --name ${KIND_CLUSTER_NAME}
9292
$(KIND) export kubeconfig --name ${KIND_CLUSTER_NAME}
9393

94+
kind-deploy: export MANIFEST="./operator-controller.yaml"
95+
kind-deploy: kind manifests kustomize ## Install controller and dependencies onto the kind cluster
96+
kubectl kustomize config/default > operator-controller.yaml
97+
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
98+
9499
kind-cluster-cleanup: kind ## Delete the kind cluster
95100
$(KIND) delete cluster --name ${KIND_CLUSTER_NAME}
96101

@@ -110,7 +115,7 @@ build-linux: $(BUILDDEPS) ## Build manager binary using goreleaser for GOOS=linu
110115
GOOS=linux $(BUILDCMD)
111116

112117
.PHONY: run
113-
run: docker-build kind-cluster kind-load install ## Build the operator-controller then deploy it into a new kind cluster.
118+
run: docker-build kind-cluster kind-load kind-deploy ## Build the operator-controller then deploy it into a new kind cluster.
114119

115120
.PHONY: wait
116121
wait:
@@ -133,21 +138,23 @@ release: goreleaser ## Runs goreleaser for the operator-controller. By default,
133138
$(GORELEASER) $(GORELEASER_ARGS)
134139

135140
quickstart: export MANIFEST="https://github.com/operator-framework/operator-controller/releases/download/$(VERSION)/operator-controller.yaml"
136-
quickstart: kustomize generate ## Generate the installation release manifests and scripts
141+
quickstart: kustomize ## Generate the installation release manifests and scripts with dependencies
137142
kubectl kustomize config/default | sed "s/:devel/:$(VERSION)/g" > operator-controller.yaml
138143
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh > install.sh
139144

145+
##############
146+
# Deployment #
147+
##############
148+
140149
##@ Deployment
141150

142151
ifndef ignore-not-found
143152
ignore-not-found = false
144153
endif
145154

146155
.PHONY: install
147-
install: export MANIFEST="./operator-controller.yaml"
148-
install: manifests kustomize generate ## Install CRDs into the K8s cluster specified in ~/.kube/config.
149-
kubectl kustomize config/default > operator-controller.yaml
150-
envsubst '$$CATALOGD_VERSION,$$CERT_MGR_VERSION,$$RUKPAK_VERSION,$$MANIFEST' < scripts/install.tpl.sh | bash -s
156+
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
157+
$(KUSTOMIZE) build config/crd | kubectl apply -f -
151158

152159
.PHONY: uninstall
153160
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.
@@ -166,6 +173,8 @@ undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/confi
166173
# Hack / Tools #
167174
################
168175

176+
##@ Tools
177+
169178
## Location to install dependencies to
170179
LOCALBIN ?= $(shell pwd)/hack/tools/bin
171180
$(LOCALBIN):

0 commit comments

Comments
 (0)