Fix etcd race condition issue

Currently, Magnum is using k8s API /version to check the API
availibility which is not a good way because /version only
reflects if the basic k8s api is working on not. And it will
return response even the etcd service is down. This patch fixes
it by using /healthz to replace /version.

Task: 22566
Story: 1775759

Change-Id: I45a1bd48a22842a251dafa6c349f0022fd319e3f
changes/84/579484/6
Feilong Wang 4 years ago
parent 9375dc2ae5
commit f6d1c0de46
  1. 2
      magnum/drivers/common/templates/kubernetes/fragments/calico-service.sh
  2. 2
      magnum/drivers/common/templates/kubernetes/fragments/core-dns-service.sh
  3. 2
      magnum/drivers/common/templates/kubernetes/fragments/enable-ingress-traefik.sh
  4. 2
      magnum/drivers/common/templates/kubernetes/fragments/enable-prometheus-monitoring.sh
  5. 2
      magnum/drivers/common/templates/kubernetes/fragments/kube-apiserver-to-kubelet-role.sh
  6. 10
      magnum/drivers/common/templates/kubernetes/fragments/kube-dashboard-service.sh
  7. 7
      magnum/drivers/common/templates/kubernetes/fragments/wc-notify-master.sh

@ -456,7 +456,7 @@ if [ "$MASTER_INDEX" != "0" ]; then
exit 0
fi
until curl -sf "http://127.0.0.1:8080/healthz"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
echo "Waiting for Kubernetes API..."
sleep 5

@ -255,7 +255,7 @@ if [ "$MASTER_INDEX" != "0" ]; then
fi
echo "Waiting for Kubernetes API..."
until curl --silent "http://127.0.0.1:8080/version"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done

@ -121,7 +121,7 @@ fi
# Binary for ingress traefik
INGRESS_TRAEFIK_BIN_CONTENT='''#!/bin/sh
until curl -sf "http://127.0.0.1:8080/healthz"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
echo "Waiting for Kubernetes API..."
sleep 5

@ -369,7 +369,7 @@ GRAFANA_DEF_DASHBOARD_FILE=$GRAFANA_DEF_DASHBOARDS"/default.json"
# Write the binary for enable-monitoring
KUBE_MON_BIN_CONTENT='''#!/bin/sh
until curl -sf "http://127.0.0.1:8080/healthz"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
echo "Waiting for Kubernetes API..."
sleep 5

@ -12,7 +12,7 @@ if [ "$MASTER_INDEX" != "0" ]; then
fi
echo "Waiting for Kubernetes API..."
until curl --silent "http://127.0.0.1:8080/version"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done

@ -335,8 +335,14 @@ spec:
EOF
}
if [ "$MASTER_INDEX" != "0" ]; then
exit 0
fi
echo "Waiting for Kubernetes API..."
until curl --silent "http://127.0.0.1:8080/version"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done
@ -459,7 +465,7 @@ if [ "$MASTER_INDEX" != "0" ]; then
fi
echo "Waiting for Kubernetes API..."
until curl --silent "http://127.0.0.1:8080/version"
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
sleep 5
done

@ -13,7 +13,8 @@ WC_NOTIFY_SERVICE=/etc/systemd/system/wc-notify.service
cat > $WC_NOTIFY_BIN <<EOF
#!/bin/bash -v
until curl -sf "http://127.0.0.1:8080/healthz"; do
until [ "ok" = "$(curl --silent http://127.0.0.1:8080/healthz)" ]
do
echo "Waiting for Kubernetes API..."
sleep 5
done
@ -23,8 +24,8 @@ EOF
cat > $WC_NOTIFY_SERVICE <<EOF
[Unit]
Description=Notify Heat
After=docker.service etcd.service
Requires=docker.service etcd.service
After=docker.service
Requires=docker.service
[Service]
Type=oneshot
ExecStart=$WC_NOTIFY_BIN

Loading…
Cancel
Save