feat(trafficrouting): support ingresses with multiple service ports in TrafficRouting.ALB spec #3551
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This request introduces new
.ServicePorts
field forTrafficRouting.ALB
to manage ingresses with multiple ports.Implementation details
There were several options to add ability to manage ingresses with multiple ports:
Change behavior and format of .Ingresses field (❌)
Instead of a list of strings, the format of
.Ingresses
could've been changed to a list of{name: string, servicePorts: []int32}
objects. This option is the best one from the consistency and user experience point of view. Unfortunately, it is not possible to implement without introducing braking changes. Even if the controller adjusted to accept both formats (list of strings and list of objects), older clients will fail to interact with the new controller or will overwrite and corrupt.Ingresses
field on attempt to change it.Use new api version, like v1alpha2 (❌)
This is a major change, and it should be made by maintainers of the project, not a contributor like me.
Add new .ServicePorts field (✅)
Although it adds a bit more confusion to users (having to make sense of ingress/ingresses/servicePort/servicePorts fields), it is the least invasive one. This field is optional and allows specifying multiple ports for some ingresses (other ones will fall back to
.ServicePort
value)Changes
The
.ServicePorts
fields slightly changes behavior and validation ofALBTrafficRouting
:.ServicePort
is now optional field. The validation will check that for all referenced ingresses there is either an entry in.ServicePorts
list or.ServicePort
is specified as fallback..Ingress
can be specified using.ServicePorts
..Ingresses
list must have service ports specified either with an entry in.ServicePorts
or with.ServicePort
..ServicePorts
must refer to ingress specified in.Ingresses
list (or to.Ingress
if.Ingresses
is nil)To avoid confusion, it is recommended to use
.Ingress
+.ServicePort
only for a single ingress with a single port. In all other cases.Ingresses
+.ServicePorts
is preferred.Links:
Checklist:
"fix(controller): Updates such and such. Fixes #1234"
.