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 3fdad92c8aa0976562f3cc6e75755cd323d37bc6
Showing with 14 additions and 0 deletions.
  1. +14 −0 .functions
@@ -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 3fdad92

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