Skip to content

Instantly share code, notes, and snippets.

@onlymellb
Last active March 1, 2018 08:27
Show Gist options
  • Save onlymellb/6cabac2b113b41dee3848bd9e3ea79b8 to your computer and use it in GitHub Desktop.
Save onlymellb/6cabac2b113b41dee3848bd9e3ea79b8 to your computer and use it in GitHub Desktop.
#!/bin/bash -xe
ns=${1:-}
mode=${2:-debug}
if [[ ${mode} == debug ]]
then
patch='{"metadata":{"labels":{"runmode":"debug"}}}'
else
patch='{"metadata":{"labels":{"runmode":"normal"}}}'
fi
pods=`kubectl get po -n ${ns}|grep tikv|cut -d' ' -f1`
for pod in ${pods}
do
echo "start to patch ns: ${ns}, pod: ${pod}"
kubectl patch po/${pod} -n ${ns} --patch ${patch}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment