-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
user-configurable IAM roles for ServiceAccounts #11016
Conversation
3c22b11
to
04e0253
Compare
/retest |
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.
I don't see the OIDC provider being created in the integration test's terraform output. any idea why that is?
pkg/apis/kops/validation/legacy.go
Outdated
} | ||
if sa.IAMPolicyARN != "" && sa.InlinePolicy != "" { | ||
allErrs = append(allErrs, field.Forbidden(p, "cannot set both inlinePolicy and iamPolicyARN")) | ||
} |
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.
nit, might be worth validating the policy arn:
kops/pkg/apis/kops/validation/instancegroup.go
Lines 267 to 271 in b03b50f
parsedARN, err := arn.Parse(instanceProfileARN) | |
if err != nil || !strings.HasPrefix(parsedARN.Resource, "instance-profile/") { | |
allErrs = append(allErrs, field.Invalid(fldPath.Child("profile"), instanceProfileARN, | |
"Instance Group IAM Instance Profile must be a valid aws arn such as arn:aws:iam::123456789012:instance-profile/KopsExampleRole")) | |
} |
|
The iam roles' assume role policies reference |
Not really. Those two flags would almost always be used together. It depends a bit what we want here. My idea was to add an Question is if we want to force that? Or do we want users to enable IRSA, but not for the kops addons? Do we want users to enable IRSA individually on all addons? |
Hm for migration purposes I could see the benefit of being able to migrate individual addons to IRSA. It'd be safer to migrate one at a time rather than be forced to do them all at once. I do like the idea of an |
c7f8abc
to
93fbd3b
Compare
/retest |
Does Cluster API or any of the relevant Cluster API providers support similar functionality? If so we could consider modeling our design off of theirs to reduce friction when adopting Cluster API support. |
A summary of the discussion from office hours:
As an aside, I think if we move |
Amended according to our discussions today. Note that right now, one can configure this without enabling AWS OIDC provider. Once that is configurable, we may want to add validation for that. Easy thing that can be done in a follow-up. |
/test pull-kops-e2e-cni-amazonvpc |
Why use the word "mappings" for these? That word appears to be overly uninformative as to what is being provisioned. What is being provisioned is something more like "permissions" or "roles". They're the out-of-cluster analogue of |
Okay, at least that word isn't exposed through the API. |
featureflag.ParseFlags("+PublicJWKS") | ||
unsetFeatureFlags := func() { | ||
featureflag.ParseFlags("-PublicJWKS") | ||
} |
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.
Would be good to not require the feature flag. Not blocking.
06851c5
to
cf410b1
Compare
Apply suggestions from code review Co-authored-by: John Gardiner Myers <[email protected]>
pkg/apis/kops/cluster.go
Outdated
PolicyARNs []string `json:"policyARNs,omitempty"` | ||
InlinePolicy string `json:"inlinePolicy,omitempty"` |
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.
Could use comments on these.
UseServiceAccountIAM = New("UseServiceAccountIAM", Bool(false)) | ||
// PublicJWKS enables public jwks access. This is generally not as secure as republishing. | ||
// PublicJWKS enables public jwks access. |
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.
These changes are technically out of scope of this PR. Not blocking.
@@ -124,26 +125,64 @@ func (b *IAMModelBuilder) Build(c *fi.ModelBuilderContext) error { | |||
} | |||
} | |||
|
|||
iamSpec := b.Cluster.Spec.IAM | |||
if iamSpec != nil { | |||
for _, sa := range iamSpec.ServiceAccountExternalPermissions { |
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.
Do we have code to delete the relevant AWS objects when items are removed from this list?
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.
No, as usual, kOps is quite bad at this. I am wondering if we need a more generic solution that. Maybe we can tag all RenderAWS
-created resources with kops.k8s.io/task=taskname
and then at the end of cloudup, remove all resources that match tasks that wasn't created.
I think we need to look at that separately.
if iamSpec != nil { | ||
for _, sa := range iamSpec.ServiceAccountExternalPermissions { | ||
var p *iam.Policy | ||
aws := sa.AWS |
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.
We might consider handling aws == nil
to save overlooking when someone adds a second external system.
Co-authored-by: John Gardiner Myers <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johngmyers 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 |
This PR allows users to configure IRSA for their own workloads. It is the kOps equivalent of https://eksctl.io/usage/iamserviceaccounts/#usage-with-config-files
/cc @justinsb @rifelpet