@@ -124,11 +124,13 @@ $(LOCALBIN):
124124
125125# # Tool Binaries
126126KUBECTL ?= kubectl
127+ KUSTOMIZE := $(LOCALBIN ) /kustomize
127128ENVTEST ?= $(LOCALBIN ) /setup-envtest
128129GOLANGCI_LINT = $(LOCALBIN ) /golangci-lint
129130SWAGGER = $(LOCALBIN ) /swag
130131
131132# # Tool Versions
133+ KUSTOMIZE_VERSION ?= v5.5.0
132134ENVTEST_VERSION ?= release-0.19
133135GOLANGCI_LINT_VERSION ?= v1.61.0
134136SWAGGER_VERSION ?= v1.16.4
@@ -148,6 +150,26 @@ golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
148150$(GOLANGCI_LINT ) : $(LOCALBIN )
149151 $(call go-install-tool,$(GOLANGCI_LINT ) ,github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION ) )
150152
153+
154+ # #@ deployment
155+
156+ .PHONY : deploy
157+ deploy : kustomize # # Deploy backend to the K8s cluster specified in ~/.kube/config.
158+ cd config/default && $(KUSTOMIZE ) edit set image nbv2-backend=${IMG}
159+ $(KUSTOMIZE ) build config/default | $(KUBECTL ) apply -f -
160+
161+ .PHONY : undeploy
162+ undeploy : kustomize # # Undeploy backend from the K8s cluster specified in ~/.kube/config.
163+ $(KUSTOMIZE ) build config/default | $(KUBECTL ) delete --ignore-not-found=true -f -
164+
165+
166+ # #@ Dependencies
167+
168+ .PHONY : kustomize
169+ kustomize : $(KUSTOMIZE ) # # Download kustomize locally if necessary.
170+ $(KUSTOMIZE ) : $(LOCALBIN )
171+ $(call go-install-tool,$(KUSTOMIZE ) ,sigs.k8s.io/kustomize/kustomize/v5,$(KUSTOMIZE_VERSION ) )
172+
151173# go-install-tool will 'go install' any package with custom target and name of binary, if it doesn't exist
152174# $1 - target path with name of binary
153175# $2 - package url which can be installed
0 commit comments