-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Truncate UI service name if over 63 characters #2311
Truncate UI service name if over 63 characters #2311
Conversation
Signed-off-by: Jacob Salway <jacob.salway@gmail.com>
60bb78d
to
af3400d
Compare
/assign @ChenYi015 @ImpSy |
|
||
// Truncate the name and append a hash to ensure uniqueness while staying below the limit | ||
hash := fmt.Sprintf("%x", md5.Sum([]byte(preferredName))) | ||
return fmt.Sprintf("%s-%s-ui-svc", app.Name[:47], hash[:8]) | ||
} | ||
|
||
func GetDefaultUIIngressName(app *v1beta2.SparkApplication) string { |
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.
we should do the same for this function
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.
Done
} | ||
|
||
// Truncate the name and append a hash to ensure uniqueness while staying below the limit | ||
hash := fmt.Sprintf("%x", md5.Sum([]byte(preferredName))) |
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.
wdyt about reusing the first 8 character from the submissionID (app.Status.SubmissionID
) instead ?
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.
Not a bad idea either as that's a UUID. Truncating the name and appending its hash was the first approach that came to mind as I've seen it in other systems/software for truncation.
Signed-off-by: Jacob Salway <jacob.salway@gmail.com>
94ba78b
to
4719b0c
Compare
Bumping since the comments were addressed. |
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.
Sorry for not reviewing this in a timely manner
/lgtm |
@ChenYi015 can you approve this ? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ChenYi015, ImpSy 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 |
Purpose of this PR
Truncate the UI service name while appending a hash to ensure uniqueness if longer than 63 characters.
Close #2300
Change Category
Checklist