Skip to content

fix: Do not create PodDisruptionBudget for single replica topology mode#1707

Merged
kubevirt-bot merged 1 commit intokubevirt:mainfrom
akrejcir:dont-deploy-pdb-on-sno
Mar 16, 2026
Merged

fix: Do not create PodDisruptionBudget for single replica topology mode#1707
kubevirt-bot merged 1 commit intokubevirt:mainfrom
akrejcir:dont-deploy-pdb-on-sno

Conversation

@akrejcir
Copy link
Copy Markdown
Collaborator

@akrejcir akrejcir commented Mar 13, 2026

What this PR does / why we need it:
The PodDisruptionBudget is not useful in single replica topology mode. It would have spec.minAvailable set to 1, but there would always be one pod. It would cause a warning to be shown:

`The pod disruption budget is at the minimum disruptions allowed level. The number of current healthy pods is equal to the desired healthy pods."

Which issue(s) this PR fixes:
Jira: https://issues.redhat.com/browse/CNV-71871

Release note:

None

@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Mar 13, 2026
Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new single-node PDB test uses MatchError(errors.IsNotFound, "errors.IsNotFound"), but errors.IsNotFound returns a bool, not an error; consider asserting with Expect(apierrors.IsNotFound(err)).To(BeTrue()) or using MatchError with the actual error or its string instead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new single-node PDB test uses `MatchError(errors.IsNotFound, "errors.IsNotFound")`, but `errors.IsNotFound` returns a bool, not an error; consider asserting with `Expect(apierrors.IsNotFound(err)).To(BeTrue())` or using `MatchError` with the actual error or its string instead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@akrejcir
Copy link
Copy Markdown
Collaborator Author

/cc @0xFelix @jcanocan

@jcanocan
Copy link
Copy Markdown
Contributor

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2026
Copy link
Copy Markdown
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

In general I approve of this change, but the wording is a bit off. It is possible to have multiple replicas, even on a single node. This should say that it does not create PDBs for single replicas / when in single replica mode.

@akrejcir akrejcir force-pushed the dont-deploy-pdb-on-sno branch from b881488 to a207e7c Compare March 16, 2026 10:02
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2026
@akrejcir akrejcir changed the title fix: Do not create PodDisruptionBudget for single node cluster fix: Do not create PodDisruptionBudget for single replica topology mode Mar 16, 2026
@akrejcir
Copy link
Copy Markdown
Collaborator Author

Good point. I've updated the commit message and PR description.

Copy link
Copy Markdown
Member

@0xFelix 0xFelix left a comment

Choose a reason for hiding this comment

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

/approve

}
})

It("should not create PodDisruptionBudget on single node clusters", func() {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: single replica mode

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

@kubevirt-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 0xFelix

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

The pull request process is described here

Details 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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 16, 2026
The PodDisruptionBudget does not make sense in single replica topology
mode. It would have "spec.minAvailable" set to 1, but there would always
be one pod. It would cause a warning to be always present:

"The pod disruption budget is at the minimum disruptions allowed level.
The number of current healthy pods is equal to the desired healthy
pods."

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Andrej Krejcir <akrejcir@redhat.com>
@akrejcir akrejcir force-pushed the dont-deploy-pdb-on-sno branch from a207e7c to a63407f Compare March 16, 2026 15:06
@sonarqubecloud
Copy link
Copy Markdown

@ksimon1
Copy link
Copy Markdown
Member

ksimon1 commented Mar 16, 2026

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2026
@kubevirt-bot kubevirt-bot merged commit 209e1d9 into kubevirt:main Mar 16, 2026
13 checks passed
@akrejcir akrejcir deleted the dont-deploy-pdb-on-sno branch March 17, 2026 15:03
@akrejcir
Copy link
Copy Markdown
Collaborator Author

/cherry-pick release-v0.25
/cherry-pick release-v0.24

@kubevirt-bot
Copy link
Copy Markdown
Contributor

@akrejcir: new pull request created: #1714

Details

In response to this:

/cherry-pick release-v0.25
/cherry-pick release-v0.24

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.

@kubevirt-bot
Copy link
Copy Markdown
Contributor

@akrejcir: new pull request created: #1715

Details

In response to this:

/cherry-pick release-v0.25
/cherry-pick release-v0.24

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.

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants