Skip to content

Commit

Permalink
fix: check if taint exists before un-taint
Browse files Browse the repository at this point in the history
When retry install, un-taint for not exist taint will fail

```
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
error: taint "node-role.kubernetes.io/master:NoSchedule" not found
Makefile:180: recipe for target 'kind-install-underlay-ipv6' failed
make: *** [kind-install-underlay-ipv6] Error 1
Error: Final attempt failed. Child_process exited with error code 2
```
  • Loading branch information
oilbeater committed Feb 7, 2022
1 parent a5f4afa commit dad0ef6
Showing 1 changed file with 40 additions and 8 deletions.
48 changes: 40 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ kind-init-dual: kind-clean
.PHONY: kind-install
kind-install:
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true dist/images/install.sh
kubectl describe no

Expand Down Expand Up @@ -159,7 +163,11 @@ kind-install-underlay:
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
dist/images/install.sh > install-underlay.sh
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true ENABLE_VLAN=true VLAN_NIC=eth0 bash install-underlay.sh
kubectl describe no

Expand All @@ -172,7 +180,11 @@ kind-install-single:
.PHONY: kind-install-ipv6
kind-install-ipv6:
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true IPV6=true dist/images/install.sh

.PHONY: kind-install-underlay-ipv6
Expand All @@ -186,13 +198,21 @@ kind-install-underlay-ipv6:
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
dist/images/install.sh > install-underlay.sh
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true IPV6=true ENABLE_VLAN=true VLAN_NIC=eth0 bash install-underlay.sh

.PHONY: kind-install-dual
kind-install-dual:
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true DUAL_STACK=true dist/images/install.sh
kubectl describe no

Expand All @@ -210,7 +230,11 @@ kind-install-underlay-dual:
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
dist/images/install.sh > install-underlay.sh
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 bash install-underlay.sh

.PHONY: kind-install-underlay-logical-gateway-dual
Expand All @@ -227,7 +251,11 @@ kind-install-underlay-logical-gateway-dual:
-e 's@^VLAN_ID=.*@VLAN_ID="0"@' \
dist/images/install.sh > install-underlay.sh
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
ENABLE_SSL=true DUAL_STACK=true ENABLE_VLAN=true VLAN_NIC=eth0 LOGICAL_GATEWAY=true bash install-underlay.sh

.PHONY: kind-install-ic
Expand All @@ -247,7 +275,11 @@ kind-install-cilium:
kind load docker-image --name kube-ovn $(REGISTRY)/kube-ovn:$(RELEASE_TAG)
ENABLE_SSL=true ENABLE_LB=false ENABLE_NP=false dist/images/install.sh
kubectl describe no
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-
$(eval TAINTS = $(shell kubectl get no kube-ovn-control-plane -o jsonpath={.spec.taints}))
$(eval MASTER_TAINT = "node-role.kubernetes.io/master")
@if [[ "${TAINTS}" =~ .*"${MASTER_TAINT}".* ]]; then \
kubectl taint node kube-ovn-control-plane node-role.kubernetes.io/master:NoSchedule-; \
fi
kubectl apply -f yamls/chaining.yaml
kind get nodes --name kube-ovn | while read node; do \
docker exec $$node mv /etc/cni/net.d/01-kube-ovn.conflist /etc/cni/net.d/10-kube-ovn.conflist; \
Expand Down

0 comments on commit dad0ef6

Please sign in to comment.