-
Notifications
You must be signed in to change notification settings - Fork 972
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix pg controller create redundancy podGroup when schedulerName isn't matched #3672
Conversation
9a57bd6
to
31d5ca5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@@ -93,6 +94,10 @@ func (pg *pgcontroller) addReplicaSet(obj interface{}) { | |||
if podList != nil && len(podList.Items) > 0 { | |||
pod := podList.Items[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/%s field SchedulerName is not matched", pod.Namespace, pod.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change pod to upper case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we can use klog.Kobj
to print pod.namespace and pos.name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
… matched Signed-off-by: liuyuanchun <[email protected]>
31d5ca5
to
267defc
Compare
return | ||
} | ||
if podList != nil && len(podList.Items) > 0 { | ||
pod := podList.Items[0] | ||
klog.V(4).Infof("Try to create podgroup for pod %s/%s", pod.Namespace, pod.Name) | ||
klog.V(4).Infof("Try to create podgroup for pod %s", klog.KObj(&pod)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
klog.KObj(pod)) is ok: )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value must be a pointer. pod:= podList.Items[0], pod is not a pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
err := pg.createNormalPodPGIfNotExist(&pod) | ||
if err != nil { | ||
klog.Errorf("Failed to create PodGroup for pod <%s/%s>: %v", pod.Namespace, pod.Name, err) | ||
klog.Errorf("Failed to create PodGroup for pod %s: %v", klog.KObj(&pod), err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same above.
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Monokaix The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
fix issue #3671
Check whether the value of pod.spec.schedulerName is matched before creating a podGroup.