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

Duplicate Tolerations #124881

Open
rgarcia89 opened this issue May 15, 2024 · 4 comments · May be fixed by #124964
Open

Duplicate Tolerations #124881

rgarcia89 opened this issue May 15, 2024 · 4 comments · May be fixed by #124964
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@rgarcia89
Copy link

What would you like to be added?

I have encountered an issue where duplicate tolerations exist within the tolerations array of Kubernetes Deployment YAML. Despite being duplicates, these tolerations are not being ignored as I would have expected, which in my case led to duplicate metric samples produced by the kube-state-metrics.

A validation check within the Kubernetes API server to reject manifests with duplicate tolerations, ensuring adherence to Kubernetes best practices and avoiding potential issues related to duplicate toleration definitions would be great.

The whole thing was noticed after the update to prometheus v2.52.0 which includes a new check for duplicates during the scrape phase. I created the following issue for that prometheus/prometheus#14089

I have meanwhile also created an issue for the kube-state-metrics project requesting some changes in order to tackle such situations in the future. kubernetes/kube-state-metrics#2390

Steps to reproduce:

  1. ) Deploy the following deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-deployment
  labels:
    app: something
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test
  template:
    metadata:
      labels:
        app: test
    spec:
      containers:
      - name: test-container
        image: nginx
      tolerations:
       - key: CriticalAddonsOnly
         operator: Exists
       - key: CriticalAddonsOnly
         operator: Exists

2.) Check the tolerations of the scheduled pod for instance:

...
       tolerations:
       - key: CriticalAddonsOnly
         operator: Exists
       - key: CriticalAddonsOnly
         operator: Exists
...

Why is this needed?

Duplicate tolerations are not being ignored and are applied to resources, potentially resulting in unintended behaviors.

@rgarcia89 rgarcia89 added the kind/feature Categorizes issue or PR as related to a new feature. label May 15, 2024
@k8s-ci-robot k8s-ci-robot added 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. labels May 15, 2024
@rgarcia89
Copy link
Author

/sig api-machinery
/sig architecture

@k8s-ci-robot k8s-ci-robot added sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 15, 2024
@AxeZhan
Copy link
Member

AxeZhan commented May 15, 2024

/cc

@olderTaoist
Copy link
Contributor

/assign

@seans3
Copy link
Contributor

seans3 commented May 21, 2024

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 21, 2024
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. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/architecture Categorizes an issue or PR as relevant to SIG Architecture. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants