Skip to content

Implement wrappers in CLI module to allow working with older API versions#3539

Merged
kcp-ci-bot merged 4 commits into
kcp-dev:mainfrom
xrstf:kubectl-backwards-bc
Aug 18, 2025
Merged

Implement wrappers in CLI module to allow working with older API versions#3539
kcp-ci-bot merged 4 commits into
kcp-dev:mainfrom
xrstf:kubectl-backwards-bc

Conversation

@xrstf

@xrstf xrstf commented Aug 15, 2025

Copy link
Copy Markdown
Contributor

Summary

This PR makes the kubectl kcp bind and kubectl kcp claims commands comatible with kcp 0.27+ at least, probably also older releases.

Currently our API does not have a shard, common type for APIBindings, and I did not want to embark in refactoring half the conversion logic just to fix this bug, plus it would have made backporting this into 0.28 impossible.

So instead I created a very lightweight wrapped in the CLI helpers. These turn the Kubernetes objects they wrap in kind of ActiveRecord-like objects that know how to refresh and update themselves, plus they know how to print or check their own status.

The goal was to try to keep the actual plugin logic as linear and typed as possible.

FAQ: Why are we not using the existing conversion funcs to handle permission claims? – because our conversion funcs do not do error handling, as they are meant to always succeed. More specifically, the conversion funcs for PermissionClaims assume that you have already pre-converted them in the APIBinding object to, if necessary, set annotations. This is simply not applicable here and so calling them would not help in detecting unsupported configurations.

What Type of PR Is This?

/kind regression

Related Issue(s)

Fixes #3529

Release Notes

The kcp kubectl plugin now supports kcp <0.28 again. In kcp 0.28+, `kubectl kcp claims get apibinding` now shows the permission claim verbs.

@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. release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/regression Categorizes issue or PR as related to a regression from a prior release. dco-signoff: yes Indicates the PR's author has signed the DCO. area/cli Issues or PRs related to CLI changes size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 15, 2025
xrstf added 2 commits August 15, 2025 19:02
On-behalf-of: @SAP christoph.mewes@sap.com
@xrstf xrstf force-pushed the kubectl-backwards-bc branch from c8c90d4 to 18ad332 Compare August 15, 2025 17:30
xrstf added 2 commits August 15, 2025 19:32
On-behalf-of: @SAP christoph.mewes@sap.com
On-behalf-of: @SAP christoph.mewes@sap.com
@xrstf xrstf changed the title WIP - Implement wrappers in CLI module to allow working with older API versions Implement wrappers in CLI module to allow working with older API versions Aug 15, 2025
@kcp-ci-bot kcp-ci-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 15, 2025
@xrstf xrstf requested a review from embik August 15, 2025 18:40

@embik embik left a comment

Copy link
Copy Markdown
Member

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 18, 2025
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 9b1aa47ea323dd92b9310b7547ea8c5d56617ce9

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: embik

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 18, 2025
@embik

embik commented Aug 18, 2025

Copy link
Copy Markdown
Member

/cherry-pick release-0.28

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

@embik: once the present PR merges, I will cherry-pick it on top of release-0.28 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-0.28

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/test-infra repository.

@xrstf

xrstf commented Aug 18, 2025

Copy link
Copy Markdown
Contributor Author

/retest

@kcp-ci-bot kcp-ci-bot merged commit a54412e into kcp-dev:main Aug 18, 2025
14 checks passed
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

@embik: new pull request created: #3541

Details

In response to this:

/cherry-pick release-0.28

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/test-infra repository.

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. area/cli Issues or PRs related to CLI changes dco-signoff: yes Indicates the PR's author has signed the DCO. kind/regression Categorizes issue or PR as related to a regression from a prior release. 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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: kubectl plugins are not downwards-compatible

3 participants