Created
September 8, 2020 12:34
-
-
Save hassenius/378642f8185002a78bfac091afa34509 to your computer and use it in GitHub Desktop.
Script to get latest openshift clients
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
#!/usr/bin/env bash | |
# Figure out platform | |
if [[ "$(uname -s)" == "Darwin" ]]; then | |
# We're on a mac | |
PLATFORM="mac" | |
else | |
# Assume linux | |
PLATFORM="linux" | |
fi | |
VERSION="${1:-4.3.18}" | |
BASE="https://mirror.openshift.com/pub/openshift-v4/clients/ocp" | |
if [[ " stable candidate fast " =~ " ${VERSION} " ]]; then | |
INSTALLER_URL="${BASE}/${VERSION}/openshift-install-${PLATFORM}.tar.gz" | |
CLIENT_URL="${BASE}/${VERSION}/openshift-client-${PLATFORM}.tar.gz" | |
else | |
INSTALLER_URL="${BASE}/${VERSION}/openshift-install-${PLATFORM}-${VERSION}.tar.gz" | |
CLIENT_URL="${BASE}/${VERSION}/openshift-client-${PLATFORM}-${VERSION}.tar.gz" | |
fi | |
# Install the openshift installer | |
mkdir -p ~/tmp/openshift-clients | |
wget -O ~/tmp/openshift-clients/openshift-install.tar.gz ${INSTALLER_URL} | |
tar xzvf ~/tmp/openshift-clients/openshift-install.tar.gz --directory ~/tmp/openshift-clients/ | |
mv ~/tmp/openshift-clients/openshift-install ~/bin/openshift-install-${VERSION} | |
ln -sf ~/bin/openshift-install-${VERSION} ~/bin/openshift-install | |
openshift-install version | |
# Install the openshift client | |
wget -O ~/tmp/openshift-clients/openshift-client.tar.gz ${CLIENT_URL} | |
tar xzvf ~/tmp/openshift-clients/openshift-client.tar.gz --directory ~/tmp/openshift-clients/ | |
mv ~/tmp/openshift-clients/oc ~/bin/oc-${VERSION} | |
mv ~/tmp/openshift/clients/kubectl ~/bin/kubectl-${VERSION} | |
ln -sf ~/bin/oc-${VERSION} ~/bin/oc | |
ln -sf ~/bin/kubectl-${VERSION} ~/bin/kubectl | |
oc version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment