Skip to content

Conversation

@michaelawyu
Copy link

  • One-line PR description: this PR updates KEP-5339 to add a field for cluster-specific auth information in the cluster profile API
  • Other comments:

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 22, 2025
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Sep 22, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 22, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @michaelawyu!

It looks like this is your first PR to kubernetes/enhancements 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/enhancements has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot added sig/multicluster Categorizes an issue or PR as relevant to SIG Multicluster. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 22, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @michaelawyu. Thanks for your PR.

I'm waiting for a kubernetes 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.

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.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 22, 2025
@michaelawyu michaelawyu changed the title KEP-5339: add additional information field to the cluster profile object KEP-5339: add additional cluster-specific auth info field to the cluster profile object Sep 22, 2025
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 22, 2025
@michaelawyu michaelawyu marked this pull request as ready for review September 22, 2025 17:45
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 22, 2025
@skitt
Copy link
Member

skitt commented Oct 7, 2025

/ok-to-test

@k8s-ci-robot k8s-ci-robot 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 Oct 7, 2025
@lauralorenz
Copy link
Contributor

Triage notes:

  • Needs reviews from the community, please take a look

Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
@michaelawyu michaelawyu force-pushed the kep-5339-extensions-update branch from 133f634 to bce1a46 Compare October 21, 2025 06:43
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
@skitt
Copy link
Member

skitt commented Oct 21, 2025

This looks good to me, thanks; before I approve it, do you have an example handy of a real-world situation showing how these extensions would be used in practice?

Copy link
Contributor

@qiujian16 qiujian16 left a comment

Choose a reason for hiding this comment

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

this looks good to me, I think you also need to update the metadata.yaml


The `Extensions` field in the `Cluster` struct, can hold various form of data, each associated with an extension name.
[KEP 541](https://github.com/kubernetes/enhancements/blob/master/keps/sig-auth/541-external-credential-providers/README.md)
further reserves a an extension name, `client.authentication.k8s.io/exec`, that can be used to pass cluster-specific
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
further reserves a an extension name, `client.authentication.k8s.io/exec`, that can be used to pass cluster-specific
further reserves an extension name, `client.authentication.k8s.io/exec`, that can be used to pass cluster-specific

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, coretone! Let me fix this.

cluster and its CA bundle), to an environment variable, `KUBERNETES_EXEC_INFO`. An exec plugin may choose to read
the environment variable, and make use of the extension data as it sees fit.

For the authentication workflow described in this KEP, users may, too, choose to specify a `client.authentication.k8s.io/exec`
Copy link
Contributor

Choose a reason for hiding this comment

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

how is this paragraph different from the previous one? You seem to imply that its additive to the previous one, but it seems to just explain the in-code behavior that the Extension content always overwrites any ExecConfig.Config ?

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! Let me simplify this sections about client.authentication.k8s.io/exec a bit so that the PR can be more focused.

`ProvideClusterInfo` flag is unset (the default), this variable will be absent. There are a few cases where the
variable cannot be easily set: for example, the `KUBERNETES_EXEC_INFO` environment variable does feature the CA bundle for the
target cluster, which can potentially get quite large; depending on the target environment, it might not be OK to
write such data as an environment variable. Exec plugins are not mandated to support this environment variable either;
Copy link
Contributor

Choose a reason for hiding this comment

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

Exec plugins are not mandated to support this environment variable either;

I don't think its an actual issue. if they don't support the envvar, it means they don't need data that would be in it...

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! It is true, though I am more thinking in the way that the plugins might have other ways to take the inputs needed... Anyway, as mentioned earlier, let me simplify the sections a bit more.

variable cannot be easily set: for example, the `KUBERNETES_EXEC_INFO` environment variable does feature the CA bundle for the
target cluster, which can potentially get quite large; depending on the target environment, it might not be OK to
write such data as an environment variable. Exec plugins are not mandated to support this environment variable either;
even for those that do read this environment variable, it is not guaranteed that the included extension data can be
Copy link
Contributor

Choose a reason for hiding this comment

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

it is not guaranteed that the included extension data can be properly extracted

This would actually be a misconfiguration? I don't think anyone must protect the extension. The paragraph from line l.319 to l.326 gives a good summary that things may breakdown if marshalling/unmarshalling doesnt work.

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! For this part the idea was that both the marshaller and the unmarshaller must know the expected object type (scheme) to make it work, but from the communit library's perspective it is a bit difficult to achieve so. Once again, let me simplify this a bit.

properly extracted.

On the other hand, it is quite common for multi-cluster users to have a need for specifying cluster-specific information
when performing the authentication workflow: the authentication solution in use by a cluster might be expecting a token of
Copy link
Contributor

Choose a reason for hiding this comment

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

can we remove this intro or shorten it?

Maybe something like: Extensions are useful for ClusterProfile to communicate additional elements such as audience, identity guidance etc.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, let me simplify this part.

On the other hand, it is quite common for multi-cluster users to have a need for specifying cluster-specific information
when performing the authentication workflow: the authentication solution in use by a cluster might be expecting a token of
a specific audience, or a token from a specific identity. Most, if not all, exec plugins would expect such information
from the CLI arguments or some environment variables. In a single-cluster setup, it is trivial to set them up, as the
Copy link
Contributor

Choose a reason for hiding this comment

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

Most, if not all, exec plugins would expect such information from the CLI arguments or some environment variables.

