Skip to content

Instantly share code, notes, and snippets.

@aarongorka
Created December 18, 2018 02:36
Show Gist options
  • Save aarongorka/80c049f39be25bd7a14a8a2cc98d05af to your computer and use it in GitHub Desktop.
Save aarongorka/80c049f39be25bd7a14a8a2cc98d05af to your computer and use it in GitHub Desktop.
A wrapper script to make `kubectl patch` idempotent
#!/usr/bin/env bash
set +e
result="$(kubectl patch "$@")"
code="$?"
if [[ "$code" != "0" && "$result" == "* not patched" ]]; then
echo "$result" 1>&2
exit "$code"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment