Skip to content

Comments

CORS-2613: AWS: Cross-account Shared VPC Support#7225

Merged
patrickdillon merged 11 commits intoopenshift:masterfrom
patrickdillon:aws-shared-vpc
Jun 12, 2023
Merged

CORS-2613: AWS: Cross-account Shared VPC Support#7225
patrickdillon merged 11 commits intoopenshift:masterfrom
patrickdillon:aws-shared-vpc

Conversation

@patrickdillon
Copy link
Contributor

Adds the ability for the installer to perform operations on a pre-existing private hosted zone which belongs to another account by allowing the ARN for a role to be passed in the install config. When the role is provided, the installer will assume that role when performing operations on the hosted zone.

Enhancement: openshift/enhancements#1397

Adds a hosted zone role field. If provided,
this role will be assumed whenever operations
are performed on the provided hosted zone. This
enables the private hosted zone to belong to a different
account than the rest of the cluster.
If a hosted zone role is specified in the install config, users
must also supply a hosted zone.
The hostedZoneRole will need to be used when destroying the cluster.
Updates the route53 clients to allow passing config with
assume role credentials. This allows the function caller
to determine whether the service should authenticate with
the default credentials or creds for another account.
Add the ability to assume a role in a different account
when destroying records in a private hosted zone. When the
hostedZoneRole is passed in the metadata, that role will be used
when running destroy.
Plumb the hosted zone role through to terraform, so that it can
be used to create records when the hosted zone belongs to another
account.
Adds the ability in terraform to assume a role when performing operations
on a private hosted zone which belongs to a different account than
the rest of the cluster.
Display to users any errors when retrieving a hosted zone
specified in the install config.
When a hostedZoneRole is specified for an AWS
shared VPC install, write it to the DNS config
so it can be used by the cluster ingress operator.
Update tests and mocks due to changes for adding cross-account
private hosted-zone support.
Specifying installconfig.platform.aws.hostedZoneRole and using
a cross-account hosted zone in a shared vpc requires a
TechPreviewNoUpgrade feature gate.
@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 1, 2023
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Jun 1, 2023

@patrickdillon: This pull request references CORS-2613 which is a valid jira issue.

Details

In response to this:

Adds the ability for the installer to perform operations on a pre-existing private hosted zone which belongs to another account by allowing the ARN for a role to be passed in the install config. When the role is provided, the installer will assume that role when performing operations on the hosted zone.

Enhancement: openshift/enhancements#1397

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 openshift-ci bot requested review from mtulio and sadasu June 1, 2023 23:57
@patrickdillon
Copy link
Contributor Author

Supercedes #7161

cfg := &aws.Config{
Credentials: creds,
Region: aws.String(endpoints.UsEast1RegionID),
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason not to use the GetR53ClientCfg method?


// The private hosted zone (phz) may belong to a different account,
// in which case we need a separate client.
phzClient := publicClient
Copy link
Contributor

Choose a reason for hiding this comment

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

Not gonna lie, this is a bit hard to read/validate with the back-and-forth of the clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe something like this would be easier to read?

	// The private hosted zone (phz) may belong to a different account,
	// in which case we need a separate client.
        publicZoneClient  := route53.New(session)
	privateZoneClient := route53.New(session)

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 it does but no need to change it unless you also have to make other changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I am going to have a follow up PR to address this and @mtulio's feedback. I also think I should update the in-repo docs with an example install config

@r4f4
Copy link
Contributor

r4f4 commented Jun 2, 2023

/approve

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: r4f4

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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 Jun 2, 2023
@patrickdillon
Copy link
Contributor Author

Successfully tested this using: cluster bot build 4.14.0-0.nightly-2023-05-31-080250,openshift/cluster-ingress-operator#928,openshift/cluster-config-operator#314

@patrickdillon
Copy link
Contributor Author

I missed adding credentialmode validation. This only works in Passthrough or Manual mode. Created https://issues.redhat.com/browse/CORS-2673 to complete that work separately.

@barbacbd
Copy link
Contributor

barbacbd commented Jun 6, 2023

/lgtm

Patrick noted that another PR would be open to address the issues above.

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

r4f4 commented Jun 6, 2023

/test e2e-aws-ovn-single-node

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 6, 2023

@patrickdillon: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/okd-e2e-aws-ovn f3c2b06 link false /test okd-e2e-aws-ovn
ci/prow/okd-e2e-aws-ovn-upgrade f3c2b06 link false /test okd-e2e-aws-ovn-upgrade
ci/prow/okd-scos-e2e-aws-ovn f3c2b06 link false /test okd-scos-e2e-aws-ovn
ci/prow/e2e-aws-ovn-single-node f3c2b06 link false /test e2e-aws-ovn-single-node

Full PR test history. Your PR dashboard.

Details

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.

@patrickdillon
Copy link
Contributor Author

/skip
Non-required tests for okd and sno are failing on flakes

@yunjiang29
Copy link
Contributor

pre-merge tests get passed.
Tested against build build 4.14.0-0.nightly-2023-06-07-235624,openshift/cluster-ingress-operator#928,openshift/installer#7225:

  • New feature works as expected, user can create a cross-account shared VPC cluster
  • No regression issue found

@yunjiang29
Copy link
Contributor

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Jun 8, 2023
var zonePath *field.Path
var zone *route53.HostedZone

errors := field.ErrorList{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change to replace errors with errs really necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using the errors variable name conflicted with the errors package imported in this file. I should have documented this in the commit message.

@deepsm007
Copy link
Contributor

/label jira/valid-bug

@openshift-ci openshift-ci bot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label Jun 12, 2023
@patrickdillon
Copy link
Contributor Author

/refresh

@patrickdillon patrickdillon merged commit 5ece3e4 into openshift:master Jun 12, 2023
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. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. 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. 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