Skip to content
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(controller/ui): fix pod with sidecar state #19843

Merged
merged 5 commits into from
Oct 15, 2024

Conversation

linghaoSu
Copy link
Contributor

@linghaoSu linghaoSu commented Sep 9, 2024

Fixes #18725

Before:

image
image

After

image
image

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Copy link

bunnyshell bot commented Sep 9, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

bunnyshell bot commented Sep 9, 2024

❌ Preview Environment deleted from Bunnyshell

Available commands (reply to this comment):

  • 🚀 /bns:deploy to deploy the environment

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 96.66667% with 1 line in your changes missing coverage. Please review.

Please upload report for BASE (master@cf498f6). Learn more about missing BASE report.
Report is 16 commits behind head on master.

Files with missing lines Patch % Lines
controller/cache/info.go 96.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #19843   +/-   ##
=========================================
  Coverage          ?   56.04%           
=========================================
  Files             ?      322           
  Lines             ?    44768           
  Branches          ?        0           
=========================================
  Hits              ?    25088           
  Misses            ?    17081           
  Partials          ?     2599           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@alexef
Copy link
Member

alexef commented Oct 7, 2024

@linghaoSu why is this still a draft? anything missing?

@alexef
Copy link
Member

alexef commented Oct 7, 2024

I assume you also want to test in https://github.com/argoproj/argo-cd/blob/1e359c8c0d25dc3a223ab184c1d623bb4d68aa5a/controller/cache/info_test.go? Let me know if you have time to continue with this PR, otherwise I can also try to take over.

We really need this fix to land.

@linghaoSu
Copy link
Contributor Author

@alexef Sorry for the delay. I'll try to get it done this week.

My fix pr in the dashboard is closed, so I'll refer to the merged fixes for this one.

@linghaoSu
Copy link
Contributor Author

linghaoSu commented Oct 8, 2024

Hi @alexef, I believe this PR is ready for review. Could you please take a look?

References the dashboard pr: https://github.com/kubernetes/dashboard/pull/9483/files#diff-207a2dad9e596869b3612d332964328e081f20fb9cbeb6f9bbb41dfa13472152R39-R124

@linghaoSu linghaoSu marked this pull request as ready for review October 8, 2024 13:55
@linghaoSu linghaoSu requested a review from a team as a code owner October 8, 2024 13:55
@linghaoSu linghaoSu force-pushed the fix/sidecar-state branch 2 times, most recently from eefd2ce to b08fc2e Compare October 9, 2024 01:40
controller/cache/info.go Outdated Show resolved Hide resolved
controller/cache/info.go Outdated Show resolved Hide resolved
Copy link
Member

@alexef alexef left a comment

Choose a reason for hiding this comment

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

couple of questions

@linghaoSu
Copy link
Contributor Author

I included restartable initContainers in the total container calculation, following the approach used in kubectl.

https://github.com/kubernetes/kubernetes/blob/f7fef0384ec1c666e6b68cae83a3b3c6d95aa7b0/pkg/printers/internalversion/printers.go#L887-L892

@alexef If it's convenient, could you please review it again?

Copy link
Member

@alexef alexef left a comment

Choose a reason for hiding this comment

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

great. now we only need an approver :)

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
…play

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
@linghaoSu
Copy link
Contributor Author

Hi @crenshaw-dev,

I believe this PR is ready for review. Could you please take a look? This issue has 16 thumbs up, so it might be helpful to address it.

If you spot any potential issues with this PR, please let me know, and I'll be happy to work on fixing them.

Thanks!

@crenshaw-dev crenshaw-dev changed the title fix(controller): fix pod with sidercar state fix(controller): fix pod with sidecar state Oct 12, 2024
@crenshaw-dev crenshaw-dev changed the title fix(controller): fix pod with sidecar state fix(controller/ui): fix pod with sidecar state Oct 12, 2024
Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Just a few nitpicks and requests for code coverage.

controller/cache/info.go Outdated Show resolved Hide resolved
controller/cache/info_test.go Outdated Show resolved Hide resolved
controller/cache/info_test.go Outdated Show resolved Hide resolved
controller/cache/info_test.go Outdated Show resolved Hide resolved
controller/cache/info.go Show resolved Hide resolved
controller/cache/info.go Show resolved Hide resolved
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Linghao Su <slh001@live.cn>
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: linghaoSu <linghao.su@daocloud.io>
@linghaoSu
Copy link
Contributor Author

