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

fix: correct url for virtual ws #170

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

vertex451
Copy link
Member

@vertex451 vertex451 commented Apr 7, 2025

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]

On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
@github-actions github-actions bot added the fix label Apr 7, 2025
On-behalf-of: @SAP [email protected]
Signed-off-by: Artem Shcherbatiuk <[email protected]>
@vertex451 vertex451 marked this pull request as ready for review April 7, 2025 09:17
@vertex451 vertex451 requested a review from a team as a code owner April 7, 2025 09:17
@vertex451 vertex451 requested a review from aaronschweig April 7, 2025 09:17
@vertex451 vertex451 self-assigned this Apr 7, 2025
Comment on lines +67 to +78
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
Copy link
Member

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?

Copy link
Member Author

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)

@vertex451 vertex451 requested a review from nexus49 April 7, 2025 16:06
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.

2 participants