Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This script inspects the present working directoy (`pwd`) and uses the
  4. # current repository's name to return the first running kubernetes pod which
  5. # matches the name of the repository.
  6.  
  7. # e.g. You are working in $HOME/zipmark/users-api
  8. # Running `current-pod` should return something like `users-api-3769667108-1ybyz`
  9.  
  10. # /foo/users-api becomes /foo/users
  11. NAME=$(pwd | sed 's/-api//g')
  12.  
  13. # select string contents after the final /
  14. SERVICE_NAME=${NAME##*/}
  15.  
  16. echo `kubectl get pods | grep $SERVICE_NAME | awk '{print $1}' | head -1`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement