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

feat: add option to assume-role in route53 #1917

Merged
merged 1 commit into from
Aug 8, 2019

Conversation

moolen
Copy link
Contributor

@moolen moolen commented Jul 23, 2019

What this PR does / why we need it:
This PR adds the field role to the route53 dns provider. It allows users to specify a role per route53 provider which lets them manage zones in other accounts. see discussion at #1274

Which issue this PR fixes: fixes #1274

Special notes for your reviewer:

There is bunch of documentation missing regarding route53 (see #1750). This PR will add a minimum-viable documentation only for this specific field.

The assume-role logic itself is trivial but i really wanted a way to test the behavior (hence the indirection using type sessionProvider).

Release note:

Add option to assume role in Route53 provider

@jetstack-bot jetstack-bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Jul 23, 2019
@jetstack-bot jetstack-bot added area/acme Indicates a PR directly modifies the ACME Issuer code area/acme/dns01 Indicates a PR modifies ACME DNS01 provider code area/api Indicates a PR directly modifies the 'pkg/apis' directory kind/documentation Categorizes issue or PR as related to documentation. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 23, 2019
@jetstack-bot
Copy link
Contributor

Hi @moolen. Thanks for your PR.

I'm waiting for a jetstack or cert-manager 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.

@jetstack-bot jetstack-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 23, 2019
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Jul 23, 2019
@cyrus-mc
Copy link

@moolen I see this hasn't been assigned yet. Where are you in the development? Hoping to get this merged as this is a feature that I require.

Thanks

@moolen
Copy link
Contributor Author

moolen commented Jul 24, 2019

I'm waiting for feedback. I missed the part with /assigning someone 😅

/assign @kragniz

@cyrus-mc
Copy link

I'm waiting for feedback. I missed the part with /assigning someone 😅

/assign @kragniz

No problem. That is why I pinged you. I missed that in my PR as well.

I am going to build your branch and test.

@cyrus-mc
Copy link

@moolen

Test successfully.

@moolen
Copy link
Contributor Author

moolen commented Jul 25, 2019

thanks for your effort! <3

@munnerz
Copy link
Member

munnerz commented Jul 25, 2019

Thanks for testing @cyrus-mc 😄

I'm going to take a look over the implementation for this today. I'm personally not so well versed in AWS APIs, so I'm going to defer API review to someone else who is.. 🙄.

/cc @simonswine
/cc @JoshVanL
/ok-to-test

@jetstack-bot jetstack-bot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jul 25, 2019
@moolen
Copy link
Contributor Author

moolen commented Jul 25, 2019

/test pull-cert-manager-e2e-v1-13 (could not resolve host github.com)

Copy link
Contributor

@simonswine simonswine left a comment

Choose a reason for hiding this comment

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

Looks good in general 👍 , a few questions about the details are inline

@@ -22,6 +22,8 @@ Amazon Route53
secretAccessKeySecretRef:
name: prod-route53-credentials-secret
key: secret-access-key
# you may specify a role to assume
role: arn:aws:iam::XXXXXXXXXXXX:role/cert-manager
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a full blown example would be great here (Including IAM Role configuration, AssumePolicy and so on)

Also pointing out the two options using Instance Profile + Assume Role (useAmbientCerds=false) or AccessKey + SecretKey + AssumeRole. (useAmbientCerds=true)

Copy link
Member

Choose a reason for hiding this comment

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

Yep, are these to auth methods mutually exclusive? If you could update comments on API types to explain this too, we may want to consider restructuring how auth is defined if so to make it fit better.. but let's first document what's what so we are all on the same page 😄

klog.V(5).Infof("assuming role: %s", d.Role)
stsSvc := d.StsProvider(sess)
result, err := stsSvc.AssumeRole(&sts.AssumeRoleInput{
DurationSeconds: aws.Int64(900),
Copy link
Contributor

Choose a reason for hiding this comment

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

Not too sure how long we use that GetSession(). A validation might take longer than 900 seconds and we might not cleanup properly.

It also might be the case that we always get a new session on every reconcile (@munnerz to confirm)

Copy link
Member

Choose a reason for hiding this comment

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

It also might be the case that we always get a new session on every reconcile (@munnerz to confirm)

We do currently get a new session on each reconcile (although we don't always obtain a session on every reconcile, i.e. we only get one if we need to Present or CleanUp the record, so you shouldn't see 10s or hundreds of sessions being created for a single challenge)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A validation might take longer than 900 seconds and we might not cleanup properly.

Good point! 1h is the sdk default and should be enough.

@jetstack-bot jetstack-bot added dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. and removed dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. labels Jul 25, 2019
@jetstack-bot jetstack-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 25, 2019
@jetstack-bot jetstack-bot added dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. and removed dco-signoff: no Indicates that at least one commit in this pull request is missing the DCO sign-off message. labels Jul 25, 2019
@moolen
Copy link
Contributor Author

moolen commented Jul 25, 2019

@simonswine & @munnerz i added docs for auth, policies, api spec and changed the DefaultSessionDuration. PTAL.

@moolen
Copy link
Contributor Author

moolen commented Jul 29, 2019

ping @simonswine @munnerz

@munnerz
Copy link
Member

munnerz commented Aug 2, 2019

Thanks for this 😄

/lgtm
/approve

@jetstack-bot jetstack-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 2, 2019
@jetstack-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: moolen, munnerz

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

@jetstack-bot jetstack-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 2, 2019
@munnerz
Copy link
Member

munnerz commented Aug 2, 2019

Would you mind also editing your original comment and adding a short (one-line) release note for this change?

@retest-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to jetstack).
Review the full test history for this PR.
Silence the bot with an /lgtm cancel comment for consistent failures.

1 similar comment
@retest-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to jetstack).
Review the full test history for this PR.
Silence the bot with an /lgtm cancel comment for consistent failures.

@jetstack-bot jetstack-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Aug 2, 2019
@retest-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to jetstack).
Review the full test history for this PR.
Silence the bot with an /lgtm cancel comment for consistent failures.

@munnerz
Copy link
Member

munnerz commented Aug 2, 2019

Can you run bazel run //hack:update-crds and commit the changes? 😄

/lgtm cancel

@jetstack-bot jetstack-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 2, 2019
Signed-off-by: Moritz Johner <beller.moritz@googlemail.com>
@jetstack-bot jetstack-bot added the area/deploy Indicates a PR modifies deployment configuration label Aug 3, 2019
@moolen
Copy link
Contributor Author

moolen commented Aug 3, 2019

i rebased, updated the CRDs and squashed the commits. that should do it 🤞

*edit
everything green 🎉 @munnerz

@munnerz
Copy link
Member

munnerz commented Aug 8, 2019

/lgtm

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/acme/dns01 Indicates a PR modifies ACME DNS01 provider code area/acme Indicates a PR directly modifies the ACME Issuer code area/api Indicates a PR directly modifies the 'pkg/apis' directory area/deploy Indicates a PR modifies deployment configuration dco-signoff: yes Indicates that all commits in the pull request have the valid DCO sign-off message. kind/documentation Categorizes issue or PR as related to documentation. lgtm Indicates that a PR is ready to be merged. ok-to-test release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support AWS session tokens
7 participants