Skip to content

[release-0.31] Fix permission claim defaultSelector hiding claimed resources - #4340

Merged
kcp-ci-bot merged 1 commit into
kcp-dev:release-0.31from
anastazya:codex/0.31-default-selector-hash
Aug 27, 2026
Merged

[release-0.31] Fix permission claim defaultSelector hiding claimed resources#4340
kcp-ci-bot merged 1 commit into
kcp-dev:release-0.31from
anastazya:codex/0.31-default-selector-hash

Conversation

@anastazya

@anastazya anastazya commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Manual cherry-pick of #4200 to release-0.31.

The cherry-pick had one modify/delete conflict because labels_test.go does not exist on this branch. I kept the upstream version of that test file. The resulting commit preserves the original author and the full upstream regression coverage.

Validation:

  • (cd staging/src/github.com/kcp-dev/sdk && go test ./... -count=1)
  • go test ./test/e2e/virtual/apiexport -run '^TestAPIExportPermissionClaimsDefaultSelector$' -count=1 -v
  • git diff --check

What Type of PR Is This?

/kind bug

Related Issue(s)

Backports #4200.

Release Notes

Fix watch request via VirtualWorkspace when selectors are used.

@kcp-ci-bot kcp-ci-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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. do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 25, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

Hi @anastazya. 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.

@gman0

gman0 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Why is this not just a git cherry-pick c37085bcc9f6f8fd6d5bc1b2ec315b8f5ca57409 (i.e. retaining the original author)?

git cherry-pick c37085bcc9f6f8fd6d5bc1b2ec315b8f5ca57409
git add staging/src/github.com/kcp-dev/sdk/apis/apis/v1alpha2/permissionclaims/labels_test.go
git cherry-pick --continue

Should work just fine?

@anastazya

Copy link
Copy Markdown
Author

You're right, I overcomplicated this. The cherry-pick works with the conflict resolved as you described, and the unit and E2E tests pass. I'll replace the current commit and keep the original author.

ToLabelKeyAndValue JSON-marshals the entire PermissionClaim to derive the
label used to identify claimed objects. The APIExport virtual workspace
reconciler hashes the APIExport's claim (which may carry a defaultSelector)
to build the LIST/WATCH filter, while the permissionclaim labeler hashes the
APIBinding's accepted claim (which never carries a defaultSelector) to label
the objects. With a defaultSelector present the two hashes diverge, so the
filter never matches the labeled objects and claimed resources become
invisible through the APIExport endpoint.

defaultSelector (like the binding-time selector and verbs) scopes access; it
is not part of a claim's identity and is enforced separately. Exclude it from
the hash. Claims without a defaultSelector are unaffected, so no migration is
needed.

Adds a unit regression test and an e2e test that lists a claimed configmap
through the APIExport virtual workspace when the APIExport claim carries a
defaultSelector.

Fixes kcp-dev#4198

(cherry picked from commit c37085b)
Signed-off-by: Theodor Ganescu <star.sg1@gmail.com>
@anastazya
anastazya force-pushed the codex/0.31-default-selector-hash branch from 95419d8 to 6523233 Compare August 26, 2026 10:03
@anastazya anastazya changed the title fix: backport permission claim defaultSelector hash fix to 0.31 [release-0.31] Fix permission claim defaultSelector hiding claimed resources Aug 26, 2026
@anastazya
anastazya marked this pull request as ready for review August 26, 2026 10:07
@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/work-in-progress Indicates that a PR should not merge because it is a work in progress. 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 Aug 26, 2026
@anastazya

Copy link
Copy Markdown
Author

/kind bug

@kcp-ci-bot kcp-ci-bot added kind/bug Categorizes issue or PR as related to a bug. and removed do-not-merge/needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Aug 26, 2026

@xrstf xrstf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 27, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 17c23813f9eaf809d9697ff65b04c56ed7fc5eb1

@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 kcp-ci-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 27, 2026
@gman0

gman0 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

https://public-prow.kcp.k8c.io/view/s3/prow-public-data/pr-logs/pull/kcp-dev_kcp/4340/pull-kcp-test-e2e-shared/2092908294225006592

=== Failed
=== FAIL: test/e2e/virtual/terminatingworkspaces TestTerminatingWorkspacesVirtualWorkspaceWatch (34.25s)
    virtualworkspace_test.go:513: Shared kcp server will target configuration "/home/prow/go/src/github.com/kcp-dev/kcp/.kcp/admin.kubeconfig"
    virtualworkspace_test.go:513: Waiting for readiness for server at https://127.0.0.1:6443
    virtualworkspace_test.go:514: Waiting for tenancy.kcp.io/v1alpha1 to be served
    virtualworkspace_test.go:514: Waiting for tenancy.kcp.io/v1alpha1 to be served
    virtualworkspace_test.go:514: Waiting for tenancy.kcp.io/v1alpha1 to be served
    virtualworkspace_test.go:514: Waiting for topology.kcp.io/v1alpha1 to be served
    virtualworkspace_test.go:514: Waiting for topology.kcp.io/v1alpha1 to be served
    virtualworkspace_test.go:514: Created root:universal workspace root:e2e-workspace-rbxkb as /clusters/927nfsi29j14cowl on shard "root"
    virtualworkspace_test.go:527: Create workspacetypes with terminators
    virtualworkspace_test.go:554: Saving test artifacts for test "TestTerminatingWorkspacesVirtualWorkspaceWatch" under "/logs/artifacts/TestTerminatingWorkspacesVirtualWorkspaceWatch/2677700476".
    virtualworkspace_test.go:559: Wait for WorkspaceTypes and their virtual workspace URLs to be ready
    virtualworkspace_test.go:586: Create clients through the virtual workspace
    virtualworkspace_test.go:610: Start watchers for virtual workspace combinations
    virtualworkspace_test.go:635: Create workspaces and put them into deletion
    virtualworkspace_test.go:664: Check that watchers have received events for workspaces
    virtualworkspace_test.go:688: never saw a watch modified event for vw "parent" and targetWs "e2e-workspace-jbvkm"

/retest

@kcp-ci-bot
kcp-ci-bot merged commit 31425e2 into kcp-dev:release-0.31 Aug 27, 2026
13 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/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. needs-ok-to-test Indicates a PR that requires an org member to verify it 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.

5 participants