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

fix: don't panic when given a bad topology selector #160

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

ellistarn
Copy link
Contributor

@ellistarn ellistarn commented Jan 9, 2023

Fixes #

Description
Created upstream issue: kubernetes/kubernetes#114932

For pod affinity/topology:

It appears that namespace selector is correctly validated by the API server:

Message: "Pod \"sentryfoam-5-asuppnkdet\" is invalid: spec.affinity.podAffinity.requiredDuringSchedulingIgnoredDuringExecution[0].namespaceSelector.matchLabels: Invalid value: \"{ invalid }\": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue',  or 'my_value',  or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')",

But label selector is not

panic: values[0][app.kubernetes.io/name]: Invalid value: "{{ zqfmgb }}": a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character

How was this change tested?
make test

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ellistarn ellistarn requested a review from a team as a code owner January 9, 2023 20:48
@ellistarn ellistarn requested a review from tzneal January 9, 2023 20:48
@coveralls
Copy link

coveralls commented Jan 9, 2023

Pull Request Test Coverage Report for Build 3877899852

  • 13 of 17 (76.47%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 76.355%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controllers/provisioning/scheduling/topology.go 5 9 55.56%
Totals Coverage Status
Change from base Build 3877886321: -0.05%
Covered Lines: 5790
Relevant Lines: 7583

💛 - Coveralls

Copy link
Contributor

@tzneal tzneal left a comment

Choose a reason for hiding this comment

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

lgtm

@ellistarn ellistarn merged commit 55bd14d into kubernetes-sigs:main Jan 9, 2023
@ellistarn ellistarn deleted the panic branch January 9, 2023 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants