Skip to content
Permalink
Browse files

Added a Kubernetes image diff between contexts

  • Loading branch information...
eko committed Mar 22, 2019
1 parent 24b3ccc commit 6f196481802fbe3a068e5cd3100d8868fa10c5e4
Showing with 15 additions and 0 deletions.
  1. +1 −0 .brew
  2. +14 −0 .functions
1 .brew
@@ -21,6 +21,7 @@ brew install bash
brew install bat
brew install ffmpeg
brew install fzf
brew install grc
brew install rs/tap/jaggr
brew install rs/tap/jplot
brew install oath-toolkit
@@ -393,6 +393,20 @@ function kforward {
kubectl port-forward --context=$1 -n $2 $podName $4
}

function kubernetes_image_diff {
k describe pods -n $1 --context $2 | grep Image: | cut -d':' -f2 -f3 | cut -d'/' -f2- | tr -d ' ' > /tmp/$2.diff
}

# Kubernetes image diff between 2 contexts
# Usage: kdiff <namespace> <dest env> <src env>
function kdiff {
kubernetes_image_diff $1 $2
kubernetes_image_diff $1 $3

grc diff -d /tmp/$2.diff /tmp/$3.diff
rm /tmp/$2.diff /tmp/$3.diff
}

# Usage: swap <file1> <file2>
function swap() {
mv $1 $1.tmp && mv $2 $1 && mv $1.tmp $2;

0 comments on commit 6f19648

Please sign in to comment.
You can’t perform that action at this time.