Created
June 15, 2017 16:22
-
-
Save lazypower/39a781ef8ab172ac2ae111f948d25aa1 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
#!/bin/bash | |
if [ ! -z $1 ]; then | |
CHANNEL=$1 | |
else | |
CHANNEL='1.6/stable' | |
fi | |
if [ -z $SNAP_RESOURCE_PATH ]; then | |
echo "Unable to continue. Missing SNAP_RESOURCE_PATH env var". | |
echo "Fix by: export SNAP_RESOURCE_PATH=/tmp/snaps as an example" | |
exit 1 | |
fi | |
function snap_upload() { | |
juju attach kubernetes-master kube-apiserver=$SNAP_RESOURCE_PATH/kube-apiserver.snap | |
juju attach kubernetes-master kube-controller-manager=$SNAP_RESOURCE_PATH/kube-controller-manager.snap | |
juju attach kubernetes-master kube-scheduler=$SNAP_RESOURCE_PATH/kube-scheduler.snap | |
juju attach kubernetes-master kubectl=$SNAP_RESOURCE_PATH/kubectl.snap | |
juju attach kubernetes-worker kube-proxy=$SNAP_RESOURCE_PATH/kube-proxy.snap | |
juju attach kubernetes-worker kubelet=$SNAP_RESOURCE_PATH/kubelet.snap | |
juju attach kubernetes-worker kubectl=$SNAP_RESOURCE_PATH/kubectl.snap | |
juju attach kubernetes-worker cni=$SNAP_RESOURCE_PATH/cni.tgz | |
} | |
echo "Download all cdk snaps? [y/N]" | |
read SNAP_DOWNLOAD | |
if [ $SNAP_DOWNLOAD == 'y' ]; then | |
mkdir -p $SNAP_RESOURCE_PATH | |
WORKING_PATH=$PWD | |
cd $SNAP_RESOURCE_PATH | |
rm *.snap | |
snap download kube-apiserver --channel $CHANNEL | |
mv kube-apiserver*.snap kube-apiserver.snap | |
snap download kube-controller-manager --channel $CHANNEL | |
mv kube-controller-manager*.snap kube-controller-manager.snap | |
snap download kube-scheduler --channel $CHANNEL | |
mv kube-scheduler*.snap kube-scheduler.snap | |
snap download kubectl --channel $CHANNEL | |
mv kubectl*.snap kubectl.snap | |
snap download kubelet --channel $CHANNEL | |
mv kubelet*.snap kubelet.snap | |
snap download kube-proxy --channel $CHANNEL | |
mv kube-proxy*.snap kube-proxy.snap | |
rm *.assert | |
cd $WORKING_PATH | |
fi | |
echo "Deploy and setup a RBAC test? [y/N]" | |
read RBAC_TEST | |
if [ "${RBAC_TEST}" == 'y' ]; then | |
echo "Add new model?" | |
read NEW_MODEL | |
if [ "${NEW_MODEL}" == 'y' ]; then | |
juju add-model $(petname) | |
fi | |
# juju deploy kubernetes-core | |
juju deploy $JUJU_REPOSITORY/bundles/canonical-kubernetes/bundles/core-flannel/bundle.yaml | |
echo "Upgrade Master and Worker?" | |
read UPGRADE_CHARMS | |
if [ "${UPGRADE_CHARMS}" == 'y' ]; then | |
juju upgrade-charm kubernetes-master --path=$JUJU_REPOSITORY/builds/kubernetes-master | |
# juju deploy $JUJU_REPOSITORY/builds/dex --to 0 | |
# juju add-relation dex easyrsa | |
juju upgrade-charm kubernetes-worker --path=$JUJU_REPOSITORY/builds/kubernetes-worker | |
snap_upload | |
fi | |
exit 0 | |
fi | |
echo "Deploy and setup a dex test? [y/N]" | |
read DEX_TEST | |
if [ "${DEX_TEST}" == 'y' ]; then | |
juju add-model $(petname) | |
juju deploy kubernetes-core | |
juju upgrade-charm kubernetes-master --path=$JUJU_REPOSITORY/builds/kubernetes-master | |
juju deploy $JUJU_REPOSITORY/builds/dex --to 0 | |
juju add-relation dex easyrsa | |
snap_upload | |
exit 0 | |
fi | |
echo "Attach snaps to kubernetes charms? [y/N]" | |
read SNAP_UPLOAD | |
if [ "${SNAP_UPLOAD}" == 'y' ]; then | |
snap_upload | |
fi | |
# manually fetched below here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment