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-1530: IngressController LB Subnet Selection in AWS #1841

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gcs278
Copy link
Contributor

@gcs278 gcs278 commented Apr 1, 2024

Allows users to specify subnets (i.e. Availability Zones) for IngressControllers using load balancers in AWS. Introduce
under the IngressControllerLBSubnetsAWS FeatureGate. Works for both CLB and NLBs.

Enhancement: openshift/enhancements#1595
Epic: https://issues.redhat.com/browse/NE-705

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 1, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 1, 2024

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

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the epic to target either version "4.16." or "openshift-4.16.", but it targets "openshift-4.13" instead.

In response to this:

Allows users to specify subnets (i.e. Availability Zones) for IngressControllers in AWS. Introduce under the
AWSLoadBalancerSubnetSelection FeatureGate. Works for both CLB and NLBs.

Enhancement: openshift/enhancements#1595
RFE: https://issues.redhat.com/browse/RFE-1717.

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Contributor

openshift-ci bot commented Apr 1, 2024

Hello @gcs278! 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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Apr 1, 2024
@openshift-ci openshift-ci bot requested review from deads2k and JoelSpeed April 1, 2024 00:11
@gcs278 gcs278 changed the title NE-705: Add API for AWS LB Subnet Selection NE-1530: Add API for AWS LB Subnet Selection Apr 1, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 1, 2024

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

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

Allows users to specify subnets (i.e. Availability Zones) for IngressControllers in AWS. Introduce under the
AWSLoadBalancerSubnetSelection FeatureGate. Works for both CLB and NLBs.

Enhancement: openshift/enhancements#1595
RFE: https://issues.redhat.com/browse/RFE-1717.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 1, 2024

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

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

Allows users to specify subnets (i.e. Availability Zones) for IngressControllers in AWS. Introduce under the
AWSLoadBalancerSubnetSelection FeatureGate. Works for both CLB and NLBs.

Enhancement: openshift/enhancements#1595
Epic: https://issues.redhat.com/browse/NE-705

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 openshift-eng/jira-lifecycle-plugin repository.

@gcs278 gcs278 changed the title NE-1530: Add API for AWS LB Subnet Selection [WIP] NE-1530: Add API for AWS LB Subnet Selection Apr 3, 2024
@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 Apr 3, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2024
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 3, 2024
@gcs278 gcs278 changed the title [WIP] NE-1530: Add API for AWS LB Subnet Selection NE-1530: IngressController LB Subnet Selection in AWS Apr 3, 2024
@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 Apr 3, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Apr 3, 2024

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

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

Allows users to specify subnets (i.e. Availability Zones) for IngressControllers using load balancers in AWS. Introduce
under the IngressControllerLBSubnetsAWS FeatureGate. Works for both CLB and NLBs.

Enhancement: openshift/enhancements#1595
Epic: https://issues.redhat.com/browse/NE-705

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 openshift-eng/jira-lifecycle-plugin repository.

@gcs278
Copy link
Contributor Author

gcs278 commented Apr 3, 2024

/hold
EP is still under review and it's likely we will add a ingresses.config.openshift.io.spec.loadBalancer.platform.aws.subnets field as well.

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2024
@gcs278 gcs278 changed the title NE-1530: IngressController LB Subnet Selection in AWS [WIP] NE-1530: IngressController LB Subnet Selection in AWS Apr 6, 2024
@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 Apr 6, 2024
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 7, 2024
@gcs278 gcs278 changed the title [WIP] NE-1530: IngressController LB Subnet Selection in AWS NE-1530: IngressController LB Subnet Selection in AWS Apr 7, 2024
@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 Apr 7, 2024
@gcs278 gcs278 force-pushed the NE705-subnets branch 2 times, most recently from 19737cb to c906aa1 Compare May 2, 2024 23:12
@@ -545,6 +545,20 @@ type AWSLoadBalancerParameters struct {
//
// +optional
NetworkLoadBalancerParameters *AWSNetworkLoadBalancerParameters `json:"networkLoadBalancer,omitempty"`

// subnets specifies the list of subnets for the load balancer to
// route traffic to. The values can be either a subnet ID or name.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you find anything that suggests only specific characters are allowed in either the name or ID?

//
// +optional
// +openshift:enable:FeatureGate=IngressControllerLBSubnetsAWS
Subnets []AWSSubnetReference `json:"subnets,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs a listType tag, its this atomic?

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've read the docs (https://github.com/kubernetes/kube-openapi/blob/master/pkg/idl/doc.go and https://kubernetes.io/docs/reference/using-api/server-side-apply/), but I'm struggling to totally grasp the difference between an atomic and set listType. I don't totally understand the implications as it relates to my field. I see set:

// Sets are lists that must not have multiple times the same value. Each
// value must be a scalar (or another atomic type).

And atomic:

// Atomic lists will be entirely replaced when updated. This tag may be
// used on any type of list (struct, scalar, ...).

Sounds like atomic only allows one "manager" for server side apply. That seems acceptable for this field.

I also see atomic is the default, so I'll go with that.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 3, 2024
@candita
Copy link
Contributor

candita commented May 8, 2024

/assign

@gcs278
Copy link
Contributor Author

gcs278 commented May 8, 2024

Yikes, I messed up this rebase bad. Fixing.

@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 8, 2024
@candita
Copy link
Contributor

candita commented May 9, 2024

An example failure from verify-crd-schema. Is it in development?

error running generator schemacheck on group operator.openshift.io:
could not run schemacheck generator for group/version operator.openshift.io/v1:
error in operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-CustomNoUpgrade.crd.yaml: ListsMustHaveSSATags: crd/ingresscontrollers.operator.openshift.io version/v1 field/^.spec.namespaceSelector.matchExpressions must set x-kubernetes-list-type
error in operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-CustomNoUpgrade.crd.yaml: ListsMustHaveSSATags: crd/ingresscontrollers.operator.openshift.io version/v1 field/^.spec.namespaceSelector.matchExpressions[*].values must set x-kubernetes-list-type

/test verify-crd-schema

@gcs278
Copy link
Contributor Author

gcs278 commented May 9, 2024

An example failure from verify-crd-schema. Is it in development?

error running generator schemacheck on group operator.openshift.io:
could not run schemacheck generator for group/version operator.openshift.io/v1:
error in operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-CustomNoUpgrade.crd.yaml: ListsMustHaveSSATags: crd/ingresscontrollers.operator.openshift.io version/v1 field/^.spec.namespaceSelector.matchExpressions must set x-kubernetes-list-type
error in operator/v1/zz_generated.crd-manifests/0000_50_ingress_00_ingresscontrollers-CustomNoUpgrade.crd.yaml: ListsMustHaveSSATags: crd/ingresscontrollers.operator.openshift.io version/v1 field/^.spec.namespaceSelector.matchExpressions[*].values must set x-kubernetes-list-type

/test verify-crd-schema

@candita I saw that too, but at the end of the logs is:

This verifier checks all files that have changed. In some cases you may have changed or
renamed a file that already contained api violations, but you are not introducing a new
violation. In such cases it is appropriate to /override the failing CI job.

And I reviewed the logs and don't see any issue with my added subnets API. Instead, all of the errors are from existing fields. So I think I will require an override when the time comes to it.

@candita
Copy link
Contributor

candita commented May 9, 2024

/retest


FeatureGateIngressControllerLBSubnetsAWS = newFeatureGate("IngressControllerLBSubnetsAWS").
reportProblemsToJiraComponent("Routing").
contactPerson("gspence").
Copy link
Contributor

@candita candita May 9, 2024

Choose a reason for hiding this comment

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

nit: For network edge features, the contact person is @Miciah , but I don't know if there are rules about it having to be the team lead or not. Otherwise, it should be your github handle.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll put "miciah" down.

type: AWS
aws:
type: Classic
- name: Subnets should be able to add after IC creation.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

Suggested change
- name: Subnets should be able to add after IC creation.
- name: Should be able to add subnets after IC creation.

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.

// In order for the load balancer to be provisioned with subnets:
// * Each subnet must exist.
// * Each subnet must be from a different availability zone.
// * The load balancer service must be deleted.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// * The load balancer service must be deleted.
// * The load balancer service must be recreated to pick up new values.

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.

// * Each subnet must be from a different availability zone.
// * The load balancer service must be deleted.
//
// When omitted, the subnets will be auto-discovered per availability zone.
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand this correctly:

Suggested change
// When omitted, the subnets will be auto-discovered per availability zone.
// If omitted, the subnets will be auto-discovered per availability zone.
// When subnets are auto-discovered, they do not propagate to this list.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Done.

// +optional
// +listType=atomic
// +openshift:enable:FeatureGate=IngressControllerLBSubnetsAWS
// +kubebuilder:validation:XValidation:rule=`self.all(x, self.exists_one(y, x == y))`,message="subnets cannot contain duplicates"
Copy link
Contributor

@candita candita May 9, 2024

Choose a reason for hiding this comment

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

Do you know if this validation is case-sensitive? The subnet names can be, so there could correctly be both subnetB and subnetb in the list. You could just add a test to the test yaml.

Copy link
Contributor

@candita candita May 9, 2024

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you know if this validation is case-sensitive? The subnet names can be, so there could correctly be both subnetB and subnetb in the list. You could just add a test to the test yaml.

Good question. It is indeed case-sensitive. Good idea, I will do that.

I don't know how much it matters, but I tested this with two empty subnets and that returns false.

Oh nice, I didn't know about this CEL playground website.

Good point. The CEL is working as expected with two empty subnets, but an empty length subnet is not a valid subnet reference. Adding // +kubebuilder:validation:MinLength=1

@@ -556,6 +572,11 @@ const (
AWSNetworkLoadBalancer AWSLoadBalancerType = "NLB"
)

// AWSSubnetReference is a reference to an AWS subnet. It can be either
// be a subnet ID or name.
Copy link
Contributor

@candita candita May 9, 2024

Choose a reason for hiding this comment

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

Suggested change
// be a subnet ID or name.
// an AWS subnet ID or a generic name.

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.

@candita
Copy link
Contributor

candita commented May 9, 2024

No major concerns on my part, just a few comments/nits.
/lgtm

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

openshift-ci bot commented May 9, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: candita, gcs278
Once this PR has been reviewed and has the lgtm label, please assign spadgett for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Allows users to specify subnets (i.e. Availability Zones) for
IngressControllers using load balancers in AWS. Introduce
under the `IngressControllerLBSubnetsAWS` FeatureGate.
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label May 10, 2024
Copy link
Contributor

openshift-ci bot commented May 10, 2024

New changes are detected. LGTM label has been removed.

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.


FeatureGateIngressControllerLBSubnetsAWS = newFeatureGate("IngressControllerLBSubnetsAWS").
reportProblemsToJiraComponent("Routing").
contactPerson("gspence").
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I'll put "miciah" down.

@@ -545,6 +545,20 @@ type AWSLoadBalancerParameters struct {
//
// +optional
NetworkLoadBalancerParameters *AWSNetworkLoadBalancerParameters `json:"networkLoadBalancer,omitempty"`

// subnets specifies the list of subnets for the load balancer to
// route traffic to. The values can be either a subnet ID or name.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. That's consistent with my experiments that allowed me to create a subnet name tag with every character my keyboard has. I don't think we can restrict characters on the basis of subnet names.

However, after some tedious experimenting, I found that though , is a valid in a subnet name, but is impossible to specify in the annotation since it uses that as the delimiter. I will add a restriction for that.

type: AWS
aws:
type: Classic
- name: Subnets should be able to add after IC creation.
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.

// In order for the load balancer to be provisioned with subnets:
// * Each subnet must exist.
// * Each subnet must be from a different availability zone.
// * The load balancer service must be deleted.
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.

// * Each subnet must be from a different availability zone.
// * The load balancer service must be deleted.
//
// When omitted, the subnets will be auto-discovered per availability zone.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Done.

// +optional
// +listType=atomic
// +openshift:enable:FeatureGate=IngressControllerLBSubnetsAWS
// +kubebuilder:validation:XValidation:rule=`self.all(x, self.exists_one(y, x == y))`,message="subnets cannot contain duplicates"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you know if this validation is case-sensitive? The subnet names can be, so there could correctly be both subnetB and subnetb in the list. You could just add a test to the test yaml.

Good question. It is indeed case-sensitive. Good idea, I will do that.

I don't know how much it matters, but I tested this with two empty subnets and that returns false.

Oh nice, I didn't know about this CEL playground website.

Good point. The CEL is working as expected with two empty subnets, but an empty length subnet is not a valid subnet reference. Adding // +kubebuilder:validation:MinLength=1

@@ -556,6 +572,11 @@ const (
AWSNetworkLoadBalancer AWSLoadBalancerType = "NLB"
)

// AWSSubnetReference is a reference to an AWS subnet. It can be either
// be a subnet ID or name.
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.

Copy link
Contributor

openshift-ci bot commented May 10, 2024

@gcs278: The following test 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/verify-crd-schema e8783c8 link true /test verify-crd-schema

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants