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 DaemonSet support in PDB #98307

Closed
wants to merge 3 commits into from
Closed

Conversation

shvgn
Copy link

@shvgn shvgn commented Jan 22, 2021

What type of PR is this?

/kind fix
/sig apps

What this PR does / why we need it:

Supports DaemonSets in disruption controller by adding /scale subresource to daemonsets API. It allows to control the eviction rate of DaemonSet pods.

Which issue(s) this PR fixes:

#108124

Does this PR introduce a user-facing change?:

Added /scale  subresource to DaemonSet API to support of PodDisruptionBudget for DaemonSet pods.

@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. 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. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 22, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @shvgn!

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 needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jan 22, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @shvgn. 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 sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jan 22, 2021
@leilajal
Copy link
Contributor

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jan 26, 2021
@smarterclayton
Copy link
Contributor

Is there a KEP connecting to this?

@@ -174,14 +182,15 @@ func NewDisruptionController(
// resources directly and only fall back to the scale subresource when needed.
func (dc *DisruptionController) finders() []podControllerFinder {
return []podControllerFinder{dc.getPodReplicationController, dc.getPodDeployment, dc.getPodReplicaSet,
dc.getPodStatefulSet, dc.getScaleController}
dc.getPodStatefulSet, dc.getPodDaemonSet, dc.getScaleController}
Copy link
Contributor

Choose a reason for hiding this comment

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

I admit I'm surprised we have added this method in general. Where is the fallback logic to use scale for this case? getExpectedScale() doesn't implement a generic fallback, so that means this logic is not extensible and that's not great. If there is a generic fallback, that would imply this is an optimization only (in which case, I would have expected the bug report to be "controller lookups for daemonsets are slow and this improves performance", which doesn't match what you are reporting).

Copy link
Contributor

Choose a reason for hiding this comment

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

Is the generic lookup dc.getScaleController? Is Scale not implemented for DaemonSets?

Copy link

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh.

Oh....

Copy link
Contributor

Choose a reason for hiding this comment

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

Hrm. That's really ugly. It should support read scale but not write scale, or reject write scale.

@mortent
Copy link
Member

mortent commented Feb 4, 2021

/ok-to-test
How will this interact with the eviction api, in particular the kubectl drain command that has a --ignore-daemonsets flag?

This should probably have a KEP. kubernetes/enhancements#963 is the KEP for adding support for the scale subresource in PDBs

@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 Feb 4, 2021
@shvgn
Copy link
Author

shvgn commented Feb 8, 2021

@mortent @smarterclayton Thank you for your feedback. There is no KEP for this by now, I'll add one. And I'll look into implementing the scale subresource for DS.

How will this interact with the eviction api, in particular the kubectl drain command that has a --ignore-daemonsets flag?

PDB's status.disruptionsAllowed calculates correctly that leads to the desired eviction behavior.

The --ignore-daemonsets flag on draining leaves DS pods untouched, and PDB's 'status.disruptionsAllowed' does not change. From the perspective of DS pods and its PDB, nothing changes.

@michaelgugino
Copy link
Contributor

I have a drain patch that went rotten for draining daemonsets here: #88345

I can revive if necessary if we decide to support this DaemonSet option in PDBs. Right now, 'drain' is really the only (I might be making this up) client that supports the eviction API, so we'd want to get in my change or a similar one.

@liggitt liggitt added this to Triage in PodDisruptionBudget Apr 1, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 6, 2021
@shvgn shvgn marked this pull request as draft April 11, 2021 09:28
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 11, 2021
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 10, 2021
@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jul 19, 2021
@atiratree
Copy link
Member

@mhmxs regarding your testing in #98307 (comment), I think you might be running into an #116552 issue, which I am trying to fix in #116554

@atiratree
Copy link
Member

@shvgn are you planning to continue with this PR?

@nabokihms
Copy link
Member

@atiratree hello there! I will continue communication here since @shvgn is unavailable (busy with other important tasks).

We in Flant used this patch to prevent unexpected evictions and we are still willing to contribute. I will try to check the code and answer all your questions.

@mhmxs
Copy link
Contributor

mhmxs commented Mar 14, 2023

@mhmxs regarding your testing in #98307 (comment), I think you might be running into an #116552 issue, which I am trying to fix in #116554

Thanks, i would retest after the rebase.

@ibihim
Copy link
Contributor

ibihim commented Apr 24, 2023

/remove-sig auth

@k8s-ci-robot k8s-ci-robot removed the sig/auth Categorizes an issue or PR as relevant to SIG Auth. label Apr 24, 2023
@liggitt liggitt removed their assignment May 13, 2023
@atiratree
Copy link
Member

@nabokihms @shvgn do you have the capacity to look into this for 1.28?

@shvgn
Copy link
Author

shvgn commented Jun 26, 2023

@atiratree Unfortunately, I won't be able to work on this PR in upcoming weeks.

@neolit123
Copy link
Member

/remove-area kubeadm
/remove-sig cluster-lifecycle

@k8s-ci-robot k8s-ci-robot removed area/kubeadm sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. labels Jul 17, 2023
@rexagod
Copy link
Member

rexagod commented Aug 4, 2023

/remove-sig instrumentation

