-
Notifications
You must be signed in to change notification settings - Fork 719
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
Validate Elasticsearch resource names #1647
Changes from 1 commit
8185d24
de6f51e
aea00b3
ac6b022
8d13c6b
2f672ab
c3b53f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,9 @@ func Validate(es v1alpha1.Elasticsearch) error { | |
|
||
// length of the ordinal suffix that will be added to the pods of this sset | ||
podOrdinalSuffixLen := len(strconv.FormatInt(int64(nodeSpec.NodeCount), 10)) | ||
if nodeSpec.NodeCount < 10 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if I follow why this is needed. I'd think you always need to account for dash. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are correct. I made the mistake of thinking in round numbers only. |
||
podOrdinalSuffixLen++ // account for the dash before the ordinal | ||
} | ||
// there should be enough space for the ordinal suffix | ||
if validation.DNS1123SubdomainMaxLength-len(ssetName) < podOrdinalSuffixLen { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this account for dash before the ordinal? |
||
return fmt.Errorf("generated StatefulSet name '%s' exceeds allowed length of %d", | ||
|
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.
nit: should this be
nodeSpec.NodeCount - 1
? We start numbering from 0, so for 100 nodes the last ordinal will be 99.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.
It was intentional to account for the dash before the ordinal but now that I think about it, it doesn't work for node counts below 10.