Skip to content

Commit c478cd2

Browse files
authored
make deploy velero namespace fix (#506)
* make deploy velero namespace fix * add changes for undeploy * add deploy-tmp-cleanup
1 parent 2cbc2c9 commit c478cd2

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

Makefile

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,18 +138,28 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
138138
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
139139
$(KUSTOMIZE) build config/crd | kubectl delete -f -
140140

141-
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
141+
DEPLOY_TMP=/tmp/oadp-make-deploy
142+
deploy-tmp: kustomize
143+
mkdir -p $(DEPLOY_TMP)
144+
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-service_account.yaml > $(DEPLOY_TMP)/velero-service_account.yaml
145+
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-role.yaml > $(DEPLOY_TMP)/velero-role.yaml
146+
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-role_binding.yaml > $(DEPLOY_TMP)/velero-role_binding.yaml
147+
deploy-tmp-cleanup:
148+
rm -rf $(DEPLOY_TMP)
149+
deploy: manifests deploy-tmp ## Deploy controller to the K8s cluster specified in ~/.kube/config.
142150
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
143151
$(KUSTOMIZE) build config/default | kubectl apply -f -
144-
kubectl apply -f config/velero/velero-service_account.yaml
145-
kubectl apply -f config/velero/velero-role.yaml
146-
kubectl apply -f config/velero/velero-role_binding.yaml
147-
148-
undeploy: kustomize ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
149-
kubectl delete -f config/velero/velero-service_account.yaml
150-
kubectl delete -f config/velero/velero-role.yaml
151-
kubectl delete -f config/velero/velero-role_binding.yaml
152+
kubectl apply -f $(DEPLOY_TMP)/velero-service_account.yaml
153+
kubectl apply -f $(DEPLOY_TMP)/velero-role.yaml
154+
kubectl apply -f $(DEPLOY_TMP)/velero-role_binding.yaml
155+
make deploy-tmp-cleanup
156+
157+
undeploy: deploy-tmp ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
158+
kubectl delete -f $(DEPLOY_TMP)/velero-service_account.yaml
159+
kubectl delete -f $(DEPLOY_TMP)/velero-role.yaml
160+
kubectl delete -f $(DEPLOY_TMP)/velero-role_binding.yaml
152161
$(KUSTOMIZE) build config/default | kubectl delete -f -
162+
make deploy-tmp-cleanup
153163

154164
build-deploy: THIS_IMAGE=ttl.sh/oadp-operator-$(shell git rev-parse --short HEAD):1h # Set target specific variable
155165
build-deploy: ## Build current branch image and deploy controller to the k8s cluster specified in ~/.kube/config.

0 commit comments

Comments
 (0)