Skip to content

Commit

Permalink
Merge pull request #431 from gthiemonge/18.0-fr1_fix_node_selector
Browse files Browse the repository at this point in the history
Use nodeSelector for predictable IP address allocation
  • Loading branch information
openshift-merge-bot[bot] authored Dec 17, 2024
2 parents b77b16b + 08e6bba commit c329037
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/octavia_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"

k8s_errors "k8s.io/apimachinery/pkg/api/errors"
k8s_labels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/kubernetes"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -781,7 +782,11 @@ 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, err := helper.GetKClient().CoreV1().Nodes().List(ctx, metav1.ListOptions{})
listOpts := metav1.ListOptions{}
if instance.Spec.NodeSelector != nil {
listOpts.LabelSelector = k8s_labels.Set(*instance.Spec.NodeSelector).String()
}
nodes, err := helper.GetKClient().CoreV1().Nodes().List(ctx, listOpts)
if err != nil {
return ctrl.Result{}, err
}
Expand Down

0 comments on commit c329037

Please sign in to comment.