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

NE-1323: Add AWS RoleARN for Shared VPC support #195

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

gcs278
Copy link
Contributor

@gcs278 gcs278 commented Jun 26, 2023

Adds the ability to specify a RoleARN to create Route 53 DNS records in a different AWS Account. Supports Shared VPC scenario.

The new API is propagated to the existing external-dns argument --aws-assume-role.

Epic Link: https://issues.redhat.com/browse/NE-1299
EP PR: openshift/enhancements#1436

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 26, 2023
Copy link
Contributor

@alebedev87 alebedev87 left a comment

Choose a reason for hiding this comment

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

I believe you need to add sts:AssumeRole to the AWS CredentilasRequest too.

api/v1beta1/externaldns_types.go Outdated Show resolved Hide resolved
@@ -194,6 +194,10 @@ func (b *externalDNSContainerBuilder) fillProviderAgnosticFields(seq int, zone s
args = append(args, "--ignore-hostname-annotation")
}

if b.externalDNS.Spec.AWSRoleARN != nil {
args = append(args, fmt.Sprintf("--aws-assume-role=%s", *b.externalDNS.Spec.AWSRoleARN))
Copy link
Contributor

@alebedev87 alebedev87 Jun 27, 2023

Choose a reason for hiding this comment

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

I'm wondering whether we should expose the external ID as the API knob too. ExternalDNS has a dedicated flag for it. I see that we didn't bother with it in C-I-O.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good point, I hadn't heard of the ExternalID until now. But, if we didn't bother with it in CIO, I wonder if we should bother with it here. I can point it out to the Shared VPC folks so they are aware something like this exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@alebedev87
Copy link
Contributor

alebedev87 commented Jun 27, 2023

@gcs278 : what are your thoughts about the testing of this feature?

@gcs278 gcs278 changed the title WIP: Proof of concept for Shared VPC support [WIP] NE-1323: Proof of concept for Shared VPC support Jun 30, 2023
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 30, 2023
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jun 30, 2023

@gcs278: This pull request references NE-1323 which is a valid jira issue.

In response to this:

Added an API for AWSRoleArn and propagated to the argument --aws-assume-role.

Needs work, review, testing, enhancement, jira.

But I just confirmed this POC works with a real Shared-VPC cluster.

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.

@gcs278 gcs278 changed the title [WIP] NE-1323: Proof of concept for Shared VPC support [WIP] NE-1323: Shared VPC support Jun 30, 2023
@gcs278 gcs278 changed the title [WIP] NE-1323: Shared VPC support NE-1323: Add AWS RoleARN for Shared VPC support Jul 7, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 7, 2023
api/v1beta1/externaldns_types.go Show resolved Hide resolved
api/v1beta1/webhook_test.go Show resolved Hide resolved
@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 7, 2023

@gcs278: This pull request references NE-1323 which is a valid jira issue.

In response to this:

Adds the ability to specify a RoleARN to create Route 53 DNS records in a different AWS Account. Supports Shared VPC scenario.

The new API is propagated to the existing external-dns argument --aws-assume-role.

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.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Jul 7, 2023

@gcs278: This pull request references NE-1323 which is a valid jira issue.

In response to this:

Adds the ability to specify a RoleARN to create Route 53 DNS records in a different AWS Account. Supports Shared VPC scenario.

The new API is propagated to the existing external-dns argument --aws-assume-role.

Epic Link: https://issues.redhat.com/browse/NE-1299

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.

@gcs278
Copy link
Contributor Author

gcs278 commented Jul 7, 2023

@gcs278 : what are your thoughts about the testing of this feature?

I would like to E2E test it, but we need a E2E test job that stands up a shared VPC in Account A, and stands up a cluster with a role ARN in Account B. My assumption is that we need a new, seperate E2E job that does these things as prerequisites, and separately runs a subset of Shared VPC E2E tests.

I'm waiting on https://issues.redhat.com/browse/CORS-2650 to finish up, as this story will hopefully paving a way, creating items in the CI Step Registry that we could potentially leverage.

Do you have any thoughts?

@alebedev87 alebedev87 self-assigned this Jul 7, 2023
@gcs278 gcs278 force-pushed the shared-vpc branch 3 times, most recently from c3b0f26 to 2c7e1d8 Compare July 17, 2023 20:39
@gcs278
Copy link
Contributor Author

gcs278 commented Jul 17, 2023

@alebedev87 thanks for your time. Update:
https://github.com/openshift/external-dns-operator/compare/840c17c4d4ac43b3a7d0bcc51b5cf04b4fe5056a..2c7e1d8c69ab95cb7049fb54b0b8db89b4629edf

  1. Moved CRD validation to webhook to use IsARN() from AWS SDK
  2. Made spec.provider.aws.credentials optional in CRD
  3. Added another webhook validation test for RoleARN in openshift platform
  4. Fixed broken unit tests

Copy link
Contributor Author

@gcs278 gcs278 left a comment

Choose a reason for hiding this comment

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

Thanks for the review @alebedev87

I'm working on E2E tests at the moment. I may add them to this PR if it's still open, but I don't think we have to hold this PR up for the E2E tests.

api/v1beta1/externaldns_types.go Outdated Show resolved Hide resolved
api/v1beta1/externaldns_types.go Outdated Show resolved Hide resolved
api/v1beta1/externaldns_webhook.go Outdated Show resolved Hide resolved
- '{{.Name}}.mydomain.net'
```

**Note**: Due to a limitation of the `v1beta1` API requiring the `credentials` field, OpenShift users will be required
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay thanks. I'll leave what I have now, and possibly open another PR later with details on CredentialsRequest to keep this PR cleaner.

docs/usage.md Outdated Show resolved Hide resolved
Comment on lines 59 to 63
AWS: &ExternalDNSAWSProviderOptions{
AssumeRole: &ExternalDNSAWSAssumeRoleOptions{
ARN: pointer.String("arn:aws:iam::123456789012:role/foo"),
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is for OpenShift, and the CRDs aren't involved, just the webhook. The webhook doesn't validate credentials for Openshift. The CRDs were the issue due to +required on the Credentials field.

The webhook works without issue, but use of the CRD would require an empty credentials field.

@alebedev87
Copy link
Contributor

alebedev87 commented Sep 6, 2023

I'm working on E2E tests at the moment. I may add them to this PR if it's still open, but I don't think we have to hold this PR up for the E2E tests.

Agree, we don't need to hold this PR. Do you plan to add e2e test in another PR then?

@alebedev87
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 8, 2023
@gcs278
Copy link
Contributor Author

gcs278 commented Sep 8, 2023

/test verify

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2023
@gcs278
Copy link
Contributor Author

gcs278 commented Sep 11, 2023

@alebedev87 forgot to run make manifests

@alebedev87
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2023
Adds the ability to specify a Role ARN to create Route 53 DNS
records in a different AWS Account. Supports Shared VPC scenario.

`api/v1beta1/externaldns_types.go`: Add AssumeRole API
`api/v1beta1/webhook_test.go`: Add AssumeRole WebHook Validation test
`api/v1beta1/zz_generated.deepcopy.go`: Generated
`bundle/manifests/externaldns.olm.openshift.io_externaldnses.yaml`:
Generated
`config/crd/bases/externaldns.olm.openshift.io_externaldnses.yaml`:
Generated
`docs/usage.md`: Add section on AWS Assume Role
`pkg/operator/controller/externaldns/credentials_request.go`: Add
sts:AssumeRole to credential requests
`pkg/operator/controller/externaldns/deployment_test.go`: Unit test
`desiredExternalDNSDeployment`
`pkg/operator/controller/externaldns/pod.go`: Add --aws-assume-role
argument with AssumeRole ARN value
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2023
@alebedev87
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 11, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alebedev87

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 11, 2023
@alebedev87
Copy link
Contributor

Cluster installation failed.

/test e2e-gcp-operator

@gcs278
Copy link
Contributor Author

gcs278 commented Sep 12, 2023

cluster install failure
/test e2e-gcp-operator

@CFields651
Copy link

/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Sep 12, 2023
@melvinjoseph86
Copy link

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Sep 13, 2023
@gcs278
Copy link
Contributor Author

gcs278 commented Sep 13, 2023

Cluster install failed
/test e2e-gcp-operator

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 13, 2023

@gcs278: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@ahardin-rh
Copy link

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Sep 18, 2023
@openshift-merge-robot openshift-merge-robot merged commit 5e964d7 into openshift:main Sep 18, 2023
9 checks passed
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. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants