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

Use proxied trusted request header to filter namespaces list in multi-tenant clusters #8526

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mecampbellsoup
Copy link

@mecampbellsoup mecampbellsoup commented Dec 4, 2023

Resolves #8496.

Also modifies the behavior of Impersonation such that a request header Authorization: Bearer foo token is not required. We need this change because we want to combine in-cluster configuration with trusted Impersonate* headers set by our authenticating reverse proxy which sits in front of dashboard api, and it seemed silly to have to hardcode inside my ingress the value of the dashboard api service account's token.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Dec 4, 2023
@k8s-ci-robot
Copy link
Contributor

Welcome @mecampbellsoup!

It looks like this is your first PR to kubernetes/dashboard 🎉. 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/dashboard 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 k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 4, 2023
@mecampbellsoup mecampbellsoup changed the title fix(helm-chart): Use app.image.pullSecrets in api deployment template Use proxied trusted request header to filter namespaces list in multi-tenant clusters Dec 4, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mecampbellsoup
Once this PR has been reviewed and has the lgtm label, please assign maciaszczykm for approval. For more information see the Kubernetes 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

@mecampbellsoup mecampbellsoup force-pushed the mc/8496/dynamic-namespaces-fallback branch from db5b619 to fe81d96 Compare December 4, 2023 13:54
@mecampbellsoup mecampbellsoup marked this pull request as ready for review December 4, 2023 21:26
@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 Dec 4, 2023
// If Impersonate* header(s) provided, but Authorization token is missing,
// fallback to in-cluster config by reading the serviceaccount token from the filesystem
var dat, _ = os.ReadFile("/var/run/secrets/kubernetes.io/serviceaccount/token")
token = string(dat)
Copy link
Author

Choose a reason for hiding this comment

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

@floreks is there a way to activate Impersonation when no explicit Authorization: Bearer token has been included in the request, i.e. "fallback" to using in-cluster config if the reverse proxy has added Impersonation headers only?

Copy link
Author

Choose a reason for hiding this comment

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

Note: would also like to cache the result of os.ReadFile so as to not read from the filesystem on every request.

authInfo.Impersonate = impersonationHeader

//Check for impersonated groups
if groupsImpersonationHeader := req.Request.Header["Impersonate-Group"]; len(groupsImpersonationHeader) > 0 {
Copy link
Author

Choose a reason for hiding this comment

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

I changed this to support both of the following formats:

Impersonate-Group: one,two,three

-- as well as...

Impersonate-Group:one
Impersonate-Group:two
Impersonate-Group:three

@mecampbellsoup
Copy link
Author

@desaintmartin @maciaszczykm do you guys expect to have a chance to review this in the near future? Thanks 😄

@mecampbellsoup mecampbellsoup force-pushed the mc/8496/dynamic-namespaces-fallback branch from f6833e8 to 95c8d0d Compare December 20, 2023 14:43
@mecampbellsoup
Copy link
Author

@desaintmartin @maciaszczykm do you guys expect to have a chance to review this in the near future? Thanks 😄

Hey guys! Just following up - what can I do to get some 👀 and feedback on this?! Thank you 🙏

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 15, 2024
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 16, 2024
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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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.

[Multi-Tenant Auth] Ability to customize the namespaces dropdown behavior/contents
3 participants