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

✨ Index mounting ordering & few debug nits #3085

Merged
merged 4 commits into from
Mar 9, 2024

Conversation

mjudeikis
Copy link
Contributor

@mjudeikis mjudeikis commented Mar 7, 2024

Summary

This PR does few things:

  1. Fixes usage of HOME workspace where it does not honour host fixes: bug: kubectl-ws '~' changes hostname used in kubeconfig server URL #3011
  2. A few debug logs for cache and CRD creation (way too many hours spend on those...)
  3. Add weight into index routes:
// 1. We detect URL for the request and find the correct handler. URL can be
// shard based, virtual workspace or mount. First two are covered by r.URL,
// where mounts are covered by annotation on the workspace with the mount path.
// 2. If mountpoint is found, we rewrite the URL to resolve, else use one in
// request to match with mappings.
// 3. Iterate over mappings and find the one that matches the URL. If found,
// use the handler for that mapping, else use default handler - kcp.
// Mappings are done from most specific to least specific:
// Example: /clusters/cluster1/ will be matched before /clusters/

In general, it dynamically overrides mounts URLs (this was not done before), and matches them in order of length. Higher the weight (weight = length of the path) first it will get matches.

Without this, map is randomly selected and if you have 2 mappings with

clusters/foo
clusters/

your traffic will be randomized :)

Related issue(s)

Fixes #

Release Notes

Orders index path from longest with weight. 

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 7, 2024
@mjudeikis mjudeikis force-pushed the mjudeikis/index.order branch 2 times, most recently from f9d6799 to a78f9d2 Compare March 7, 2024 18:19
@kcp-ci-bot kcp-ci-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 8, 2024
Signed-off-by: Mangirdas Judeikis <mangirdas@judeikis.lt>
@kcp-ci-bot kcp-ci-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 9, 2024
@sttts
Copy link
Member

sttts commented Mar 9, 2024

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 9, 2024
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2e78003c68c0581c6433186cbccf51d0aebf1af8

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 9, 2024
@kcp-ci-bot kcp-ci-bot merged commit 678c0dd into kcp-dev:main Mar 9, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: kubectl-ws '~' changes hostname used in kubeconfig server URL
3 participants