-
Notifications
You must be signed in to change notification settings - Fork 67
Fix endpoints handling #1032
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
Fix endpoints handling #1032
Conversation
Codecov ReportBase: 50.17% // Head: 50.20% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1032 +/- ##
==========================================
+ Coverage 50.17% 50.20% +0.03%
==========================================
Files 70 70
Lines 6021 6031 +10
==========================================
+ Hits 3021 3028 +7
- Misses 2770 2773 +3
Partials 230 230
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
AObuchow
left a comment
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.
Code looks good to me.
Tested on OpenShift 4.12 and checked the status of the DWR object on the cluster and things seemed correct:
apiVersion: controller.devfile.io/v1alpha1
kind: DevWorkspaceRouting
(...)
spec:
devworkspaceId: workspacee5084d468fca49bb
endpoints:
web-terminal:
- attributes:
type: main
exposure: public
name: test-query
path: /?test-param
protocol: http
targetPort: 8888
- exposure: public
name: test-path-query
path: /test/path/?test-param
protocol: http
targetPort: 8889
- exposure: public
name: test-path
path: /test/path/
protocol: http
targetPort: 8890
- exposure: public
name: test-no-path
protocol: http
targetPort: 8891
podSelector:
controller.devfile.io/devworkspace_id: workspacee5084d468fca49bb
routingClass: basic
status:
exposedEndpoints:
web-terminal:
- attributes:
type: main
name: test-query
url: >-
http://workspacee5084d468fca49bb.apps.ci-ln-vj4kpzb-72292.origin-ci-int-gce.dev.rhcloud.com/test-query/?test-param
- name: test-path-query
url: >-
http://workspacee5084d468fca49bb.apps.ci-ln-vj4kpzb-72292.origin-ci-int-gce.dev.rhcloud.com/test-path-query/test/path/?test-param
- name: test-path
url: >-
http://workspacee5084d468fca49bb.apps.ci-ln-vj4kpzb-72292.origin-ci-int-gce.dev.rhcloud.com/test-path/test/path/
- name: test-no-path
url: >-
http://workspacee5084d468fca49bb.apps.ci-ln-vj4kpzb-72292.origin-ci-int-gce.dev.rhcloud.com/test-no-path/
message: DevWorkspaceRouting prepared
phase: Ready| baseUrl := fmt.Sprintf("%s://%s", protocol, basehost) | ||
|
|
||
| url, err := url.Parse(baseUrl) | ||
| // hostWithProtocol := fmt.Sprintf("%s://%s", protocol, host) |
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 sure if this commented out code was intentional or not?
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.
Nope, left-over from refactoring
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, AObuchow The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add test cases to represent container components with endpoints like
- name: test-endpoint
targetPort: 8888
exposure: public
path: /?query-param
protocol: http
These tests currently fail.
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Fix issues where endpoints were incorrectly being processed if they defined a path. With basic routing, routes/ingresses are created with path referring to the endpoint name. Previously, this path was being dropped in the resolved endpoint, resulting in invalid paths (from the cluster perspective) Signed-off-by: Angel Misevski <amisevsk@redhat.com>
* Ignore trailing slash on base urls, as it is not required by any spec * Test that resolving endpoints distinguishes between /test/path?query=param and /test/path/?query=param Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
8b22d49 to
26f78bb
Compare
|
New changes are detected. LGTM label has been removed. |
What does this PR do?
Improves how the basic routing solver handles endpoints that define paths/queries/fragments.
What issues does this PR fix or reference?
Closes #1031
Is it tested? How?
Tests are updated. To test directly, apply the following workspace and test that resolved endpoints in the DevWorkspaceRouting match what is expected on OpenShift and Kubernetes:
PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-pathto trigger)v8-devworkspace-operator-e2e: DevWorkspace e2e testv8-che-happy-path: Happy path for verification integration with Che