Skip to content

feat: support virtual workspace URL path in --config-workspace#19

Open
ifdotpy wants to merge 1 commit intokcp-dev:mainfrom
ifdotpy:feat/virtual-workspace-config
Open

feat: support virtual workspace URL path in --config-workspace#19
ifdotpy wants to merge 1 commit intokcp-dev:mainfrom
ifdotpy:feat/virtual-workspace-config

Conversation

@ifdotpy
Copy link
Copy Markdown

@ifdotpy ifdotpy commented Apr 2, 2026

Summary

Allow --config-workspace to accept a direct URL path (starting with /) in addition to logical cluster paths. This enables init-agent to watch InitTarget/InitTemplate resources via an APIExport virtual workspace.

Changes

  • internal/kcp/rest.go: Add RetargetRestConfigToPath helper for direct URL path retargeting. Fix StripCluster to handle trailing slashes before regex match.
  • cmd/init-agent/main.go: Use RetargetRestConfigToPath when config workspace starts with /. Preserve base config for leader election to avoid sending lease requests to virtual workspace URLs.
  • cmd/init-agent/options.go: Update flag description and comment.
  • internal/kcp/rest_test.go: Table-driven tests for RetargetRestConfig, RetargetRestConfigToPath, and StripCluster.

How it works

When the value starts with /, it is appended directly to the base KCP host URL. Otherwise, existing behavior is preserved (/clusters/<path>).

The ClusterClient (used for fetching WorkspaceTypes and InitTemplates) is initialized separately from the manager config, so it continues to use the base KCP URL regardless of the config workspace format.

Leader election uses a copy of the pre-retarget config, so lease operations always target the original KCP workspace.

Backward compatibility

Fully backward compatible. Existing --config-workspace=root:init-agent continues to work unchanged.

Fixes #18

```release-note
Support virtual workspace URL path in --config-workspace flag for self-service provider initialization.
```

@kcp-ci-bot
Copy link
Copy Markdown
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions 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.

@kcp-ci-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign xrstf for approval. For more information see the Code Review Process.

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

Details 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 do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 2, 2026
@kcp-ci-bot
Copy link
Copy Markdown
Contributor

Hi @ifdotpy. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions 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.

@kcp-ci-bot kcp-ci-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 2, 2026
@ifdotpy ifdotpy force-pushed the feat/virtual-workspace-config branch from b004ff4 to 351ab5a Compare April 2, 2026 15:48
@kcp-ci-bot kcp-ci-bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Apr 2, 2026
@ifdotpy ifdotpy force-pushed the feat/virtual-workspace-config branch 2 times, most recently from cd8efc5 to c69aa64 Compare April 2, 2026 16:14
Allow --config-workspace to accept a direct URL path (starting with /)
in addition to logical cluster paths. This enables init-agent to watch
InitTarget/InitTemplate resources via an APIExport virtual workspace,
which aggregates resources from multiple provider workspaces.

When the value starts with /, it is used as a direct URL path appended
to the base KCP host. Otherwise, existing behavior is preserved
(appending /clusters/<path>).

Ref: kcp-dev#18
Signed-off-by: Igor Fominykh <ifdotpy@gmail.com>
@ifdotpy ifdotpy force-pushed the feat/virtual-workspace-config branch from c69aa64 to 951b765 Compare April 2, 2026 16:26
@kcp-ci-bot kcp-ci-bot added dco-signoff: yes Indicates the PR's author has signed the DCO. and removed dco-signoff: no Indicates the PR's author has not signed the DCO. labels Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. 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.

Support virtual workspace URL in --config-workspace for self-service provider initialization

2 participants