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

keep existing PDB conditions when updating status #122056

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

dhenkel92
Copy link
Contributor

@dhenkel92 dhenkel92 commented Nov 27, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

When the disruption controller updates the PDB status, it removes all conditions from the new status object and then re-adds the sufficient pods condition. Unfortunately, this behavior removes conditions set by other controllers, leading to multiple consecutive updates. Therefore, this commit ensures that conditions are preserved during updates.

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fixed the disruption controller's PDB status synchronization to maintain all PDB conditions during an update.

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Nov 27, 2023
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.29 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.29.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Mon Nov 27 03:59:11 UTC 2023.

Copy link

linux-foundation-easycla bot commented Nov 27, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: dhenkel92 / name: Daniel Henkel (2e388dd)

@k8s-ci-robot k8s-ci-robot added cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 27, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @dhenkel92!

It looks like this is your first PR to kubernetes/kubernetes 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/kubernetes has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@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 Nov 27, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @dhenkel92. Thanks for your PR.

I'm waiting for a kubernetes 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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Nov 27, 2023
@k8s-ci-robot k8s-ci-robot added sig/apps Categorizes an issue or PR as relevant to SIG Apps. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. release-note-none Denotes a PR that doesn't merit a release note. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. release-note-none Denotes a PR that doesn't merit a release note. labels Nov 27, 2023
@atiratree
Copy link
Member

/ok-to-test
/assign

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 11, 2023
@dhenkel92
Copy link
Contributor Author

/retest

Copy link
Member

@atiratree atiratree left a comment

Choose a reason for hiding this comment

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

The concern seems valid, as in general 3rd party controllers should be able to assign their own conditions to objects.

@dhenkel92 out of curiosity, can I ask what is your use case and what kind of information are you tracking in the condition?

@@ -994,6 +994,7 @@ func (dc *DisruptionController) updatePdbStatus(ctx context.Context, pdb *policy
DisruptionsAllowed: disruptionsAllowed,
DisruptedPods: disruptedPods,
ObservedGeneration: pdb.Generation,
Conditions: append([]metav1.Condition{}, pdb.Status.Conditions...),
Copy link
Member

Choose a reason for hiding this comment

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

we can just assign the conditions from the copy, so we do not mutate the original pdb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's actually a pretty good idea, thank you! I tried to copy the array with the append.

ps.VerifyPdbStatus(t, pdbName, 0, 0, 3, 0, map[string]metav1.Time{})

actualPDB := ps.Get(pdbName)
condition := apimeta.FindStatusCondition(actualPDB.Status.Conditions, "ExistingTestCondition")
Copy link
Member

Choose a reason for hiding this comment

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

can we also test the length of the conditions?

@atiratree
Copy link
Member

atiratree commented Dec 13, 2023

/triage accepted
/priority important-longterm

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 13, 2023
@dhenkel92
Copy link
Contributor Author

can I ask what is your use case and what kind of information are you tracking in the condition?

Sure! We began developing a system to identify PDBs that are blocked for long periods. We did this because we found that many issues need user action. However, in our case, factors other than failing pods can also block a PDB, which complicates troubleshooting for our users. Therefore, we introduced an additional condition similar to SufficientPods. This condition comes with a message that gives hints to help users with debugging.

@atiratree
Copy link
Member

Interesting, thanks for sharing.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 16, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 3a6097129f071439a69ed2067ac31a9b6c3d6904

@dhenkel92
Copy link
Contributor Author

/assign @kow3ns @krmayankk

@dhenkel92
Copy link
Contributor Author

Hello @kow3ns @krmayankk, 👋
Would it be possible to get a review of this PR in the next weeks?

@atiratree
Copy link
Member

/assign @soltysh

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dhenkel92, soltysh

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 5, 2024
@k8s-ci-robot k8s-ci-robot merged commit 180c6bd into kubernetes:master Mar 5, 2024
14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.30 milestone Mar 5, 2024
@atiratree
Copy link
Member

@dhenkel92 would it help to backport this fix to older releases? Would you be interested in opening a cherry-pick PRs?

@dhenkel92
Copy link
Contributor Author

@dhenkel92 would it help to backport this fix to older releases? Would you be interested in opening a cherry-pick PRs?

Thank you for your help @atiratree
Yes, that would be great. I'll have a look how to do it and open the PR's.

@atiratree
Copy link
Member

@dhenkel92 thanks for opening these!

@dhenkel92
Copy link
Contributor Author

dhenkel92 commented Mar 7, 2024

@atiratree The tests for PRs on versions 1.26 and 1.27 were failing. Based on this document, I fixed them and force-pushed to the branch. I hope this was the right procedure.

k8s-ci-robot added a commit that referenced this pull request Mar 8, 2024
…22056-upstream-release-1.28

Automated cherry pick of #122056: keep existing PDB conditions when updating status
k8s-ci-robot added a commit that referenced this pull request Mar 8, 2024
…22056-upstream-release-1.29

Automated cherry pick of #122056: keep existing PDB conditions when updating status
k8s-ci-robot added a commit that referenced this pull request Mar 8, 2024
…22056-upstream-release-1.27

Automated cherry pick of #122056: keep existing PDB conditions when updating status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

6 participants