-
Notifications
You must be signed in to change notification settings - Fork 42
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
Improve validation of MigCluster Registry URL field #1154
Comments
The format should just be |
Hey guys, I will be interested to work on this issue. But I'm wondering if the issue is not related to some underline tools.
So do we need to put some validation/auto-fix steps in the code? Or would it be better to review deeper in the code to check which part of the process is failing due to the extra trailing slash present in the URI? |
I'm not sure it matters which part is failing -- a trailing slash represents invalid input and the MigCluster validation should catch it. The registry field (it's not a URL field -- the github issue title is wrong and reflects the same confusion I referenced in my comment above) is a hostname with optional port. A slash is not part of a hostname or a port. The dockerImageReference is generated by combining the registry host with the namespace, name, and tag of the image. |
I've prepared a fix: As the GetRegistryPath function is already splitting the field without a warning message, I assumed that we should remove the trailer the same way. Cheers, |
@vlours Thank you for the fix. What you did in your fix makes sense and solves this particular issue. It would be great if we could also add an additional validation in MigCluster validation to address what Scott mentioned. I didn't know about the host[:port] validation. If you could address that in the same PR, that would be great. Totally fine if you only added this fix. All PRs go against the master branch. |
Hi @pranavgaikwad, I'm not sure how the validation is working. Otherwise, please let me know which branch I should create the PR to? Cheers, |
@pranavgaikwad Yes, it looks like we previously decided to strip off invalid input from the user instead of validating. I think as long as we're accepting invalid input before the host[:port], then stripping invalid input after is consistent here. If we're going to validate and complain about the trailing slash, we should probably also complain about "https://" in the field. |
@vlours Please create PR against master branch |
PR created: #1158 |
@vlours thank you for your contribution. Your PR is merged, I am still keeping this issue open for the other validation that we wanted to add. |
Is your feature request related to a problem? Please describe.
Sometimes image migration may end up failing because of an extra trailing slash present in the URI of registry provided through MigCluster resource. We need to improve the backend validation to filter such bad inputs.
The text was updated successfully, but these errors were encountered: