Skip to content

Commit

Permalink
Enable RBAC in Minikube - Closes #287 (#343)
Browse files Browse the repository at this point in the history
* Enable RBAC in Minikube - Closes #287

Add role through sudo

Remove sudo

Do not add binding

Is the cluster available later?

Further debugging

More debugging

More debugging

More debugging

More debugging

Increase timeout

* MAke waiting for Minikube better

* Add explanatory comment
  • Loading branch information
scholzj authored Apr 3, 2018
1 parent adf7277 commit 5e6efc1
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions .travis/setup-kubernetes.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
#!/bin/bash

rm ~/.kube/config
rm -rf ~/.kube

function install_kubectl {
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl
sudo cp kubectl /usr/bin
}

function wait_for_minikube {
i="0"

while [ $i -lt 60 ]
do
kubectl cluster-info &> /dev/null
if [ $? -ne 0 ]
then
sleep 1
else
return 0
fi
i=$[$i+1]
done

return 1
}

if [ "$TEST_CLUSTER" = "minikube" ]; then
install_kubectl
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube
Expand All @@ -22,8 +40,22 @@ if [ "$TEST_CLUSTER" = "minikube" ]; then
docker run -d -p 5000:5000 registry

export KUBECONFIG=$HOME/.kube/config
sudo -E minikube start --vm-driver=none --insecure-registry localhost:5000
sudo -E minikube start --vm-driver=none --insecure-registry localhost:5000 --extra-config=apiserver.Authorization.Mode=RBAC
sudo -E minikube addons enable default-storageclass

wait_for_minikube

if [ $? -ne 0 ]
then
echo "Minikube failed to start"
exit 1
else
# The role needs to be added because Minikube is not fully prepared for RBAC.
# Without adding the cluster-admin rights to the default service account in kube-system
# some components would be crashing (such as KubeDNS). This should have no impact on
# RBAC for Strimzi during the system tests.
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
fi
elif [ "$TEST_CLUSTER" = "minishift" ]; then
#install_kubectl
MS_VERSION=1.13.1
Expand Down

0 comments on commit 5e6efc1

Please sign in to comment.