Verified Commit 1f24ad00 authored by Xueshan Feng's avatar Xueshan Feng
Browse files

added reboot-node target.

parent 90de4b8d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -76,3 +76,16 @@ recycle-node: ## Replace node with a new instance
		aws autoscaling terminate-instance-in-auto-scaling-group  \
		  --instance-id $$instance_id --no-should-decrement-desired-capacity ; \
	done

.PHONY: reboot-node
reboot-node: NODES = $$(kubectl get node -o json  | jq -r '.items[].metadata.name')
reboot-node: ## Replace node with a new instance
	kubectl get nodes
	@for i in ${NODES}; do \
		echo "" ; \
		echo "Reboot $$i?" ; \
		confirm 2> /dev/null || continue ; \
		instance_id=`kubectl get node $$i -o json | jq -r '.spec.externalID'` ; \
		aws ec2 reboot-instances  \
		  --instance-id $$instance_id ; \
	done