Skip to content
This repository has been archived by the owner on Oct 21, 2020. It is now read-only.

Make leader-election configurable: default endpoints object namespace to controller's instead of kube-system #957

Merged
merged 2 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions aws/efs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,20 +137,16 @@ If you are not using RBAC or OpenShift you can continue to the usage section.

### Authorization

If your cluster has RBAC enabled or you are running OpenShift you must authorize the provisioner. If you are in a namespace/project other than "default" either edit `deploy/auth/clusterrolebinding.yaml` or edit the `oadm policy` command accordingly.
If your cluster has RBAC enabled or you are running OpenShift you must authorize the provisioner. If you are in a namespace/project other than "default" edit `deploy/rbac.yaml`.

#### RBAC
```console
# Set the subject of the RBAC objects to the current namespace where the provisioner is being deployed
$ NAMESPACE=`kc config get-contexts | grep '^*' | tr -s ' ' | cut -d' ' -f5`
$ sed -i'' "s/namespace:.*/namespace: $NAMESPACE/g" ./deploy/rbac.yaml
$ kubectl create -f deploy/rbac.yaml
```

#### OpenShift
```console
$ oc create -f deploy/openshift-clusterrole.yaml
clusterrole "efs-provisioner-runner" created
$ oadm policy add-scc-to-user hostmount-anyuid system:serviceaccount:default:efs-provisioner
$ oadm policy add-cluster-role-to-user efs-provisioner-runner system:serviceaccount:default:efs-provisioner
```
### SELinux
If SELinux is enforcing on the node where the provisioner runs, you must enable writing from a pod to a remote NFS server (EFS in this case) on the node by running:
```console
Expand Down
20 changes: 0 additions & 20 deletions aws/efs/deploy/openshift-clusterrole.yaml

This file was deleted.

29 changes: 25 additions & 4 deletions aws/efs/deploy/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand All @@ -26,8 +23,32 @@ metadata:
subjects:
- kind: ServiceAccount
name: efs-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: ClusterRole
name: efs-provisioner-runner
apiGroup: rbac.authorization.k8s.io
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-efs-provisioner
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-efs-provisioner
subjects:
- kind: ServiceAccount
name: efs-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: Role
name: leader-locking-efs-provisioner
apiGroup: rbac.authorization.k8s.io
3 changes: 0 additions & 3 deletions ceph/cephfs/deploy/rbac/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
3 changes: 3 additions & 0 deletions ceph/cephfs/deploy/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["create", "get", "delete"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
3 changes: 0 additions & 3 deletions ceph/rbd/deploy/rbac/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
resources: ["services"]
resourceNames: ["kube-dns"]
Expand Down
3 changes: 3 additions & 0 deletions ceph/rbd/deploy/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
3 changes: 0 additions & 3 deletions digitalocean/manifests/rbac/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,3 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
3 changes: 3 additions & 0 deletions digitalocean/manifests/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ rules:
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
29 changes: 26 additions & 3 deletions flex/deploy/manifests/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ rules:
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]

---

Expand All @@ -41,3 +38,29 @@ apiVersion: v1
metadata:
name: flex-provisioner

---

kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-flex-provisioner
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]

---

kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-flex-provisioner
subjects:
- kind: ServiceAccount
name: flex-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: Role
name: leader-locking-flex-provisioner
apiGroup: rbac.authorization.k8s.io
26 changes: 0 additions & 26 deletions gluster/block/deploy/clusterrole.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions gluster/block/deploy/clusterrolebinding.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions gluster/block/deploy/openshift/openshift-clusterrole.yaml

This file was deleted.

59 changes: 59 additions & 0 deletions gluster/block/deploy/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: glusterblock-provisioner-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "create", "delete"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-glusterblock-provisioner
subjects:
- kind: ServiceAccount
name: glusterblock-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: glusterblock-provisioner-runner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-glusterblock-provisioner
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-glusterblock-provisioner
subjects:
- kind: ServiceAccount
name: glusterblock-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: Role
name: leader-locking-glusterblock-provisioner
apiGroup: rbac.authorization.k8s.io
26 changes: 0 additions & 26 deletions gluster/file/deploy/openshift/openshift-clusterrole.yaml

This file was deleted.

62 changes: 62 additions & 0 deletions gluster/file/deploy/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: glusterfile-provisioner-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch", "update"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
- apiGroups: [""]
resources: ["services"]
verbs: ["get"]
- apiGroups: [""]
resources: ["secrets"]
verbs: ["get", "create", "delete"]
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "create", "delete"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: run-glusterfile-provisioner
subjects:
- kind: ServiceAccount
name: glusterfile-provisioner
namespace: default
roleRef:
kind: ClusterRole
name: glusterfile-provisioner-runner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-glusterfile-provisioner
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "list", "watch", "create", "update", "patch"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-glusterfile-provisioner
subjects:
- kind: ServiceAccount
name: glusterfile-provisioner
# replace with namespace where provisioner is deployed
namespace: default
roleRef:
kind: Role
name: leader-locking-glusterfile-provisioner
apiGroup: rbac.authorization.k8s.io
Loading