Skip to content

Instantly share code, notes, and snippets.

@unacceptable
Last active July 24, 2020 12:59
Show Gist options
  • Save unacceptable/92a82c1cebc1db9471b5de2eb8905e0e to your computer and use it in GitHub Desktop.
Save unacceptable/92a82c1cebc1db9471b5de2eb8905e0e to your computer and use it in GitHub Desktop.
# Restart pods in a deployment
kubepatch(){
TYPE="${1:-"deployment"}"
NAMESPACE="${2:-"dev"}"
NAME="$(kubectl get "$TYPE" -n "$NAMESPACE" | awk '{print $1}' | fzf)"
kubectl patch "$TYPE" \
"$NAME" \
-n "$NAMESPACE" \
-p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"date\":\"$(date '+%s')\"}}}}}" && \
kubectl rollout status "$TYPE" \
-n "$NAMESPACE" \
"$NAME"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment