New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--as-uid flag in kubectl and kubeconfigs. #105794
Conversation
Hi @margocrawf. 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 Once the patch is verified, the new status will be reflected by the 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/test-infra repository. |
/triage accepted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor stuff.
@@ -63,6 +63,13 @@ run_impersonation_tests() { | |||
kube::test::get_object_assert 'csr/foo' '{{len .spec.groups}}' '4' | |||
kube::test::get_object_assert 'csr/foo' '{{range .spec.groups}}{{.}} {{end}}' 'group2 group1 ,,,chameleon system:authenticated ' | |||
kubectl delete -f hack/testdata/csr.yml "${kube_flags_with_token[@]:?}" | |||
|
|||
# --as-uid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a failure case for validation errors.
as-groups: | ||
- group2 | ||
- group1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also impersonate extra and assert it below.
kubectl config view --raw > "${TMPDIR:-/tmp}"/impersonateconfig.yaml | ||
cat << EOF >> "${TMPDIR:-/tmp}"/impersonateconfig.yaml | ||
users: | ||
- name: admin-as-userb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a failing test case for impersonating uid
without user
here as well.
config.AuthInfos["user"] = &clientcmdapi.AuthInfo{ | ||
Impersonate: "user", | ||
ImpersonateUID: "abc123", | ||
ImpersonateGroups: []string{"group-1", "group-2"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra?
This corresponds to previous work to allow impersonating UIDs: * Introduce Impersonate-UID header: kubernetes#99961 * Add UID to client-go impersonation config kubernetes#104483 Signed-off-by: Margo Crawford <margaretc@vmware.com>
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: enj, liggitt, margocrawf The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
kind/feature
What this PR does / why we need it:
Adds --as-uid flag in kubectl and user.as-uid key for kubeconfigs.
This corresponds to previous work to allow impersonating UIDs:
This change includes:
config_flags.go
to allow the as-uid flag to be setapi.AuthInfo
to add the ImpersonateUID fieldv1.AuthInfo
to add ImpersonateUID fieldCertificateSigningRequest
and ensure that the API server populates the correct impersonatedspec.uid
upon creation.Which issue(s) this PR fixes:
This is further work towards #93699
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: