-
Notifications
You must be signed in to change notification settings - Fork 971
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 podgroup not created #3561
Fix podgroup not created #3561
Conversation
Welcome @liuyuanchun11! |
Is there a scenario that can be reproduced? |
There is a high probability that this issue occurs when multiple deployments are upgraded in rolling mode. The key point is that the add pod event is received before the replicaset event. |
err := pg.vcClient.SchedulingV1beta1().PodGroups(rs.Namespace).Delete(context.TODO(), pgName, metav1.DeleteOptions{}) | ||
if err != nil && !apierrors.IsNotFound(err) { | ||
klog.Errorf("Failed to delete PodGroup <%s/%s>: %v", rs.Namespace, pgName, err) | ||
} | ||
} else if *rs.Spec.Replicas > 0 { |
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.
else is no need and we should add a comment to explain why this is added.
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.
Sorry, I don't understand what you mean by else is not needed. Are you saying that the webhook already guarantees that replicas are unsigned, so there's no need to write a > 0 check?
The comment I'll add later.
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.
Sorry for misunderstanding, I mean we can use if *rs.Spec.Replicas > 0
directly and no need to use else if
.
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.
Modified based on review comments.
if podList != nil { | ||
for _, pod := range podList.Items { | ||
klog.V(4).Infof("Try to create podgroup for pod %s/%s", pod.Namespace, pod.Name) | ||
err := pg.createNormalPodPGIfNotExist(&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.
How about just check whether rs associated pg exists first, only create pg when it doesn't exist to avoid unnecessary API request, cause it's a rare case here.
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.
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.
@liuyuanchun11 please log a issue and add the description for the bug and associate the pr with issue. |
cc4c00f
to
6e25fc5
Compare
done, pr has been associated with issue #3563 |
93384c0
to
df27590
Compare
/reopen |
@liuyuanchun11: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: liuyuanchun <[email protected]>
05c04ba
to
7c9bd38
Compare
/lgtm |
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: william-wang 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 |
During the rolling upgrade of replicaset, pg_controller occasionally receives the addPod event and creates a podgroup. Then, pg_controller receives the addReplicaSet (replicas = 0) event and deletes the corresponding podgroup (to solve the pg fc problem). The updateReplicaSet (replicas = 1) event is received but not processed. As a result, the pod group corresponding to the pod is not correctly created.
issue: #3563