@k8s-ci-robot k8s-ci-robot removed the sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. label Aug 4, 2023
@sftim
Copy link
Contributor

sftim commented Aug 16, 2023

I don't understand what a scale subresource means for a DaemonSet. What I think it'd mean is that setting scale to 2 means I want two copies on each selected node.

@shvgn, you'd really need a KEP to make this proposal land.

@nabokihms
Copy link
Member

@sftim, there was a KEP, but after that, we agreed that this is more a bug than a feature, so KEP is not required. I personally agree with you that a KEP will make things way more transparent for all parties.

Can we rediscuss it once again?
@mortent @smarterclayton wdyt?

@liggitt
Copy link
Member

liggitt commented Aug 17, 2023

@sftim, there was a KEP, but after that, we agreed that this is more a bug than a feature, so KEP is not required.

I don't see how absence of a scale subresource for daemonset is a bug... this definitely seems like a feature, and one which (in my opinion) needs more evidence / understanding / design before being accepted or implemented

@nabokihms
Copy link
Member

@liggitt the initial attempt to write a KEP was here kubernetes/enhancements#3089, but per comment was closed. Should a new KEP for a scale subresource be introduced? Should we discuss offered solution once more (and probably reconsider it)?

@liggitt
Copy link
Member

liggitt commented Aug 17, 2023

If we want to narrowly make PDB work specifically with daemonset pods and consider it not interoperating with daemonset pods a bug, that's one thing.

If we want to fix that issue by adding a scale subresource to DaemonSet, I think that needs a KEP, since it has implications way beyond PDB.

@nabokihms
Copy link
Member

As @sftim mentioned, the whole idea seems odd, like how can we scale pods for the controller that suppose to run pods on every node? However, ignoring PDB is another odd thing because PDB is not about scaling (despite being connected to a scale subresource in other controllers' implementation).

My intention is only to fix PDB, not invent a whole new conception of daemonset scaling.

@liggitt
Copy link
Member

liggitt commented Aug 17, 2023

so maybe that means teaching the disruption controller about daemonsets specifically in

// The workload resources do implement the scale subresource, so it would
// be possible to only check the scale subresource here. But since there is no
// way to take advantage of listers with scale subresources, we use the workload
// resources directly and only fall back to the scale subresource when needed.
func (dc *DisruptionController) finders() []podControllerFinder {
return []podControllerFinder{dc.getPodReplicationController, dc.getPodDeployment, dc.getPodReplicaSet,
dc.getPodStatefulSet, dc.getScaleController}
}
var (
controllerKindRS = v1beta1.SchemeGroupVersion.WithKind("ReplicaSet")
controllerKindSS = apps.SchemeGroupVersion.WithKind("StatefulSet")
controllerKindRC = v1.SchemeGroupVersion.WithKind("ReplicationController")
controllerKindDep = v1beta1.SchemeGroupVersion.WithKind("Deployment")
)
(like it already knows about replicasets, etc, specifically)

@atiratree
Copy link
Member

As @sftim mentioned, the whole idea seems odd, like how can we scale pods for the controller that suppose to run pods on every node? However, ignoring PDB is another odd thing because PDB is not about scaling (despite being connected to a scale subresource in other controllers' implementation).

I just want to emphasise, that this is about adding a read only scale subresource, so we would not have to solve scaling of the DS in any sense.

But since adding only part of the scale API could have implications for other users, adding the DS finder seems like a simpler/easier thing to do in the short term.

@mhmxs
Copy link
Contributor

mhmxs commented Aug 22, 2023

the whole idea seems odd

@nabokihms our usecase is a bit different. We need this feature to prevent deleting nodes. If PDB maxUnavailable is 1 and any of the daemonsets is not ready (they are watchdogs exactly) we can block upgrade or many other node related operations. Because Kube control plane is not able to delete any of the daemonset pods.

Currently, this is not available, and we need an extra controller to update minAvailable to #nodes-1 all the time when a node changes.

@dims dims removed the area/dependency Issues or PRs related to dependency changes label Jan 4, 2024
@knelasevero
Copy link
Contributor

knelasevero commented Jan 12, 2024

Hey, @shvgn do you plan to get back to this PR? If not I can take over and go with the teaching the disruption controller about daemonsets specifically approach. (I'm working on it)

@dims dims added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Mar 5, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

SIG Node PR Triage automation moved this from WIP to Done Apr 4, 2024
@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiserver area/cloudprovider area/code-generation area/ipvs area/kubectl area/kubelet area/provider/gcp Issues or PRs related to gcp provider area/release-eng Issues or PRs related to the Release Engineering subproject area/test cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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/autoscaling Categorizes an issue or PR as relevant to SIG Autoscaling. 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/contributor-experience Categorizes an issue or PR as relevant to SIG Contributor Experience. sig/network Categorizes an issue or PR as relevant to SIG Network. sig/node Categorizes an issue or PR as relevant to SIG Node. sig/release Categorizes an issue or PR as relevant to SIG Release. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. sig/scheduling Categorizes an issue or PR as relevant to SIG Scheduling. sig/security Categorizes an issue or PR as relevant to SIG Security. sig/storage Categorizes an issue or PR as relevant to SIG Storage. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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
Archived in project
Archived in project
Archived in project
Archived in project
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet