Skip to content

Commit

Permalink
fix(controller): Add scheduler name validation for StatefulSet podgro…
Browse files Browse the repository at this point in the history
…up creation

Signed-off-by: liuqw <[email protected]>
  • Loading branch information
liuqw committed Feb 7, 2025
1 parent fd37d99 commit e1c17e9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controllers/podgroup/pg_controller_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package podgroup
import (
"context"
"encoding/json"
"slices"
"strings"

appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -138,6 +139,10 @@ func (pg *pgcontroller) addStatefulSet(obj interface{}) {
if len(pods) > 0 {
pod := pods[0]
klog.V(4).Infof("Try to create podgroup for pod %s/%s", pod.Namespace, pod.Name)
if !slices.Contains(pg.schedulerNames, pod.Spec.SchedulerName) {
klog.V(4).Infof("Pod %s field SchedulerName is not matched", klog.KObj(pod))
return
}
err := pg.createNormalPodPGIfNotExist(pod)
if err != nil {
klog.Errorf("Failed to create PodGroup for pod <%s/%s>: %v", pod.Namespace, pod.Name, err)
Expand Down

0 comments on commit e1c17e9

Please sign in to comment.