Hi @crenshaw-dev,

Thank you for your suggestions! I believe I've addressed all the comments. Could you please take another look?

@crenshaw-dev
Copy link
Member

Looking good! Bear with me a bit, I want to scope-creep this PR a bit to solve some problems with the UI code:

image

Notice the Init: 1) message. I think we can fix that pretty easily. I'll open a PR against yours.

@crenshaw-dev
Copy link
Member

linghaoSu#1

Copy link
Member

@crenshaw-dev crenshaw-dev left a comment

Choose a reason for hiding this comment

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

This LGTM, will follow up with the UI fix. Thanks!

@crenshaw-dev crenshaw-dev merged commit e80de49 into argoproj:master Oct 15, 2024
27 checks passed
@crenshaw-dev
Copy link
Member

/cherry-pick release-2.13

Copy link

Cherry-pick failed with Merge error e80de49043f3ba0d876bc30f6aab789e8f8d413f into temp-cherry-pick-529385-release-2.13

@crenshaw-dev
Copy link
Member

@linghaoSu would you mind opening cherry-picks for 2.10-2.13?

linghaoSu added a commit to linghaoSu/argo-cd that referenced this pull request Oct 16, 2024
* fix(controller): change pod status calculate with sidecar

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): add restartable sidecar count in total container display

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): update info test case conditions

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Linghao Su <slh001@live.cn>

* fix(controller): add more test case to cover more conditions

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(ui): check is condition exist before for of

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
linghaoSu added a commit to linghaoSu/argo-cd that referenced this pull request Oct 16, 2024
* fix(controller): change pod status calculate with sidecar

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): add restartable sidecar count in total container display

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): update info test case conditions

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Linghao Su <slh001@live.cn>

* fix(controller): add more test case to cover more conditions

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(ui): check is condition exist before for of

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
linghaoSu added a commit to linghaoSu/argo-cd that referenced this pull request Oct 16, 2024
* fix(controller): change pod status calculate with sidecar

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): add restartable sidecar count in total container display

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): update info test case conditions

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Linghao Su <slh001@live.cn>

* fix(controller): add more test case to cover more conditions

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(ui): check is condition exist before for of

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
linghaoSu added a commit to linghaoSu/argo-cd that referenced this pull request Oct 16, 2024
* fix(controller): change pod status calculate with sidecar

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): add restartable sidecar count in total container display

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): update info test case conditions

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Linghao Su <slh001@live.cn>

* fix(controller): add more test case to cover more conditions

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(ui): check is condition exist before for of

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
@linghaoSu
Copy link
Contributor Author

Hi @crenshaw-dev,

I've manually cherry-picked this fix to 2.10-2.13. Could you please take a look at those PRs?

austin5219 pushed a commit to austin5219/argo-cd that referenced this pull request Oct 16, 2024
* fix(controller): change pod status calculate with sidecar

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): add restartable sidecar count in total container display

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(controller): update info test case conditions

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Linghao Su <slh001@live.cn>

* fix(controller): add more test case to cover more conditions

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

* fix(ui): check is condition exist before for of

Signed-off-by: linghaoSu <linghao.su@daocloud.io>

---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: austin5219 <3936059+austin5219@users.noreply.github.com>
@linghaoSu
Copy link
Contributor Author

@crenshaw-dev , However in 2.10 and 2.11, RestartPolicy is not a valid field in InitContainer, so this would cause a lint error. Perhaps we shouldn't cherry-pick this fix to those two releases.

image

crenshaw-dev added a commit that referenced this pull request Oct 16, 2024
* fix(controller): change pod status calculate with sidecar



* fix(controller): add restartable sidecar count in total container display



* fix(controller): update info test case conditions




* fix(controller): add more test case to cover more conditions



* fix(ui): check is condition exist before for of



---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
crenshaw-dev added a commit that referenced this pull request Oct 17, 2024
* fix(controller): change pod status calculate with sidecar



* fix(controller): add restartable sidecar count in total container display



* fix(controller): update info test case conditions




* fix(controller): add more test case to cover more conditions



* fix(ui): check is condition exist before for of



---------

Signed-off-by: linghaoSu <linghao.su@daocloud.io>
Signed-off-by: Linghao Su <slh001@live.cn>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Containers in pods with native sidecars don't show as "ready"
3 participants