-
Notifications
You must be signed in to change notification settings - Fork 23
Add DNSPolicy Routing Strategy #629
Add DNSPolicy Routing Strategy #629
Conversation
want to merge this to single-cluster branch? |
…name and IPAddress MGC types.
d53d848
to
66668bd
Compare
83916f0
to
69ff542
Compare
0ccee81
to
b00c61c
Compare
b00c61c
to
206a8ae
Compare
206a8ae
to
cee6e58
Compare
@@ -205,11 +203,14 @@ func getClusterGatewayAddresses(gw *gatewayv1beta1.Gateway) map[string][]gateway | |||
} | |||
} | |||
|
|||
gatewayAddresses = append(gatewayAddresses, gatewayv1beta1.GatewayAddress{ | |||
if _, ok := clusterAddrs[cluster]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah this is what I expected nice!
This is looking good to me, we need to wait on @makslion PR to allow setting things like geo and weight in a single cluster (IE to something custom like what we did with ManagedCLuster)? |
It should already be possible to do this by adding the same labels to the gateway itself in a single cluster context . Admittedly there is no test for it, but would be fairly easy to add now. |
cee6e58
to
db29367
Compare
// +kubebuilder:validation:Enum=simple;loadbalanced | ||
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="RoutingStrategy is immutable" | ||
// +kubebuilder:default=loadbalanced | ||
RoutingStrategy RoutingStrategy `json:"routingStrategy"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
routingStrategy is required, but having the default means you don't have to specify it and will default to "loadbalanced" (The current behaviour)
db29367
to
02c20cf
Compare
62b95d7
to
163eb6d
Compare
163eb6d
to
7cbe345
Compare
|
||
// getSimpleEndpoints returns the endpoints for the given MultiClusterGatewayTarget using the simple routing strategy | ||
|
||
func (dh *dnsHelper) getSimpleEndpoints(mcgTarget *dns.MultiClusterGatewayTarget, hostname string, currentEndpoints map[string]*v1alpha1.Endpoint) []*v1alpha1.Endpoint { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to change the name of this type? Bit confusing when we are also working in single cluster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are talking about MultiClusterGatewayTarget
and yes it needs renamed. Won't be in this PR though.
)) | ||
}, TestTimeoutMedium, TestRetryIntervalMedium, ctx).Should(Succeed()) | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a pretty great test, but there is a lot going on in this file now. Perhaps as a follow up we could think about whether we should split this test in someway to make it easier to read / mantain? IE single vs multi or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, its far too long now, and a lot more could be added so we need to look at how we want these to be separated out. Probably at the very least a separate test file for multi/single and simple/loadbalanced contexts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to merge this, some minor comments.
Adds a routingStrategy field to the DNSPolicy spec that determines how the policy with generate endpoints for any created DNSRecords. Two strategies are allowed, `simple` and `loadbalanced`. Simple will create a single DNS record (A or CNAME) for each listener/hostname with all ip/hostnames as targets. LoadBalanced works as before by creating a more complex record structure with CNAMES and A records using Geo and Weighted routing strategies to achieve loadbalancing functionality. The routingStrategy field is currently marked as immutable and it should not be changed after initial DNSPolicy creation.
Update DNSPolicy test to include contexts for routing strategy + single and multi cluster status. Rename builders to <ResourceName>Builder e.g. GatewayBuilder, TLSPolicyBuilder etc... Remove references to "placed" where possible Rename most constants to make them more consistent with what they are.
7cbe345
to
4744c83
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maleck13, mikenairn 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 |
/lgtm |
Adds a routing strategy field to the DNSPolicy spec that determines how the policy with generate endpoints for any created DNSRecords.
Two routing strategies are allowed,
simple
andloadbalanced
. Simple will creates a single DNS record (A or CNAME) for each listener/hostname with all ip/hostnames as targets. LoadBalanced works as before by creating a more complex record structure with CNAMES and A records using Geo and Weighted routing strategies to achieve loadbalancing functionality.The strategy field is currently marked as immutable and it should not be changed after initial DNSPolicy creation.
closes #655