Skip to content

Commit fbd1fdb

Browse files
committed
Add missing RBAC to get the list of nodes
1 parent 2787761 commit fbd1fdb

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

config/rbac/role.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ metadata:
55
creationTimestamp: null
66
name: manager-role
77
rules:
8+
- apiGroups:
9+
- ""
10+
resources:
11+
- nodes
12+
verbs:
13+
- get
14+
- list
815
- apiGroups:
916
- ""
1017
resources:

controllers/amphoracontroller_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func (r *OctaviaAmphoraControllerReconciler) GetLogger(ctx context.Context) logr
8787
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update
8888
// service account permissions that are needed to grant permission to the above
8989
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
90+
// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list
9091

9192
// Reconcile implementation of the reconcile loop for amphora
9293
// controllers like the octavia housekeeper, worker and health manager

controllers/octavia_controller.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ func (r *OctaviaReconciler) GetLogger(ctx context.Context) logr.Logger {
103103
// service account permissions that are needed to grant permission to the above
104104
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;privileged,resources=securitycontextconstraints,verbs=use
105105
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
106+
// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list
106107

107108
// Reconcile is part of the main kubernetes reconciliation loop which aims to
108109
// move the current state of the cluster closer to the desired state.
@@ -720,7 +721,10 @@ func (r *OctaviaReconciler) reconcileNormal(ctx context.Context, instance *octav
720721
// * do we want to provide a mechanism to temporarily disabling this list
721722
// for maintenance windows where nodes might be "coming and going"
722723

723-
nodes, _ := helper.GetKClient().CoreV1().Nodes().List(ctx, metav1.ListOptions{})
724+
nodes, err := helper.GetKClient().CoreV1().Nodes().List(ctx, metav1.ListOptions{})
725+
if err != nil {
726+
return ctrl.Result{}, err
727+
}
724728
updatedMap := make(map[string]string)
725729
allocatedIPs := make(map[string]bool)
726730
var predictableIPsRequired []string

0 commit comments

Comments
 (0)