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

feat(translator): Set zone for endpoint and arrange endpoints by zone in EDS #3542

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/gatewayapi/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,10 @@ func getIREndpointsFromEndpointSlice(endpointSlice *discoveryv1.EndpointSlice, p
ep := ir.NewDestEndpoint(
address,
uint32(*endpointPort.Port))

// EndpointSlice may set zone for individual endpoint, use it anyway.
ep.Zone = endpoint.Zone

endpoints = append(endpoints, ep)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
gateways:
- apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
namespace: envoy-gateway
name: gateway-1
spec:
gatewayClassName: envoy-gateway-class
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: All
httpRoutes:
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
namespace: default
name: httproute-static
spec:
parentRefs:
- namespace: envoy-gateway
name: gateway-1
sectionName: http
rules:
- matches:
- path:
value: "/1"
backendRefs:
- name: service-ip
port: 8080
- name: service-import-ip
group: multicluster.x-k8s.io
kind: ServiceImport
port: 8081
- apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
namespace: default
name: httproute-fqdn
spec:
parentRefs:
- namespace: envoy-gateway
name: gateway-1
sectionName: http
rules:
- matches:
- path:
value: "/2"
backendRefs:
- name: service-fqdn
port: 8080
- name: service-import-fqdn
group: multicluster.x-k8s.io
kind: ServiceImport
port: 8081
services:
- apiVersion: v1
kind: Service
metadata:
namespace: default
name: service-fqdn
spec:
clusterIP: 1.1.1.1
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
- apiVersion: v1
kind: Service
metadata:
namespace: default
name: service-ip
spec:
clusterIP: 2.2.2.2
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
serviceImports:
- apiVersion: multicluster.x-k8s.io/v1alpha1
kind: ServiceImport
metadata:
namespace: default
name: service-import-fqdn
spec:
ips:
- 7.7.7.7
ports:
- port: 8081
name: http
protocol: TCP
- apiVersion: multicluster.x-k8s.io/v1alpha1
kind: ServiceImport
metadata:
namespace: default
name: service-import-ip
spec:
ips:
- 8.8.8.8
ports:
- port: 8081
name: http
protocol: TCP
endpointSlices:
- apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: endpointslice-service-fqdn
namespace: default
labels:
kubernetes.io/service-name: service-fqdn
addressType: FQDN
ports:
- name: http
protocol: TCP
port: 8080
endpoints:
- addresses:
- "bar.foo"
zone: "a"
conditions:
ready: true
- addresses:
- "abc.xyz"
zone: "b"
conditions:
ready: true
- apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: endpointslice-service-ip
namespace: default
labels:
kubernetes.io/service-name: service-ip
addressType: IP
ports:
- name: http
protocol: TCP
port: 8080
endpoints:
- addresses:
- "4.3.2.1"
zone: "a"
conditions:
ready: true
- addresses:
- "8.7.6.5"
zone: "b"
conditions:
ready: true
- apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: service-import-fqdn
namespace: default
labels:
multicluster.kubernetes.io/service-name: service-import-fqdn
addressType: FQDN
ports:
- name: http
protocol: TCP
port: 8081
endpoints:
- addresses:
- "foo.bar"
zone: "a"
conditions:
ready: true
- addresses:
- "xyz.abc"
zone: "b"
conditions:
ready: true
- apiVersion: discovery.k8s.io/v1
kind: EndpointSlice
metadata:
name: service-import-ip
namespace: default
labels:
multicluster.kubernetes.io/service-name: service-import-ip
addressType: IPv4
ports:
- name: http
protocol: TCP
port: 8081
endpoints:
- addresses:
- "1.2.3.4"
zone: "a"
conditions:
ready: true
- addresses:
- "5.6.7.8"
zone: "b"
conditions:
ready: true
Loading
Loading