Skip to content

Commit

Permalink
ko: fix kube-proxy check (#1842)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzujian committed Aug 24, 2022
1 parent 5012ff3 commit 69cf5ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ENABLE_LB=${ENABLE_LB:-true}
ENABLE_NP=${ENABLE_NP:-true}
ENABLE_EIP_SNAT=${ENABLE_EIP_SNAT:-true}
LS_DNAT_MOD_DL_DST=${LS_DNAT_MOD_DL_DST:-true}
WITHOUT_KUBE_PROXY=${WITHOUT_KUBE_PROXY:-false}
ENABLE_EXTERNAL_VPC=${ENABLE_EXTERNAL_VPC:-true}
CNI_CONFIG_PRIORITY=${CNI_CONFIG_PRIORITY:-01}
ENABLE_LB_SVC=${ENABLE_LB_SVC:-false}
Expand Down
15 changes: 10 additions & 5 deletions dist/images/kubectl-ko
Original file line number Diff line number Diff line change
Expand Up @@ -539,13 +539,18 @@ checkDeployment(){
}

checkKubeProxy(){
if kubectl get ds -n kube-system --no-headers -o custom-columns=NAME:.metadata.name | grep -qw ^kube-proxy; then
if kubectl get ds -n kube-system --no-headers -o custom-columns=NAME:.metadata.name | grep '^kube-proxy$' >/dev/null; then
checkDaemonSet kube-proxy
else
nodeIps=`kubectl get node -o wide | grep -v "INTERNAL-IP" | awk '{print $6}'`
for node in $nodeIps
do
healthResult=`curl -g -6 -sL -w %{http_code} http://[$node]:10256/healthz -o /dev/null | grep -v 200 || true`
for node in $(kubectl get node --no-headers -o custom-columns=NAME:.metadata.name); do
local pod=$(kubectl get pod -n $KUBE_OVN_NS -l app=kube-ovn-cni -o 'jsonpath={.items[?(@.spec.nodeName=="'$node'")].metadata.name}')
local ip=$(kubectl get pod -n $KUBE_OVN_NS -l app=kube-ovn-cni -o 'jsonpath={.items[?(@.spec.nodeName=="'$node'")].status.podIP}')
local arg=""
if [[ $ip =~ .*:.* ]]; then
arg="g6"
ip="[$ip]"
fi
healthResult=$(kubectl -n $KUBE_OVN_NS exec $pod -- curl -s${arg} -m 3 -w %{http_code} http://$ip:10256/healthz -o /dev/null | grep -v 200 || true)
if [ -n "$healthResult" ]; then
echo "$node kube-proxy's health check failed"
exit 1
Expand Down

0 comments on commit 69cf5ca

Please sign in to comment.