Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement