Created
January 19, 2017 16:14
-
-
Save mecampbellsoup/2035b9850a9d5af621b2c77c9875e44b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This script inspects the present working directoy (`pwd`) and uses the | |
| # current repository's name to return the first running kubernetes pod which | |
| # matches the name of the repository. | |
| # e.g. You are working in $HOME/zipmark/users-api | |
| # Running `current-pod` should return something like `users-api-3769667108-1ybyz` | |
| # /foo/users-api becomes /foo/users | |
| NAME=$(pwd | sed 's/-api//g') | |
| # select string contents after the final / | |
| SERVICE_NAME=${NAME##*/} | |
| echo `kubectl get pods | grep $SERVICE_NAME | awk '{print $1}' | head -1` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment