Skip to content

Conversation

Park-Jiyeonn
Copy link
Contributor

@Park-Jiyeonn Park-Jiyeonn commented Jun 16, 2025

What type of PR is this?
/kind bug

What this PR does / why we need it:
Fixes an issue where Pod status is not synced correctly when using a kwok-based cluster as the simulator target. This PR ensures that the /status subresource is patched during Pod sync, including terminal phases like Succeeded and Failed.

Which issue(s) this PR fixes:
Fixes #429

Special notes for your reviewer:
/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. labels Jun 16, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Park-Jiyeonn
Once this PR has been reviewed and has the lgtm label, please assign 196ikuchil for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 16, 2025
@k8s-ci-robot k8s-ci-robot requested a review from 196Ikuchil June 16, 2025 02:33
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 16, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @Park-Jiyeonn. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 16, 2025
Copy link
Member

@sanposhiho sanposhiho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test
/cc @saza-ku @ordovicia @utam0k

@k8s-ci-robot k8s-ci-robot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 16, 2025
@k8s-ci-robot k8s-ci-robot requested a review from utam0k June 16, 2025 19:51
@k8s-ci-robot k8s-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 16, 2025
@k8s-ci-robot
Copy link
Contributor

@sanposhiho: GitHub didn't allow me to request PR reviews from the following users: saza-ku, ordovicia.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/ok-to-test
/cc @saza-ku @ordovicia @utam0k

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-sigs/prow repository.

@saza-ku
Copy link
Contributor

saza-ku commented Jun 20, 2025

Sorry for being late. I'll review your PRs this weekend.

Comment on lines +90 to +110
func (s *Service) updateFunc(oldObj, newObj interface{}) {
ctx := context.Background()
unstructObj, ok := newObj.(*unstructured.Unstructured)
newUnstructuredObj, ok := newObj.(*unstructured.Unstructured)
if !ok {
klog.Error("Failed to convert runtime.Object to *unstructured.Unstructured")
return
}

err := s.resourceApplierService.Update(ctx, unstructObj)
oldUnstructuredObj, ok := oldObj.(*unstructured.Unstructured)
if !ok {
klog.Error("Failed to convert runtime.Object to *unstructured.Unstructured")
return
}

if newUnstructuredObj.GetKind() == "Pod" && !podStatusEqual(oldUnstructuredObj, newUnstructuredObj) {
if patchErr := s.resourceApplierService.PatchPodStatus(ctx, newUnstructuredObj); patchErr != nil {
klog.Errorf("Failed to patch pod status: %v", patchErr)
}
}

err := s.resourceApplierService.Update(ctx, newUnstructuredObj)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic of applying resource of real clusters is encapsulated in resourceapplier.
And this fix should also be applied to oneshotimporter and recorder.
So we should confine this fix to resourceapplier.
We could use defer to bypass the filters in updateFunc.

Copy link
Contributor Author

@Park-Jiyeonn Park-Jiyeonn Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it's good suggestion. Let me make some modifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pod status not synced in kwok-based cluster
4 participants