-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create scripts that manage creation and connection to CAPI Developmen…
…t kubernetes cluster #38 fixes #38 Co-authored-by: Seth Boyles <[email protected]> Co-authored-by: Marc Paquette <[email protected]>
- Loading branch information
1 parent
94224ff
commit da817b1
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
pods=$(kubectl get pods -l workstation=true -o name | cut -d / -f 2) | ||
PS3="Please select your workstation pod or press 'q' to quit: " | ||
OLD_IFS=$IFS | ||
IFS=$'\n' | ||
select pod in $pods; do | ||
POD=$pod | ||
break | ||
done | ||
|
||
IFS=$OLD_IFS | ||
|
||
if [ -z "${POD}" ]; then | ||
echo "No pod selected. Goodbye" | ||
exit | ||
fi | ||
echo "Running 'kubectl exec --stdin --tty $pod -- /bin/bash'" | ||
echo "" | ||
echo "" | ||
kubectl exec --stdin --tty "$pod" -- /bin/bash |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
set -x | ||
|
||
CURRENT_CONTEXT=$(kubectl config current-context) | ||
HAS_CONTEXT=$? | ||
if [ $HAS_CONTEXT -ne 0 ] || [ $CURRENT_CONTEXT != "gke_cf-capi-arya_us-central1-c_capi-workstation" ] | ||
then | ||
echo "The current Kubernetes context is not set to CAPI's cluster." | ||
echo "Please run: gcloud container clusters get-credentials capi-workstation --zone us-central1-c" | ||
exit "1" | ||
fi | ||
|
||
set -ex | ||
|
||
echo "What would you like to call your workstation?" | ||
|
||
read -r STORY_ID | ||
|
||
kubectl create deployment $STORY_ID --image=cloudfoundry/capi:capi-workstation-test | ||
|
||
#if the above is successful | ||
kubectl label pods -l app="$STORY_ID" workstation=true | ||
|
||
POD_NAME=$(kubectl get pod -l app=$STORY_ID -o name | cut -f 2 -d /) | ||
|
||
echo "Please connect to your workstation via the following command:" | ||
echo "kubectl exec --stdin --tty $POD_NAME -- /bin/bash" |