This I disagree with the wording. The mechanism described above is via KUBERNETES_EXEC_INFO and it would mostly be good for the vast majority.

I would prefer to point out on possible shortcomings of the envvar, which are:

  1. Length limitations (which is proposed above as a blocker, though I'd question if args don't suffer the same issues)
  2. Ability to leverage existing binaries that require usage of arguments instead of the envvar.

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! I might have a little bit different idea on the vast majority part given how well the KUBERNETES_EXEC_INFO env var is supported right now but I do get the point. Will tweak the wordings a bit to be more focused.

To address this decifiency, we further proposes that:

* this KEP reserve a name in the extensions, `multicluster.x-k8s.io/clusterprofiles/auth/exec/additional-args`, which holds
additional CLI arguments that need to be supplied to the exec plugin when the Cluster Profile API and community-provided
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
additional CLI arguments that need to be supplied to the exec plugin when the Cluster Profile API and community-provided
additional CLI arguments that would be supplied to the exec plugin when the Cluster Profile API and community-provided

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! Thanks, let me fix the part.

additional CLI arguments that need to be supplied to the exec plugin when the Cluster Profile API and community-provided
library are used for authentication.

If an extension under this name is present, the community-provided library will extract the data, and append the
Copy link
Contributor

Choose a reason for hiding this comment

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

indent left?

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! Thanks, let me fix the part.

that the community-provided library implementation must allow users to specify whether additional CLI arguments or environment
variables can be set by a `ClusterProfile` object. Available options include:

* `Ignore`: ignore any `multicluster.x-k8s.io/clusterprofiles/auth/exec/additional-args` or `multicluster.x-k8s.io/clusterprofiles/auth/exec/additional-envs` extension; no additional CLI arguments or environment variables will be set.
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the section and default recommendation. But I'd love more details here.

Could we recommend a field similar to ProvideClusterInfo that would be AllowClusterProfileSourcedArgs (defaults to false) and AllowClusterProfileSourcedEnv (defaults to false).

Those arguments would be set in the Provider, defined in Configuring plugins in the controller

Copy link
Author

Choose a reason for hiding this comment

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

Hi coretone! I do not have a preference on this part, let me make the edits.

@skitt
Copy link
Member

skitt commented Nov 4, 2025

See also this PR: kubernetes-sigs/cluster-inventory-api#27

@kahirokunn
Copy link
Contributor

kahirokunn commented Nov 11, 2025

I created the following PR, and discussed and agreed with corentone to incorporate the extensions specification.

kubernetes-sigs/cluster-inventory-api#21

After this implementation was merged, I immediately created the PR for #5643 and requested a review on Slack.

https://kubernetes.slack.com/archives/C09R1PJR3/p1760015723440499?thread_ts=1756771754.324819&cid=C09R1PJR3

This PR seems to have been opened before my PR, but the commit dates suggest my PR is older.
As I am the implementer of extensions, I am confident that I submitted the KEP correction immediately after implementation. However, my PR and your PR appear to partially overlap, though not completely.
How should we merge this? 👀

@michaelawyu
Copy link
Author

I created the following PR, and discussed and agreed with corentone to incorporate the extensions specification.

kubernetes-sigs/cluster-inventory-api#21

After this implementation was merged, I immediately created the PR for #5643 and requested a review on Slack.

https://kubernetes.slack.com/archives/C09R1PJR3/p1760015723440499?thread_ts=1756771754.324819&cid=C09R1PJR3

This PR seems to have been opened before my PR, but the commit dates suggest my PR is older. As I am the implementer of extensions, I am confident that I submitted the KEP correction immediately after implementation. However, my PR and your PR appear to partially overlap, though not completely. How should we merge this? 👀

Hi @kahirokunn! I don't think this PR is a duplicate of #5643 though; as you can see from the changes in the PR, the primary goal of this PR was to reserve additional, multi-cluster specific extensions, multicluster.x-k8s.io/clusterprofiles/auth/exec/additional-args and multicluster.x-k8s.io/clusterprofiles/auth/exec/additional-envs. This PR only talks about how we handle client.authentication.k8s.io/exec because:

a) it is an existing mechanism defined in previous KEPs that we are supposed to support; and
b) it can also be used to pass cluster-specific information, but it was a bit difficult to use for some, if not many plugins

and the discussion scope about client.authentication.k8s.io/exec in this PR does not go beyond the scope that is basically saying "we are going to support it as prev. KEPs discussed" kind of manner.

With this being said, would it make things easier if I simplify the PR a bit to focus more on the newly reserved extensions and less about client.authentication.k8s.io/exec?

Signed-off-by: michaelawyu <chenyu1@microsoft.com>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 12, 2025
Signed-off-by: michaelawyu <chenyu1@microsoft.com>
@kahirokunn
Copy link
Contributor

Thank you for the clarification! That makes perfect sense to me.
I'm glad to hear that our two PRs can be aligned without conflicts.
Please go ahead with simplifying your PR as you suggested. I appreciate your consideration! 🙏

@corentone
Copy link
Contributor

I approved #5643; I think we can get it in and rebase that one on top. Indeed there is alignment and just the wording is different.
Given this builds on top and the focus is a bit more on adding env/flags, let's merge #5643 and rebase this one on top.

Thank you for applying my suggestions and editing the text! Let's align the PRs content, do a final review and push this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/kep Categorizes KEP tracking issues and PRs modifying the KEP directory ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/multicluster Categorizes an issue or PR as relevant to SIG Multicluster. 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.

7 participants