Make rbac creation idempotent.
Also cleanup the etcd data dir in jenkins.pull/2352/merge
parent
843782795a
commit
3d13450846
|
@ -67,9 +67,6 @@ hdiutil info \
|
|||
# Clean up xhyve processes
|
||||
pgrep xhyve | xargs kill || true
|
||||
|
||||
# kubeadm cleanup
|
||||
sudo kubeadm reset || true
|
||||
|
||||
# Set the executable bit on the e2e binary and out binary
|
||||
chmod +x out/e2e-${OS_ARCH}
|
||||
chmod +x out/minikube-${OS_ARCH}
|
||||
|
|
|
@ -34,5 +34,11 @@ EXTRA_ARGS="--bootstrapper=kubeadm"
|
|||
SUDO_PREFIX="sudo -E "
|
||||
export KUBECONFIG="/root/.kube/config"
|
||||
|
||||
# "none" driver specific cleanup from previous runs.
|
||||
# kubeadm
|
||||
sudo kubeadm reset || true
|
||||
# Cleanup data directory
|
||||
sudo rm -rf /data/*
|
||||
|
||||
# Download files and set permissions
|
||||
source common.sh
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
"encoding/json"
|
||||
"html/template"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/pkg/errors"
|
||||
clientv1 "k8s.io/api/core/v1"
|
||||
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
|
||||
|
@ -35,7 +36,10 @@ import (
|
|||
"k8s.io/minikube/pkg/util"
|
||||
)
|
||||
|
||||
const masterTaint = "node-role.kubernetes.io/master"
|
||||
const (
|
||||
masterTaint = "node-role.kubernetes.io/master"
|
||||
rbacName = "minikube-rbac"
|
||||
)
|
||||
|
||||
var master = ""
|
||||
|
||||
|
@ -92,7 +96,7 @@ func elevateKubeSystemPrivileges() error {
|
|||
client, err := k8s.GetClientset()
|
||||
clusterRoleBinding := &rbacv1beta1.ClusterRoleBinding{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
Name: "minikube-rbac",
|
||||
Name: rbacName,
|
||||
},
|
||||
Subjects: []rbacv1beta1.Subject{
|
||||
{
|
||||
|
@ -107,6 +111,10 @@ func elevateKubeSystemPrivileges() error {
|
|||
},
|
||||
}
|
||||
|
||||
if _, err := client.RbacV1beta1().ClusterRoleBindings().Get(rbacName, metav1.GetOptions{}); err == nil {
|
||||
glog.Infof("Role binding %s already exists. Skipping creation.", rbacName)
|
||||
return nil
|
||||
}
|
||||
_, err = client.RbacV1beta1().ClusterRoleBindings().Create(clusterRoleBinding)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "creating clusterrolebinding")
|
||||
|
|
Loading…
Reference in New Issue