-
Notifications
You must be signed in to change notification settings - Fork 77
feat: enable IPv6 support for factory resolver endpoints #951
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
base: main
Are you sure you want to change the base?
Conversation
This change adds IPv6 support in Eclipse Che Server to enable operation
in IPv6-only network environments. As Kubernetes platforms (particularly
OpenShift Container Platform 4.20) migrate to IPv6, the factory resolver
must handle IPv6 addresses correctly in URLs and API calls.
The implementation involved minimal, focused changes to URL validation
patterns and server URL extraction, enabling full IPv6 support while
maintaining complete backward compatibility with IPv4-only and dual-stack
environments.
Background:
-----------
The Eclipse Che factory resolver previously failed to operate with IPv6
git server URLs due to:
1. URL Validation Issues: Regular expressions rejected IPv6 bracket
notation (e.g., `http://[::1]:8080`)
2. Manual String Parsing: getServerUrl() methods used pattern matching
that didn't account for IPv6 brackets
3. Regex Escaping: Host strings from IPv6 URLs were inserted into regex
patterns without properly escaping the bracket characters
IPv6 Bracket Notation:
----------------------
IPv6 addresses in URLs require square brackets to distinguish the
address from port numbers:
- ✅ Correct: `http://[2001:db8::1]:8080/repo.git`
- ❌ Incorrect: `http://2001:db8::1:8080/repo.git` (ambiguous)
Changes:
--------
1. AbstractGitlabUrlParser:
- Fixed constructor to use URI.getHost() instead of manual substring
extraction
- Added IPv6 bracket escaping in getPatternMatcherByUrl()
- Updated getServerUrl() to use URI parsing for IPv6 support
2. AbstractGithubURLParser:
- Added IPv6 bracket escaping in getPatternMatcherByUrl()
- Updated getServerUrl() to use URI parsing for IPv6 support
3. AzureDevOpsURLParser:
- Added IPv6 bracket escaping in getPatternMatcherByUrl()
- Updated getServerUrl() to use URI parsing for IPv6 support
Technical Details:
------------------
Java's URI.getHost() returns IPv6 addresses WITH brackets (e.g.,
"[2001:db8::1]"). When constructing regex patterns, these brackets
must be escaped as `\[` and `\]` because they are special regex
characters. The fix uses:
- Pattern.quote() to escape the IPv6 address (without brackets)
- Manual escaping of the brackets themselves
Fixes: eclipse-che/che#23674
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Oleksii Orel <oorel@redhat.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: olexii4 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@olexii4: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What does this PR do?
This change adds IPv6 support in Eclipse Che Server to enable operation in IPv6-only network environments. As Kubernetes platforms (particularly OpenShift Container Platform 4.20) migrate to IPv6, the factory resolver must handle IPv6 addresses correctly in URLs and API calls.
The implementation involved minimal, focused changes to URL validation patterns and server URL extraction, enabling full IPv6 support while maintaining complete backward compatibility with IPv4-only and dual-stack environments.
Background:
The Eclipse Che factory resolver previously failed to operate with IPv6 git server URLs due to:
http://[::1]:8080)IPv6 Bracket Notation:
IPv6 addresses in URLs require square brackets to distinguish the address from port numbers:
http://[2001:db8::1]:8080/repo.githttp://2001:db8::1:8080/repo.git(ambiguous)Changes:
AbstractGitlabUrlParser:
AbstractGithubURLParser:
AzureDevOpsURLParser:
Technical Details:
Java's URI.getHost() returns IPv6 addresses WITH brackets (e.g., "[2001:db8::1]"). When constructing regex patterns, these brackets must be escaped as
\[and\]because they are special regex characters. The fix uses:Screenshot/screencast of this PR
What issues does this PR fix or reference?
fixes: eclipse-che/che#23674
How to test this PR?
PR Checklist
As the author of this Pull Request I made sure that:
What issues does this PR fix or referenceandHow to test this PRcompletedRelease Notes
Reviewers
Reviewers, please comment how you tested the PR when approving it.