Skip to content

Commit

Permalink
fix: only delete pod that restart policy is Always
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Mar 14, 2020
1 parent b28668b commit 8f6997a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ echo ""

echo "[Step 4] Delete pod that not in host network mode"
for ns in $(kubectl get ns --no-headers -o custom-columns=NAME:.metadata.name); do
for pod in $(kubectl get pod --no-headers -n "$ns" -o custom-columns=NAME:.metadata.name,HOST:spec.hostNetwork | awk '{if ($2!="true") print $1}'); do
for pod in $(kubectl get pod --no-headers -n "$ns" --field-selector spec.restartPolicy=Always -o custom-columns=NAME:.metadata.name,HOST:spec.hostNetwork | awk '{if ($2!="true") print $1}'); do
kubectl delete pod "$pod" -n "$ns"
done
done
Expand Down

0 comments on commit 8f6997a

Please sign in to comment.