Skip to content

Commit

Permalink
Whereabouts should have RBAC for leases
Browse files Browse the repository at this point in the history
Newer feature in Whereabouts uses leases for coordination of leaders as to not cause a race condition in ip allocations.
  • Loading branch information
dougbtv committed Aug 24, 2021
1 parent f7e31c5 commit deed936
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
30 changes: 30 additions & 0 deletions bindata/network/multus/002-rbac.yaml
Expand Up @@ -78,6 +78,21 @@ subjects:
name: multus
namespace: openshift-multus

---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: multus-whereabouts
namespace: openshift-multus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: whereabouts-cni
subjects:
- kind: ServiceAccount
name: multus
namespace: openshift-multus

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand All @@ -97,3 +112,18 @@ rules:
- update
- patch
- delete

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
namespace: openshift-multus
name: whereabouts-cni
rules:
- apiGroups:
- coordination.k8s.io
resources:
- leases
verbs:
- '*'

2 changes: 1 addition & 1 deletion pkg/network/multus_test.go
Expand Up @@ -50,7 +50,7 @@ func TestRenderMultus(t *testing.T) {
g.Expect(objs).To(ContainElement(HaveKubernetesID("DaemonSet", "openshift-multus", "multus")))

// It's important that the namespace is first
g.Expect(len(objs)).To(Equal(20))
g.Expect(len(objs)).To(Equal(22))
g.Expect(objs[0]).To(HaveKubernetesID("CustomResourceDefinition", "", "network-attachment-definitions.k8s.cni.cncf.io"))
g.Expect(objs).To(ContainElement(HaveKubernetesID("Namespace", "", "openshift-multus")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("ClusterRole", "", "multus")))
Expand Down
2 changes: 1 addition & 1 deletion pkg/network/network_metrics_test.go
Expand Up @@ -50,7 +50,7 @@ func TestRenderNetworkMetricsDaemon(t *testing.T) {

// Check rendered object

g.Expect(len(objs)).To(Equal(20))
g.Expect(len(objs)).To(Equal(22))
g.Expect(objs).To(ContainElement(HaveKubernetesID("DaemonSet", "openshift-multus", "network-metrics-daemon")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("Service", "openshift-multus", "network-metrics-service")))
g.Expect(objs).To(ContainElement(HaveKubernetesID("ClusterRole", "", "metrics-daemon-role")))
Expand Down

0 comments on commit deed936

Please sign in to comment.