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

tolerations.AreEqual() does not take default value into account #55719

Closed
phsiao opened this Issue Nov 14, 2017 · 5 comments

Comments

Projects
None yet
5 participants
@phsiao
Contributor

phsiao commented Nov 14, 2017

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug
/sig api-machinery

What happened:

When using scheduler.alpha.kubernetes.io/defaultTolerations, if "Operator" is missing tolerators.AreEqual() returns false even if the pod spec tolerations matches but with an explicit operator Equal.

What you expected to happen:

"Operator" is default to Equal, and I would expect AreEqual() returns true if Operator is missing because it defaults to be Equal.

How to reproduce it (as minimally and precisely as possible):

With PodTolerationRestriction admission controller enabled, set annotation

scheduler.alpha.kubernetes.io/defaultTolerations: '[{"key":"tkey",value":"tvalue","effect":"NoSchedule"}]'

in a namespace, and tolerate the following in a pod spec,

      tolerations:
      - effect: NoSchedule
        key: tkey
        operator: "Equal"
        value: "tvalue"

The pod would fail to create due to

namespace tolerations and pod tolerations conflict

Anything else we need to know?:

Happy to look into it and submit a PR if this is a bug that should be fixed.

Environment:

  • Kubernetes version (use kubectl version): 1.8.3
  • Cloud provider or hardware configuration: bare metal/on-prem
  • OS (e.g. from /etc/os-release): CentOS 7.4
  • Kernel (e.g. uname -a): 4.13.8
  • Install tools: custom/ansible
  • Others:
@phsiao

This comment has been minimized.

Show comment
Hide comment
@phsiao

phsiao Nov 14, 2017

Contributor

/sig api-machinery

Contributor

phsiao commented Nov 14, 2017

/sig api-machinery

@lavalamp

This comment has been minimized.

Show comment
Hide comment
@lavalamp

lavalamp Nov 16, 2017

Member

We don't want clients to make up defaults if the server didn't set it.

Member

lavalamp commented Nov 16, 2017

We don't want clients to make up defaults if the server didn't set it.

@lavalamp

This comment has been minimized.

Show comment
Hide comment
@lavalamp

lavalamp Nov 16, 2017

Member

@thockin this is like the 3rd time this issue has come up for me today...

Member

lavalamp commented Nov 16, 2017

@thockin this is like the 3rd time this issue has come up for me today...

@fejta-bot

This comment has been minimized.

Show comment
Hide comment
@fejta-bot

fejta-bot Feb 14, 2018

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-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

fejta-bot commented Feb 14, 2018

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-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@phsiao

This comment has been minimized.

Show comment
Hide comment
@phsiao

phsiao Feb 14, 2018

Contributor

/close

Contributor

phsiao commented Feb 14, 2018

/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment