Skip to content

Commit c2b9bf1

Browse files
committed
makefile: add basic deploy/install commands
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
1 parent 05d5a60 commit c2b9bf1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,36 @@ toc-update:
9999
toc-verify:
100100
./dev/tools/verify-toc
101101

102+
##@ Deployment
103+
IMG ?= agent-sandbox-controller:latest
104+
KUSTOMIZE_VERSION ?= v5.4.3
105+
106+
.PHONY: kustomize
107+
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
108+
$(KUSTOMIZE): $(LOCALBIN)
109+
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION))
110+
111+
ifndef ignore-not-found
112+
ignore-not-found = false
113+
endif
114+
115+
.PHONY: install
116+
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
117+
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
118+
119+
.PHONY: uninstall
120+
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.
121+
$(KUSTOMIZE) build config/crd | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
122+
123+
.PHONY: deploy
124+
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
125+
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
126+
$(KUSTOMIZE) build config/default | $(KUBECTL) apply -f -
127+
128+
.PHONY: undeploy
129+
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.
130+
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -
131+
102132
# --- Config / Kustomize / operator-sdk bundle ---
103133
# All generated k8s manifests live under config/ (CRDs in config/crd/bases, RBAC in config/rbac).
104134
# Bundle for OLM with: make bundle [VERSION=x.y.z]

0 commit comments

Comments
 (0)