Skip to content
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

✨ Feature: Re-enable webhook token authentication #3096

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

ajwdev
Copy link
Contributor

@ajwdev ajwdev commented Mar 21, 2024

Summary

This simply re-enables Kubernetes Webhook Token Authentication that was previously commented out.

I verified it worked in a local setup against a custom authenticator. See below:

$ \cat me.kubeconfig
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://localhost:6443/clusters/root
  name: workspace.kcp.io/current
- cluster:
    insecure-skip-tls-verify: true
    server: https://localhost:6443/clusters/root
  name: workspace.kcp.io/previous
contexts:
- context:
    cluster: workspace.kcp.io/current
    user: test
  name: workspace.kcp.io/current
- context:
    cluster: workspace.kcp.io/previous
    user: test
  name: workspace.kcp.io/previous
current-context: workspace.kcp.io/current
kind: Config
preferences: {}
users:
- name: test
  user:
    token: eyJhbGciO <SNIP> RVA


$ KUBECONFIG=me.kubeconfig kubectl kcp ws create foo --enter
error: workspaces.tenancy.kcp.io is forbidden: User "andrewwi@vmware.com" cannot create resource "workspaces" in API group "tenancy.kcp.io" at the cluster scope: access denied
zsh: exit 1     KUBECONFIG=me.kubeconfig kubectl kcp ws create foo --enter

$ \cat admin.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: me-admin
subjects:
- kind: User
  name: andrewwi@vmware.com
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
  
  
$ KUBECONFIG=.kcp/admin.kubeconfig kubectl apply -f admin.yaml
clusterrolebinding.rbac.authorization.k8s.io/me-admin created

$ KUBECONFIG=me.kubeconfig kubectl kcp ws create foo --enter
Workspace "foo" (type root:organization) created. Waiting for it to be ready...
Workspace "foo" (type root:organization) is ready to use.
Current workspace is "root:foo" (type root:organization).

KCP was started with the following flags:

bin/kcp start --authentication-token-webhook-version=v1 --authentication-token-webhook-config-file=/tmp/webhook.yaml

Release Notes

- Re-enable Kubernetes Webhook Token Authentication

@kcp-ci-bot kcp-ci-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: no Indicates the PR's author has not signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Mar 21, 2024
@ajwdev ajwdev changed the title ✨ feature: Re-enable webhook token authentication ✨ Feature: Re-enable webhook token authentication Mar 21, 2024
@kcp-ci-bot kcp-ci-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 21, 2024
@kcp-ci-bot
Copy link
Contributor

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

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.

Signed-off-by: Andrew Williams <andrewwi@vmware.com>
@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 Mar 21, 2024
@ajwdev ajwdev marked this pull request as draft March 21, 2024 22:02
@kcp-ci-bot kcp-ci-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 21, 2024
@ajwdev ajwdev marked this pull request as ready for review March 21, 2024 22:56
@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 Mar 21, 2024
@palnabarun
Copy link
Member

/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 Mar 23, 2024
@mjudeikis
Copy link
Contributor

/retest

Copy link
Member

@embik embik left a comment

Choose a reason for hiding this comment

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

lgtm, leaving second approval to another maintainer.

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 25, 2024
@kcp-ci-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2ec6497d7997b94a8ab28564a34bdeb1ca37f5ee

@mjudeikis
Copy link
Contributor

/approve

@kcp-ci-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjudeikis

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 /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 Mar 25, 2024
@kcp-ci-bot kcp-ci-bot merged commit de407f4 into kcp-dev:main Mar 25, 2024
14 of 15 checks passed
@ajwdev ajwdev deleted the ajw/reenable-webhook-auth branch March 26, 2024 22:11
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. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants