Skip to content

Instantly share code, notes, and snippets.

@kylegato
Created June 22, 2017 18:32
Show Gist options
  • Save kylegato/3474d14bf69274ba4f84c0c9ff00e869 to your computer and use it in GitHub Desktop.
Save kylegato/3474d14bf69274ba4f84c0c9ff00e869 to your computer and use it in GitHub Desktop.
fetch specified version of kube-aws && configure symlink in /usr/local/bin
#!/usr/bin/env bash
#set -v
# TODO:
# if we continue to use shell scripts here need to provide means for finding latest, aws-kube doesn't have a latest txt file like kubernetes has for other projects where we could wget it tho.
# so for now we'd have to know which version. we could change to require a version number too not sure best method to get that other than hitting the releases page and clicking on the link of the latest ATM.
kernel=$(uname -s)
case "${kernel}" in
Darwin)
export PLATFORM="darwin"
;;
Linux)
export PLATFORM="linux"
;;
*)
echo "Unknown, unsupported platform: ${kernel}." >&2
echo "Supported platforms: Linux, Darwin." >&2
echo "Bailing out." >&2
exit 2
esac
if [ -z "$1" ] ; then
printf "\nError \$1 undefined, \$1 must be desired kube-aws version"
printf "\ni.e.: [sudo] $0 v0.9.1-rc.2\n\n"
exit 1
fi
kube_aws_version="${1}"
printf "$kube_aws_version\n"
# Download kube-aws
# download and Import the CoreOS Application Signing Public Key:
mkdir -p /tmp/kube-aws
cd /tmp/kube-aws
# get key as of sometime 2017-02 developers skipping CoreOS signing due to some releases never getting signed/released
#wget https://coreos.com/dist/pubkeys/app-signing-pubkey.gpg
# add key
#gpg2 --keyserver pgp.mit.edu --recv-key FC8A365E
# Validate the key fingerprint:
#gpg2 --fingerprint FC8A365E
# get latest kube-aws tarball for architecture https://github.com/coreos/coreos-kubernetes/releases
#wget https://github.com/coreos/coreos-kubernetes/releases/download/v0.8.3/kube-aws-linux-amd64.tar.gz
# notified via coorespondance on https://github.com/coreos/coreos-kubernetes/issues/675 that they migrated their repo
#wget https://github.com/coreos/kube-aws/releases/download/v0.9.1-rc.2/kube-aws-${PLATFORM}-amd64.tar.gz
# official docs still point to previous/existing repo and release probl will change soon but the new repo are just release candidates ATM
# Note old repo still the documented repo and older stable release v0.8.3:
#wget https://github.com/coreos/coreos-kubernetes/releases/download/${kube_aws_version}/kube-aws-${PLATFORM}-amd64.tar.gz
#
# core developer informed me of via interaction on github issues this is the new repo/location
wget https://github.com/coreos/kube-aws/releases/download/${kube_aws_version}/kube-aws-${PLATFORM}-amd64.tar.gz
# verify package
#gpg2 --verify kube-aws-${PLATFORM}.tar.gz.sig kube-aws-${PLATFORM}.tar.gz
# Extract the binary:
tar zxvf kube-aws-${PLATFORM}-amd64.tar.gz
# Add kube-aws to your /usr/local/bin:
sudo mv ${PLATFORM}-amd64/kube-aws /usr/local/bin/kube-aws-${kube_aws_version}
# remove any existing sym links
sudo rm -fr /usr/local/bin/kube-aws
# create sym link to specified version
sudo ln -s /usr/local/bin/kube-aws-${kube_aws_version} /usr/local/bin/kube-aws
# show kube-aws version
/usr/local/bin/kube-aws version
rm -fr /tmp/kube-aws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment