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

Truncate UI service name if over 63 characters #2311

Merged

Conversation

jacobsalway
Copy link
Member

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

  • Bugfix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that could affect existing functionality)
  • Documentation update

Checklist

  • I have conducted a self-review of my own code.
  • I have updated documentation accordingly.
  • I have added tests that prove my changes are effective or that my feature works.
  • Existing unit tests pass locally with my changes.

Signed-off-by: Jacob Salway <jacob.salway@gmail.com>
@jacobsalway jacobsalway marked this pull request as ready for review November 5, 2024 10:23
@jacobsalway
Copy link
Member Author

/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 {
Copy link
Contributor

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

Copy link
Member Author

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)))
Copy link
Contributor

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 ?

Copy link
Member Author

@jacobsalway jacobsalway Nov 7, 2024

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.

https://github.com/kubeflow/spark-operator/blob/master/internal/controller/sparkapplication/controller.go#L649

Signed-off-by: Jacob Salway <jacob.salway@gmail.com>
@google-oss-prow google-oss-prow bot added size/M and removed size/S labels Nov 7, 2024
@jacobsalway
Copy link
Member Author

jacobsalway commented Nov 16, 2024

Bumping since the comments were addressed.

Copy link
Contributor

@ImpSy ImpSy left a 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

@ImpSy
Copy link
Contributor

ImpSy commented Nov 18, 2024

/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Nov 18, 2024
@ImpSy
Copy link
Contributor

ImpSy commented Nov 18, 2024

@ChenYi015 can you approve this ?

Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 43c1888 into kubeflow:master Nov 18, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Truncate Webui Service name
3 participants