Skip to content

Commit c5293b1

Browse files
authored
Makefile refactor deploy-tmp to velero-role-tmp expose apply-velerosa-role (#581)
1 parent b3e6819 commit c5293b1

File tree

1 file changed

+24
-19
lines changed

1 file changed

+24
-19
lines changed

Makefile

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,28 +174,33 @@ install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~
174174
uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
175175
$(KUSTOMIZE) build config/crd | kubectl delete -f -
176176

177-
DEPLOY_TMP=/tmp/oadp-make-deploy
178-
deploy-tmp: kustomize
179-
mkdir -p $(DEPLOY_TMP)
180-
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-service_account.yaml > $(DEPLOY_TMP)/velero-service_account.yaml
181-
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-role.yaml > $(DEPLOY_TMP)/velero-role.yaml
182-
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-role_binding.yaml > $(DEPLOY_TMP)/velero-role_binding.yaml
183-
deploy-tmp-cleanup:
184-
rm -rf $(DEPLOY_TMP)
185-
deploy: manifests deploy-tmp ## Deploy controller to the K8s cluster specified in ~/.kube/config.
177+
VELERO_ROLE_TMP?=/tmp/oadp-make-deploy
178+
velero-role-tmp: kustomize
179+
mkdir -p $(VELERO_ROLE_TMP)
180+
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-service_account.yaml > $(VELERO_ROLE_TMP)/velero-service_account.yaml
181+
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-role.yaml > $(VELERO_ROLE_TMP)/velero-role.yaml
182+
sed -e 's/namespace: system/namespace: $(OADP_TEST_NAMESPACE)/g' config/velero/velero-role_binding.yaml > $(VELERO_ROLE_TMP)/velero-role_binding.yaml
183+
velero-role-tmp-cleanup:
184+
rm -rf $(VELERO_ROLE_TMP)
185+
apply-velerosa-role: velero-role-tmp
186+
kubectl apply -f $(VELERO_ROLE_TMP)/velero-service_account.yaml
187+
kubectl apply -f $(VELERO_ROLE_TMP)/velero-role.yaml
188+
kubectl apply -f $(VELERO_ROLE_TMP)/velero-role_binding.yaml
189+
VELERO_ROLE_TMP=$(VELERO_ROLE_TMP) make velero-role-tmp-cleanup
190+
unapply-velerosa-role: velero-role-tmp
191+
kubectl delete -f $(VELERO_ROLE_TMP)/velero-service_account.yaml
192+
kubectl delete -f $(VELERO_ROLE_TMP)/velero-role.yaml
193+
kubectl delete -f $(VELERO_ROLE_TMP)/velero-role_binding.yaml
194+
VELERO_ROLE_TMP=$(VELERO_ROLE_TMP) make velero-role-tmp-cleanup
195+
196+
deploy: manifests velero-role-tmp ## Deploy controller to the K8s cluster specified in ~/.kube/config.
186197
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
187198
$(KUSTOMIZE) build config/default | kubectl apply -f -
188-
kubectl apply -f $(DEPLOY_TMP)/velero-service_account.yaml
189-
kubectl apply -f $(DEPLOY_TMP)/velero-role.yaml
190-
kubectl apply -f $(DEPLOY_TMP)/velero-role_binding.yaml
191-
make deploy-tmp-cleanup
192-
193-
undeploy: deploy-tmp ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
194-
kubectl delete -f $(DEPLOY_TMP)/velero-service_account.yaml
195-
kubectl delete -f $(DEPLOY_TMP)/velero-role.yaml
196-
kubectl delete -f $(DEPLOY_TMP)/velero-role_binding.yaml
199+
VELERO_ROLE_TMP=$(VELERO_ROLE_TMP) make apply-velerosa-role
200+
201+
undeploy: velero-role-tmp ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
202+
VELERO_ROLE_TMP=$(VELERO_ROLE_TMP) make unapply-velerosa-role
197203
$(KUSTOMIZE) build config/default | kubectl delete -f -
198-
make deploy-tmp-cleanup
199204

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

0 commit comments

Comments
 (0)