Skip to content

Commit

Permalink
Set NodeSelector correctly when using MatchExpressions in KataConfigP…
Browse files Browse the repository at this point in the history
…oolSelector

Fixes: openshift#118

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
  • Loading branch information
bpradipt committed Jun 11, 2021
1 parent c7365e9 commit 18a56bb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions controllers/openshift_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"context"
"encoding/json"
"fmt"
"k8s.io/apimachinery/pkg/labels"
"time"

"k8s.io/apimachinery/pkg/labels"

ignTypes "github.com/coreos/ignition/v2/config/v3_2/types"
"github.com/go-logr/logr"
mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1"
Expand Down Expand Up @@ -287,8 +288,13 @@ func (r *KataConfigOpenShiftReconciler) setRuntimeClass() (ctrl.Result, error) {
}

if r.kataConfig.Spec.KataConfigPoolSelector != nil {
r.Log.Info("KataConfigPoolSelector:", "r.kataConfig.Spec.KataConfigPoolSelector", r.kataConfig.Spec.KataConfigPoolSelector)
nodeSelector, err := metav1.LabelSelectorAsMap(r.kataConfig.Spec.KataConfigPoolSelector)
if err != nil {
r.Log.Error(err, "Unable to get nodeSelector for runtimeClass")
}
rc.Scheduling = &nodeapi.Scheduling{
NodeSelector: r.kataConfig.Spec.KataConfigPoolSelector.MatchLabels,
NodeSelector: nodeSelector,
}
}
return rc
Expand Down

0 comments on commit 18a56bb

Please sign in to comment.