Skip to content

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

Merged
kcp-ci-bot merged 1 commit intokcp-dev:mainfrom
ifdotpy:feat/virtual-workspace-config
Apr 8, 2026
Merged

feat: support virtual workspace URL path in --config-workspace#19
kcp-ci-bot merged 1 commit intokcp-dev:mainfrom
ifdotpy:feat/virtual-workspace-config

Conversation

@ifdotpy
Copy link
Copy Markdown
Contributor

@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

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

@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
@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Apr 8, 2026
@xrstf
Copy link
Copy Markdown
Contributor

xrstf commented Apr 8, 2026

/kind feature

@kcp-ci-bot kcp-ci-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 8, 2026
@xrstf
Copy link
Copy Markdown
Contributor

xrstf commented Apr 8, 2026

/ok-to-test

@kcp-ci-bot kcp-ci-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 8, 2026
@xrstf
Copy link
Copy Markdown
Contributor

xrstf commented Apr 8, 2026

/approve
/lgtm

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Apr 8, 2026
@kcp-ci-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xrstf

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

The pull request process is described 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
Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 2025280cc7e700781632baccd36ccd4c019cc857

@kcp-ci-bot kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 8, 2026
@kcp-ci-bot kcp-ci-bot merged commit 50421ac into kcp-dev:main Apr 8, 2026
10 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. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

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

4 participants