-
Notifications
You must be signed in to change notification settings - Fork 918
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: affinityName can be set to an empty string #3442
Conversation
Codecov Report
📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more @@ Coverage Diff @@
## master #3442 +/- ##
==========================================
+ Coverage 51.78% 51.94% +0.16%
==========================================
Files 210 210
Lines 18974 19080 +106
==========================================
+ Hits 9826 9912 +86
- Misses 8605 8618 +13
- Partials 543 550 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
/lgtm |
0c4c874
to
ada48d5
Compare
@@ -59,6 +60,9 @@ func ValidateClusterAffinities(affinities []policyv1alpha1.ClusterAffinityTerm, | |||
|
|||
affinityNames := make(map[string]bool) | |||
for index, term := range affinities { | |||
for _, err := range validation.IsDNS1123Subdomain(term.AffinityName) { | |||
allErrs = append(allErrs, field.Invalid(fldPath.Index(index), term.AffinityName, err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid RFC1123 Label Names is a little bit too strict, which only accepts lowercase alphanumeric characters.
@XiShanYongYe-Chang Please take a look.
To be honest, I really don't want to add such a restriction that we should do in the last release, for people already using this feature, it'd be a challenge to upgrade.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compared to RFC1123 Label Names, how about the following?
const qnameCharFmt string = "[A-Za-z0-9]"
const qnameExtCharFmt string = "[-A-Za-z0-9_.]"
const qualifiedNameFmt string = "(" + qnameCharFmt + qnameExtCharFmt + "*)?" + qnameCharFmt
const qualifiedNameErrMsg string = "must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @RainbowMango @XiShanYongYe-Chang Please take a look.
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
ada48d5
to
6fb9329
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/assign
I will add it to my queue and will try to review it tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks~
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
I updated the release-note by the way.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind bug
What this PR does / why we need it:
affinityName cannot be set to an empty string.
Which issue(s) this PR fixes:
Fixes #3441
Special notes for your reviewer:
Does this PR introduce a user-facing change?: