Skip to content

Comments

DNS: Add awsPrivateHostedZoneRole#1460

Merged
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
patrickdillon:aws-shared-vpc
May 30, 2023
Merged

DNS: Add awsPrivateHostedZoneRole#1460
openshift-merge-robot merged 1 commit intoopenshift:masterfrom
patrickdillon:aws-shared-vpc

Conversation

@patrickdillon
Copy link
Contributor

Adds a field to the DNS config to hold a role to assume when performing cross- account installs in an AWS shared VPC
environment.

openshift/enhancements#1397

@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 16, 2023

Hello @patrickdillon! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 16, 2023
@openshift-ci openshift-ci bot requested review from adambkaplan and knobunc May 16, 2023 14:42
@patrickdillon
Copy link
Contributor Author

cc @mrunalp @Miciah @gcs278 @mtulio

@patrickdillon
Copy link
Contributor Author

We are still deciding between whether this should live in cluster infrastructure or dns. Currently this only has the DNS implementation, which I believe is preferred.

If it's helpful, I can also add the infrastructure implementation in a separate commit. Please LMK if that would be helpful and I can add it.

@openshift-ci openshift-ci bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 17, 2023
@mrunalp
Copy link
Member

mrunalp commented May 22, 2023

@deads2k ptal.

Copy link
Contributor

@deads2k deads2k left a comment

Choose a reason for hiding this comment

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

a few additional changes please.

// +kubebuilder:validation:XValidation:rule="has(self.platform) && self.platform == 'AWS' ? has(self.aws) : !has(self.aws)",message="aws configuration is required when platform is AWS, and forbidden otherwise"
type DNSPlatformSpec struct {
// type is the underlying infrastructure provider for the cluster.
// Allowed values: "AWS".
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@deads2k suggested allowed values be AWS and "", but that seems to contrast with the validation suggested here, which is what I went with.

The intent being: dns.spec.platform is optional, but if it is provided dns.spec.platform.type is required

Copy link
Contributor

Choose a reason for hiding this comment

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

Empty needs to be allowed to handle upgrade cases.

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 have handled this in the code, but we couldn't figure out a test case (which you mentioned in slack). None of the fields in this config are mutable (although I'm not certain that is enforced).

Was trying a test like this:

  onUpdate:
  - name: Should allow empty platform on upgrade
    initial: |
      apiVersion: config.openshift.io/v1
      kind: DNS
      spec:
        zone:
          id: foo
    updated: |
      apiVersion: config.openshift.io/v1
      kind: DNS
      spec:
        zone:
          id: bar
    expected: |
      apiVersion: config.openshift.io/v1
      kind: DNS
      spec:
        zone:
          id: bar
        platform:
          type: ""

But that is failing

[FAILED] the following fields were expected to match but did not:
[(spec.platform/spec.platform) (spec.zone/spec.zone)]

We're not really sure how to write the upgrade test

@patrickdillon
Copy link
Contributor Author

@ingvagabund and @deads2k thanks for the review. I have addressed the feedback (except I still need to add the integration tests), but have a few resulting questions. Thanks!

@patrickdillon patrickdillon force-pushed the aws-shared-vpc branch 2 times, most recently from 731d048 to b68af6b Compare May 26, 2023 18:56
@patrickdillon
Copy link
Contributor Author

@ingvagabund @deads2k I think all feedback has been addressed (except one question about tests)

@deads2k
Copy link
Contributor

deads2k commented May 30, 2023

/approve
/assign @Miciah

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 30, 2023
Comment on lines 54 to 73
- name: Should not be able to specify different type and platform
initial: |
apiVersion: config.openshift.io/v1
kind: DNS
spec:
platform:
type: ""
aws:
privateZoneIAMRole: arn:aws:iam:123456789012:role/foo
expectedError: "Invalid value: \"object\": aws configuration is required when platform is AWS, and forbidden otherwise"
- name: Should not be able to specify different type and platform
initial: |
apiVersion: config.openshift.io/v1
kind: DNS
spec:
platform:
type: ""
aws:
privateZoneIAMRole: arn:aws:iam:123456789012:role/foo
expectedError: "Invalid value: \"object\": aws configuration is required when platform is AWS, and forbidden otherwise"
Copy link
Contributor

Choose a reason for hiding this comment

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

You have the same test case twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines +60 to +77
enum:
- ""
- AWS
- Azure
- BareMetal
- GCP
- Libvirt
- OpenStack
- None
- VSphere
- oVirt
- IBMCloud
- KubeVirt
- EquinixMetal
- PowerVS
- AlibabaCloud
- Nutanix
- External
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 going to cause confusing error messages, or does the x-kubernetes-validations rule take precedence and prevent the enum rule from causing unsupported values to be printed in error messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the test, the x-kubernetes-validations message takes precedence, so I think we're ok.

Adds a field to the DNS config to hold
a role to assume when performing cross-
account installs in an AWS shared VPC
environment.

Co-authored-by: Grant Spence <gcs278@vt.edu>
Co-authored-by: deads2k
@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 30, 2023

@patrickdillon: all tests passed!

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.

@Miciah
Copy link
Contributor

Miciah commented May 30, 2023

/lgtm

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

openshift-ci bot commented May 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k, Miciah, patrickdillon

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

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. lgtm 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.

7 participants