-
Notifications
You must be signed in to change notification settings - Fork 0
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: correct url for virtual ws #170
base: main
Are you sure you want to change the base?
Conversation
On-behalf-of: @SAP [email protected] Signed-off-by: Artem Shcherbatiuk <[email protected]>
On-behalf-of: @SAP [email protected] Signed-off-by: Artem Shcherbatiuk <[email protected]>
pathURL, err := url.Parse(pathURLStr) | ||
if err != nil { | ||
return "", errors.Join(ErrInvalidURL, err) | ||
} | ||
|
||
path := pathURL.Path | ||
|
||
if !strings.HasPrefix(path, "/") { | ||
path = "/" + path | ||
} | ||
|
||
return baseURL.ResolveReference(&url.URL{Path: path}).String(), nil |
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.
can't you just use url.JoinPath(baseURLStr, pathURL) here 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.
No, it does simple concatenation, and instead of:
"https://openmfp-kcp-front-proxy.openmfp-system:8443/services/apiexport/root/kubernetes.graphql.gateway"
It end up with
"https://openmfp-kcp-front-proxy.openmfp-system:8443/clusters/root/https:/kcp.dev.local:8443/services/apiexport/root/kubernetes.graphql.gateway"
(host from second param is not removed)
On-behalf-of: @SAP [email protected] Signed-off-by: Artem Shcherbatiuk <[email protected]>
When we create ApiExport, it assigns to virtual workspace url address with external host, which is not resolvable within openmfp cluster.
The solution is to take the host address that is present in kubeconfig and replace original virtual workspace url host.
It works in both cases - in openmpf and outside it.
Also, I added a change for local development - app is not failing in case of kubernetes.graphql.gateway apixexport absence, it starts but prints warning that ApiBindings are not watched.
On-behalf-of: @SAP [email protected]