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

Add conditions to PDB status #98127

Merged
merged 2 commits into from Mar 5, 2021

Conversation

mortent
Copy link
Member

@mortent mortent commented Jan 17, 2021

What type of PR is this?
/kind feature
/kind api-change

What this PR does / why we need it:
This adds a conditions field to the PDB status object and updates the disruption controller to use the DisruptionAllowed condition. This provides information that to some extent is already available through the status.DisruptionsAllowed field, but with this condition we can also communicate the reason why the value of status.DisruptionsAllowed are set to 0. This can be either because not enough pods are available, or because the disruption controller experienced an error.

This addresses one of the issues described in the PDB to GA KEP: kubernetes/enhancements#2114

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

PodDisruptionBudget API objects can now contain conditions in status.

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

@kubernetes/sig-apps-pr-reviews

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API cncf-cla: yes Indicates the PR's author has 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. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Jan 17, 2021
@mortent
Copy link
Member Author

mortent commented Jan 17, 2021

/test pull-kubernetes-e2e-kind

@mortent mortent changed the title Add conditions to pd bs Add conditions to PDB status Jan 18, 2021
@fejta-bot
Copy link

This PR may require API review.

If so, when the changes are ready, complete the pre-review checklist and request an API review.

Status of requested reviews is tracked in the API Review project.

@mortent
Copy link
Member Author

mortent commented Jan 31, 2021

/assign @smarterclayton

@liggitt liggitt added this to the v1.21 milestone Feb 18, 2021
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.

/lgtm
/approve
/triage accepted
/priority backlog
/label api-review

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. priority/backlog Higher priority than priority/awaiting-more-evidence. api-review Categorizes an issue or PR as actively needing an API review. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 22, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 22, 2021
@liggitt liggitt added this to In progress in API Reviews Feb 23, 2021
Copy link
Member

@liggitt liggitt left a comment

Choose a reason for hiding this comment

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

EvictionREST#checkAndDecrement updates PDB status... should it set this condition as well?

pkg/controller/disruption/disruption_test.go Outdated Show resolved Hide resolved
staging/src/k8s.io/api/policy/v1beta1/types.go Outdated Show resolved Hide resolved
pkg/controller/disruption/disruption.go Outdated Show resolved Hide resolved
pkg/controller/disruption/disruption.go Outdated Show resolved Hide resolved
pkg/apis/policy/validation/validation.go Outdated Show resolved Hide resolved
pkg/apis/policy/validation/validation.go Outdated Show resolved Hide resolved
pkg/apis/policy/validation/validation.go Show resolved Hide resolved
pkg/registry/policy/poddisruptionbudget/strategy.go Outdated Show resolved Hide resolved
pkg/registry/policy/poddisruptionbudget/strategy.go Outdated Show resolved Hide resolved
@liggitt liggitt moved this from In progress to Changes requested in API Reviews Mar 3, 2021
@mortent mortent force-pushed the AddConditionsToPDBs branch 2 times, most recently from 4a35573 to d720be4 Compare March 4, 2021 05:46
@k8s-ci-robot k8s-ci-robot added area/apiserver area/cloudprovider area/dependency Issues or PRs related to dependency changes area/kubectl sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. labels Mar 4, 2021
staging/src/k8s.io/api/policy/v1beta1/types.go Outdated Show resolved Hide resolved
staging/src/k8s.io/api/policy/v1beta1/types.go Outdated Show resolved Hide resolved
staging/src/k8s.io/api/policy/v1beta1/types.go Outdated Show resolved Hide resolved
staging/src/k8s.io/api/policy/v1beta1/types.go Outdated Show resolved Hide resolved
staging/src/k8s.io/api/policy/v1beta1/types.go Outdated Show resolved Hide resolved
pkg/apis/policy/validation/validation.go Outdated Show resolved Hide resolved
pkg/registry/policy/poddisruptionbudget/strategy.go Outdated Show resolved Hide resolved
@@ -777,9 +780,21 @@ func (dc *DisruptionController) buildDisruptedPodMap(pods []*v1.Pod, pdb *policy
// implement the "fail open" part of the design since if we manage to update
// this field correctly, we will prevent the /evict handler from approving an
// eviction when it may be unsafe to do so.
func (dc *DisruptionController) failSafe(pdb *policy.PodDisruptionBudget) error {
func (dc *DisruptionController) failSafe(pdb *policy.PodDisruptionBudget, err error) error {
Copy link
Member

Choose a reason for hiding this comment

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

addressing this in a separate PR sounds good to me. I don't think this change makes the issue worse, and gives us a potential tool to address the issue in a follow up

pkg/registry/core/pod/storage/eviction.go Outdated Show resolved Hide resolved
@mortent mortent force-pushed the AddConditionsToPDBs branch 2 times, most recently from 1ec6719 to b01d20d Compare March 4, 2021 20:30
@mortent
Copy link
Member Author

mortent commented Mar 4, 2021

/test pull-kubernetes-unit

@mortent
Copy link
Member Author

mortent commented Mar 4, 2021

@liggitt I have addressed the comments.

@mortent
Copy link
Member Author

mortent commented Mar 4, 2021

/test pull-kubernetes-e2e-gce-ubuntu-containerd

@liggitt liggitt moved this from Changes requested to In progress in API Reviews Mar 5, 2021
@liggitt
Copy link
Member

liggitt commented Mar 5, 2021

/lgtm
/approve

@liggitt liggitt moved this from In progress to API review completed, 1.21 in API Reviews Mar 5, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 5, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, mortent, 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, 2021
@k8s-ci-robot k8s-ci-robot merged commit 7a49140 into kubernetes:master Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review Categorizes an issue or PR as actively needing an API review. approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/cloudprovider area/dependency Issues or PRs related to dependency changes area/kubectl cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/backlog Higher priority than priority/awaiting-more-evidence. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/apps Categorizes an issue or PR as relevant to SIG Apps. sig/auth Categorizes an issue or PR as relevant to SIG Auth. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
Status: API review completed, 1.21
Development

Successfully merging this pull request may close these issues.

None yet

7 participants