Support automatic fallback to endpoint routing for headless services when routingType=Service#8021
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8021 +/- ##
==========================================
+ Coverage 73.70% 73.75% +0.04%
==========================================
Files 237 237
Lines 35703 35704 +1
==========================================
+ Hits 26316 26332 +16
+ Misses 7529 7516 -13
+ Partials 1858 1856 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
761e025 to
c4d1436
Compare
internal/gatewayapi/route.go
Outdated
| if service.Spec.ClusterIP == "None" || service.Spec.ClusterIP == "" { | ||
| return true | ||
| } | ||
| if len(service.Spec.ClusterIPs) > 0 { |
There was a problem hiding this comment.
This part is supposed to check for a single stack
if service.Spec.ClusterIP == "None" || service.Spec.ClusterIP == "" {
return true
}And this part is for dual stack
if len(service.Spec.ClusterIPs) > 0 {
for _, ip := range service.Spec.ClusterIPs {
if ip != "None" && ip != "" {
return false
}
}
return true
}However, in practice, I am unsure if a case like THIS TESTCASE is even possible, where the service is dual-stack headless (ClusterIPs: []string{"None", "None"}) but ClusterIP is set. I guess not.
In that case, I guess we can remove the part where I am iterating over service.Spec.ClusterIPs list. Let me know your thoughts.
There was a problem hiding this comment.
can you cross check, if that test case is NA, we should just rm it and the logic to avoid designing around this in the future
There was a problem hiding this comment.
Just checked; that testcase is not possible in practice. I tried to create the following service, and it's rejected by Kubernetes API server validation. Updated the code now
apiVersion: v1
kind: Service
metadata:
name: headless-service
spec:
clusterIP: None
clusterIPs:
- 10.96.0.100
- fd00:10:96::100
ipFamilies:
- IPv4
- IPv6
ipFamilyPolicy: RequireDualStack # add this
selector:
app: headless-backend
ports:
- port: 80c4d1436 to
eefe70c
Compare
eefe70c to
5987e1b
Compare
…ing type is set to Service Signed-off-by: Sudipto Baral <sudiptobaral.me@gmail.com>
Signed-off-by: Sudipto Baral <sudiptobaral.me@gmail.com>
5987e1b to
8ef4f6b
Compare
…when routingType=Service (envoyproxy#8021) * Implement fallback to endpoint routing on headless services when routing type is set to Service Signed-off-by: Sudipto Baral <sudiptobaral.me@gmail.com> * improve headless service detection logic Signed-off-by: Sudipto Baral <sudiptobaral.me@gmail.com> --------- Signed-off-by: Sudipto Baral <sudiptobaral.me@gmail.com> Signed-off-by: Sadmi Bouhafs <sadmibouhafs@gmail.com>
What type of PR is this?
Attempted to implement automatically detect headless services and fall back to endpoint routing when routingType=Service is enabled
Which issue(s) this PR fixes:
Fixes #7849
Release Notes: No