Last active
July 11, 2019 09:01
-
-
Save benjvi/4dbe4ba1ae5a65cf7597299b3098157f to your computer and use it in GitHub Desktop.
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
# dependencies | |
# cli: kubectl, pks, om, yq | |
alias k=kubectl | |
alias kube=kubectl | |
alias kube-use-ns="kubectl config set-context $(kubectl config current-context) --namespace" | |
pks-get-admin-pw() { | |
om curl --path "https://example.com/api/v0/deployed/products/$pks_product_id/credentials/.properties.uaa_admin_password" | jq -r ".credential.value.secret" 2> /dev/null | |
} | |
pks-admin-login() { | |
pks_product_id="$(om deployed-manifest -p pivotal-container-service | yq -r .name)" | |
if [ -z "$pks_product_id" ]; then | |
echo "PKS tile not found, do you have the right OM?" | |
return | |
fi | |
# uaa_admin_password is the admin login for pks | |
pks_admin_pw=$() | |
pks_api_hostname="$(om staged-config -p pivotal-container-service | yq -r '.["product-properties"][".properties.pks_api_hostname"].value')" | |
pks login -a "$pks_api_hostname" -k -u admin -p "$(pks-get-admin-pw)" | |
unset pks_admin_pw # paranoia | |
} | |
pks-uaa-admin-login() { | |
pks_host="$(pks-admin-login 2>&1 | grep "API Endpoint" | cut -d " " -f 3)" | |
uaac target "$pks_host:8443" --ca-cert "$(om-ca-cert-file)" | |
uaa_admin_token="$(om credentials -p pivotal-container-service -c .properties.pks_uaa_management_admin_client -t json | jq -r .secret)" | |
uaac token client get admin -s "$uaa_admin_token" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment