Skip to content

Commit

Permalink
Merge pull request #326 from gthiemonge/fix-rbac-nodes
Browse files Browse the repository at this point in the history
Add missing RBAC to get the list of nodes
  • Loading branch information
openshift-merge-bot[bot] authored Jun 17, 2024
2 parents 2787761 + fbd1fdb commit 7e66f41
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- list
- apiGroups:
- ""
resources:
Expand Down
1 change: 1 addition & 0 deletions controllers/amphoracontroller_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ func (r *OctaviaAmphoraControllerReconciler) GetLogger(ctx context.Context) logr
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update
// service account permissions that are needed to grant permission to the above
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list

// Reconcile implementation of the reconcile loop for amphora
// controllers like the octavia housekeeper, worker and health manager
Expand Down
6 changes: 5 additions & 1 deletion controllers/octavia_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (r *OctaviaReconciler) GetLogger(ctx context.Context) logr.Logger {
// service account permissions that are needed to grant permission to the above
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;privileged,resources=securitycontextconstraints,verbs=use
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
// +kubebuilder:rbac:groups="",resources=nodes,verbs=get;list

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

nodes, _ := helper.GetKClient().CoreV1().Nodes().List(ctx, metav1.ListOptions{})
nodes, err := helper.GetKClient().CoreV1().Nodes().List(ctx, metav1.ListOptions{})
if err != nil {
return ctrl.Result{}, err
}
updatedMap := make(map[string]string)
allocatedIPs := make(map[string]bool)
var predictableIPsRequired []string
Expand Down

0 comments on commit 7e66f41

Please sign in to comment.