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

Instance roles for service accounts (IRSA) contd #10756

Merged
merged 8 commits into from
Mar 19, 2021

Conversation

olemarkus
Copy link
Member

@olemarkus olemarkus commented Feb 7, 2021

This is a continuation of #9271

The workflow is changed a little bit. Users now only need to provide a publicsDataStore VFS (only S3 works now) and kOps will handle the rest.

This PR also works with #9352. dns-controller gets a dedicated IAM role and can assume it using the projected tokens.

Further work:

  • Unfortunately, I could not figure out a way to make the uploaded files public so that is still a manual step.
  • With the number of addons we'd like to provision roles for, the remap logic probably doesn't scale that well. But we can improve this using the IRSA webhook.

@k8s-ci-robot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 7, 2021
@olemarkus olemarkus requested review from justinsb and johngmyers and removed request for justinsb February 7, 2021 20:30
@k8s-ci-robot k8s-ci-robot requested review from hakman and zetaab February 7, 2021 20:31
@k8s-ci-robot k8s-ci-robot added area/api area/provider/aws Issues or PRs related to aws provider approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 7, 2021
@olemarkus
Copy link
Member Author

/cc @rifelpet

@olemarkus olemarkus marked this pull request as ready for review February 9, 2021 22:01
@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 Feb 9, 2021
@olemarkus
Copy link
Member Author

Added in using https://api. as issuer as k8s 1.20 requires this.

The broken test had to be removed as PublicJWKS won't work with FS VFS. Since we try to call the https url to get the cert. If this gets merged, we can do a kubetest of this. We have the rights to write the jwks files to a public store, I believe (we are writing other assets somewhere).

The commits are a bit of a mess, so I should clean this up first.
But reviews would be welcomed.

@olemarkus
Copy link
Member Author

/test pull-kops-e2e-kubernetes-aws

@olemarkus
Copy link
Member Author

/kind office-hours

@olemarkus olemarkus force-pushed the irsa branch 2 times, most recently from be328f1 to 941c49e Compare February 19, 2021 20:08
@k8s-ci-robot k8s-ci-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2021
@olemarkus olemarkus requested a review from justinsb February 27, 2021 10:16
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 8, 2021
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 9, 2021
pkg/model/awsmodel/oidc_provider.go Show resolved Hide resolved
SigningKey: skTask,
}

discovery, err := buildDicoveryJSON(serviceAccountIssuer)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: typo "dicovery"

Contents: fi.NewBytesResource(discovery),
Lifecycle: b.Lifecycle,
Location: fi.String("oidc/.well-known/openid-configuration"),
Name: fi.String("discovery.json"),
Copy link
Member

Choose a reason for hiding this comment

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

Nit: maybe public-oidc-configuration (and similar prefix on keys.json). It matters most for the terraform, I suspect (and primarily only optics there)

}

type KeyResponse struct {
Keys []jose.JSONWebKey `json:"keys"`
Copy link
Member

Choose a reason for hiding this comment

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

Nit: are taking the dependency on the jose library only for the structs? Should we just embed them?

@@ -35,7 +35,7 @@ type IAMOIDCProvider struct {
Lifecycle *fi.Lifecycle

ClientIDs []*string
Thumbprints []fi.Resource
Thumbprints []*string
Copy link
Member

Choose a reason for hiding this comment

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

I thought we needed this for the initial preview... I guess if tests are passing then we don't (or we have a gap in our tests!)

Copy link
Member Author

Choose a reason for hiding this comment

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

We used to because the thumbprint came from the cluster CA cert. Now they are just well-known strings.

I suspect this may be something we can change back in order to support anonymousauth+public apiserver as oidc provider.

@@ -53,20 +53,6 @@ func TestBootstrapChannelBuilder_BuildTasks(t *testing.T) {
runChannelBuilderTest(t, "awsiamauthenticator", []string{"authentication.aws-k8s-1.12"})
}

func TestBootstrapChannelBuilder_PublicJWKS(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Is there are reason to drop this test?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. This PR only supports using s3 as store for jwks, so this fails because filesystem VFS cannot be used for https.

@justinsb
Copy link
Member

Had some questions/nits but this LGTM. As this is feature-flagged, I propose we merge and then I'll probably send a follow-on PR to try to e.g. add the test back if we do need it.

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 19, 2021
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Mar 19, 2021
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 19, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, rifelpet

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

@k8s-ci-robot k8s-ci-robot merged commit ac657c4 into kubernetes:master Mar 19, 2021
justinsb added a commit to justinsb/kops that referenced this pull request Mar 20, 2021
We removed them from kubernetes#10756, but they can be re-added.
justinsb added a commit to justinsb/kops that referenced this pull request Mar 20, 2021
We removed them from kubernetes#10756, but they can be re-added.
justinsb added a commit to justinsb/kops that referenced this pull request Mar 21, 2021
We removed them from kubernetes#10756, but they can be re-added.
justinsb added a commit to justinsb/kops that referenced this pull request Mar 21, 2021
We removed them from kubernetes#10756, but they can be re-added.
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. area/api area/provider/aws Issues or PRs related to aws provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/office-hours lgtm "Looks good to me", indicates that a PR is ready to be merged. 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.

5 participants