-
Notifications
You must be signed in to change notification settings - Fork 187
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
Implement user impersonation #349
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config/crd/bases/kustomize.toolkit.fluxcd.io_kustomizations.yaml
Outdated
Show resolved
Hide resolved
stefanprodan
reviewed
Jun 1, 2021
stefanprodan
reviewed
Jun 1, 2021
stefanprodan
reviewed
Jun 2, 2021
stefanprodan
changed the title
Implement multi-tenancy in kustomize-controller
Implement user impersonation
Jun 4, 2021
stefanprodan
reviewed
Jun 4, 2021
somtochiama
force-pushed
the
user-multi-tenancy
branch
2 times, most recently
from
June 8, 2021 13:30
b43e78f
to
dfb22bd
Compare
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
somtochiama
force-pushed
the
user-multi-tenancy
branch
from
June 8, 2021 14:24
dfb22bd
to
f2486d1
Compare
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
Signed-off-by: Somtochi Onyekwere <somtochionyekwere@gmail.com>
hiddeco
reviewed
Sep 7, 2021
if enableUserImpersonation { | ||
var user string | ||
if kustomization.Spec.Principal == nil { | ||
user = fmt.Sprintf("flux:user:%s:%s", kustomization.Namespace, pkgclient.DefaultUser) |
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.
flux:user:%s:%s
(and other strings like this) should be defined, if possible with helper utils, in the fluxcd/pkg
library.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proof of concept for fluxcd/flux2#582
TLDR: This pull request enables the controller to impersonate a different user when applying and validating manifests from Sources. This reduces the privileges needed by the controller serviceaccount and also moves the ball towards multi-tenancy.
Changes
--user-impersonation
flag.Principal
field is added to the the API as an alternative toServiceAccountName
.The kind can be either
User
orServiceAccount
.When Principal is not set and the
--user-impersonation
flag is set, a default userreconciler
is used.Token impersonation will still be used if:
user-impersonation
flag is not setserviceAccountName
is set andprincipal
is unset regardless of flag passed in by usersWhen both
serviceAccountName
andprincipal
is set, the flag set by the user determines the type of impersonation. If--user-impersonation
isn't set, token impersonation is userFor remote clusters, user impersonation is only enabled when the
user-impersonation
flag is set andprincipal
is also set.Example
The user
flux:user:{{namespace}}:{{spec.user}}
in this caseflux:user:tenant-a:admin
hascluster-admin
permissions only within thetenant-a
namespace and the kustomize-controller can only apply manifest in thetenant-a
namespace when impersonating this user.Feedback & Testing
Signed-off-by: Somtochi Onyekwere somtochionyekwere@gmail.com