Skip to content

Commit b4714e5

Browse files
committed
ref(make): simplify make deploy by using kubectl patch instead of tmp file
1 parent 61760fe commit b4714e5

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Makefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ include versioning.mk
88

99
SHELL_SCRIPTS = $(wildcard rootfs/bin/*) $(shell find "rootfs" -name '*.sh') $(wildcard _scripts/*.sh)
1010

11-
# Get the component informtation to a tmp location and get replica count
12-
KUBE := $(shell which kubectl)
13-
ifdef KUBE
14-
$(shell kubectl get deployment deis-$(COMPONENT) --namespace deis -o yaml > /tmp/deis-$(COMPONENT))
15-
endif
16-
1711
# Test processes used in quick unit testing
1812
TEST_PROCS ?= 4
1913

14+
check-kubectl:
15+
@if [ -z $$(which kubectl) ]; then \
16+
echo "kubectl binary could not be located"; \
17+
exit 2; \
18+
fi
19+
2020
check-docker:
2121
@if [ -z $$(which docker) ]; then \
2222
echo "Missing \`docker\` client which is required for development"; \
@@ -29,8 +29,8 @@ docker-build: check-docker
2929
docker build --rm -t ${IMAGE} rootfs
3030
docker tag ${IMAGE} ${MUTABLE_IMAGE}
3131

32-
deploy: docker-build docker-push
33-
sed 's#\(image:\) .*#\1 $(IMAGE)#' /tmp/deis-$(COMPONENT) | kubectl apply --validate=true -f -
32+
deploy: check-kubectl docker-build docker-push
33+
kubectl patch deployment deis-$(COMPONENT) --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"$(IMAGE)"}]'
3434

3535
clean: check-docker
3636
docker rmi $(IMAGE)

0 commit comments

Comments
 (0)