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

Support labelSelector in RemoveDuplicates #654

Closed
palmerabollo opened this issue Nov 10, 2021 · 26 comments
Closed

Support labelSelector in RemoveDuplicates #654

palmerabollo opened this issue Nov 10, 2021 · 26 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@palmerabollo
Copy link

Is your feature request related to a problem? Please describe.

Some strategies such as RemovePodsViolatingInterPodAntiAffinity support a labelSelector parameter. However, RemoveDuplicates does not support it and comes in handy in some scenarios.

Describe the solution you'd like

I'd like to support labelSelector to define a RemoveDuplicates strategy such as:

    strategies:
      RemoveDuplicates:
        enabled: true
        params:
          labelSelector:
            matchExpressions:
              - key: foo
                operator: NotIn
                values:
                  - bar

What version of descheduler are you using?

descheduler version: 0.20 but the same applies to 0.22 afaik

Additional context

Thank you!

@palmerabollo palmerabollo added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 10, 2021
@damemi
Copy link
Contributor

damemi commented Nov 10, 2021

When we first implemented this it was brought up that there could be undesirable effects for some strategies, like removeduplicates (#510 (review)).

Thinking about it more now, I think RemoveDuplicates looks at such a specific calculation of "what is a duplicate" that label filtering shouldn't have too much of a problem. It is theoretically possible that 2 pods could have the same namespace/name/image but different labels, which is where this would cause issues (the strategy would not be evicting all the duplicates properly). Honestly, this chance seems low to me

@ingvagabund what do you think? I ask because you originally pointed this out

@palmerabollo
Copy link
Author

Thanks Mike.

I can elaborate on one the use case I have in mind, just in case it helps. I have a deployment labelled with app=myapp. It needs to run more pods than nodes in the cluster (in our case, 32 pods in a cluster with around 20 nodes). This is something that should work fine since 0.20. However, due to this bug #531 some pods are continuously destroyed when there are cordoned nodes in the cluster, that is something quite common. As a workaround, I would like to tell descheduler to ignore pods with label app=myapp in the RemoveDuplicates strategy.

In my opinion, there are some valid use cases where this is useful. Perhaps it could be supported with a note in the documentation explaining the corner case where using the labelSelector parameter is not safe.

@ingvagabund
Copy link
Contributor

Sounds good as long as the labelSelector is used in the eviction phase only.

@ingvagabund
Copy link
Contributor

As a workaround, I would like to tell descheduler to ignore pods with label app=myapp in the RemoveDuplicates strategy.

Ignore from consideration or from eviction?

@damemi
Copy link
Contributor

damemi commented Nov 11, 2021

As a workaround, I would like to tell descheduler to ignore pods with label app=myapp in the RemoveDuplicates strategy.

Ignore from consideration or from eviction?

I think in the case of RemoveDuplicates consideration and eviction are basically the same set. Like I mentioned above, there could technically be 2 pods that match the criteria for a duplicate but have different labels, but I think the chance of this is low gtiven the specificity

@palmerabollo
Copy link
Author

Thanks Jan, Mike.

I tried to implement it, see https://github.com/kubernetes-sigs/descheduler/compare/master...palmerabollo:label-filter?expand=1 but I'm not able to make the two new unit tests work.

I think I should add something here https://github.com/kubernetes-sigs/descheduler/compare/master...palmerabollo:label-filter?expand=1#diff-9589460dd68cfcc1a2a9ff1065a3d60852c6131d1489035bfdac10b8511e2ca0R96 but I'm having a hard time trying to figure it out since I'm not a golang dev (I've copypasted it from other strategies' code).

I think it might be an easy task for somebody more familiarized with the code. Any help is truly welcome.

@ingvagabund
Copy link
Contributor

some pods are continuously destroyed when there are cordoned nodes in the cluster, that is something quite common. As a workaround, I would like to tell descheduler to ignore pods with label app=myapp in the RemoveDuplicates strategy.

Going back to this. What's the relation of pods labeled with app=myapp to cordoned nodes?

@ingvagabund
Copy link
Contributor

I think in the case of RemoveDuplicates consideration and eviction are basically the same set. Like I mentioned above, there could technically be 2 pods that match the criteria for a duplicate but have different labels, but I think the chance of this is low gtiven the specificity

There's a hard assumption on the labels. The strategy targets a set of pods owned by the same controlling object (RC, RS, ...). In case a label selector is used (for any reason), you will left some pods out when the code responsible for forcing even distribution is calculating pods for eviction. If not taking the cordoned nodes into account when evicting pods in the strategy is the issue we need to fix that. Instead of making the strategy blind.

@k8s-triage-robot
Copy link

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

This bot triages issues and 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 issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please 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 Feb 14, 2022
@ingvagabund
Copy link
Contributor

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 14, 2022
@k8s-triage-robot
Copy link

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

This bot triages issues and 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 issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please 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 May 15, 2022
@damemi
Copy link
Contributor

damemi commented May 16, 2022

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 16, 2022
@k8s-triage-robot
Copy link

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

This bot triages issues and 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 issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please 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 Aug 14, 2022
@k8s-triage-robot
Copy link

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

This bot triages issues and 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 issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

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

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Sep 13, 2022
@palmerabollo
Copy link
Author

/remove-lifecycle stale

@k8s-triage-robot
Copy link

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

This bot triages issues 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 issue is closed

You can:

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

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

/close not-planned

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

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

This bot triages issues 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 issue is closed

You can:

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

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

/close not-planned

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 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2022
@aslafy-z
Copy link
Contributor

@palmerabollo can you please
/reopen
and
/remove-lifecycle rotten
?

@k8s-ci-robot
Copy link
Contributor

@aslafy-z: You can't reopen an issue/PR unless you authored it or you are a collaborator.

In response to this:

@palmerabollo can you please
/reopen
and
/remove-lifecycle rotten
?

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 removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Oct 13, 2022
@palmerabollo
Copy link
Author

/reopen

@k8s-ci-robot k8s-ci-robot reopened this Dec 14, 2022
@k8s-ci-robot
Copy link
Contributor

@palmerabollo: Reopened this issue.

In response to this:

/reopen

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-triage-robot
Copy link

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

This bot triages un-triaged issues 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 issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please 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 Mar 14, 2023
@k8s-triage-robot
Copy link

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

This bot triages un-triaged issues 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 issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

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

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Apr 13, 2023
@aslafy-z
Copy link
Contributor

Not stale

@ingvagabund ingvagabund removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Apr 14, 2023
@damemi
Copy link
Contributor

damemi commented Apr 25, 2023

This will be available as a DefaultEvictor config in the v1alpha2 config api release, so we should be able to close this (#929, #955)
/close

@k8s-ci-robot
Copy link
Contributor

@damemi: Closing this issue.

In response to this:

This will be available as a DefaultEvictor config in the v1alpha2 config api release, so we should be able to close this (#929, #955)
/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
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests

6 participants