Skip to content

Commit 372f5e1

Browse files
authored
Merge pull request kubernetes#2367 from swetharepakula/endpointslice-ga
Update EndpointSlice GA to include zone for 1.21
2 parents ade94be + 0fee532 commit 372f5e1

File tree

3 files changed

+67
-17
lines changed

3 files changed

+67
-17
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kep-number: 0752
2+
stable:
3+
approver: "@wojtek-t"

keps/sig-network/0752-endpointslices/README.md

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
- [Mapping](#mapping)
1414
- [Endpoint Port](#endpoint-port)
1515
- [Topology (Per Endpoint)](#topology-per-endpoint)
16+
- [Converting Topology in EndpointSlice GA](#converting-topology-in-endpointslice-ga)
17+
- [Zone (Per Endpoint)](#zone-per-endpoint)
1618
- [EndpointSlice Naming](#endpointslice-naming)
1719
- [Estimation](#estimation)
1820
- [Sample Case 1: 20,000 endpoints, 5,000 nodes](#sample-case-1-20000-endpoints-5000-nodes)
@@ -209,21 +211,20 @@ type Endpoint struct {
209211
// endpoint.
210212
// +optional
211213
TargetRef *v1.ObjectReference `json:"targetRef,omitempty" protobuf:"bytes,4,opt,name=targetRef"`
212-
// topology contains arbitrary topology information associated with the
213-
// endpoint. These key/value pairs must conform with the label format.
214-
// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels
215-
// Topology may include a maximum of 16 key/value pairs. For endpoints
216-
// backed by Kubernetes Pods, This may include, but is not limited to the
217-
// following well known keys:
218-
// * kubernetes.io/hostname: the value indicates the hostname of the node
219-
// where the endpoint is located. This should match the corresponding
220-
// node label.
221-
// * topology.kubernetes.io/zone: the value indicates the zone where the
222-
// endpoint is located. This should match the corresponding node label.
223-
// * topology.kubernetes.io/region: the value indicates the region where the
224-
// endpoint is located. This should match the corresponding node label.
214+
215+
// topology was a beta feature for Endpoint to store arbitrary topology
216+
// information. The values of this field are persisted as an anotation on
217+
// on the EndpointSlice starting in v1.
218+
// +k8s:deprecated=topology,protobuf=5
219+
220+
// nodeName represents the name of the Node hosting this endpoint. This can
221+
// be used to determine endpoints local to a Node. This field can be enabled
222+
// with the EndpointSliceNodeName feature gate.
223+
// +optional
224+
NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,6,opt,name=nodeName"`
225+
// zone is the name of the Zone this endpoint exists in.
225226
// +optional
226-
Topology map[string]string `json:"topology,omitempty" protobuf:"bytes,5,opt,name=topology"`
227+
Zone *string `json:"zone,omitempty" protobuf:"bytes,7,opt,name=zone"`
227228
}
228229

229230
// EndpointConditions represents the current condition of an endpoint.
@@ -290,6 +291,10 @@ core/v1 Endpoints API is required. This allows the API to support services with
290291
no port remapping or all port services.
291292

292293
### Topology (Per Endpoint)
294+
**DEPRECATED** in v1.20 and will be removed in v1.21.
295+
This field will remain in v1beta1 and a conversion functionality will exist to
296+
convert to and from v1.
297+
293298
A new topology field (string to string map) is added to each endpoint. It can
294299
contain arbitrary topology information associated with the endpoint. If the
295300
EndpointSlice instance is derived from K8s service, the topology may contain
@@ -304,6 +309,46 @@ following well known key:
304309
If the Kubernetes Service has topological keys specified, the corresponding node
305310
labels will be copied to endpoint topology.
306311

312+
### Converting Topology in EndpointSlice GA
313+
314+
For beta resources that have set the topology field, the string to string map
315+
will be converted into an annotation on the v1 resource with the key
316+
**endpointslice.kubernetes.io/v1beta1-topology**. The annotation encoding will
317+
allow the topology information to be roundtripped between v1beta1 and v1
318+
resources.
319+
320+
The size limits of the topology field is 63B per key and per value, with a
321+
maximum of 126B per key-value pair. The maximum number of endpoints in an
322+
EndpointSlice is 1000.
323+
324+
```
325+
{Max Key-Value Pairs} * ({Max Key Size} + {Max Value Size}) * {Max Endpoints}
326+
16 * (63 + 63) * 1000 = 2,016,000b
327+
```
328+
329+
The maximum value of the combined maps in the endpoints is almost a factor of
330+
10 greater than the max annotation size (256kB). This is a worst case scenario,
331+
which is unlikely as the recommendation and default is 100 endpoints. In
332+
situations where the size is over the annotation limit, keys will be dropped from
333+
the topology maps starting with the non-standard ones. All of the endpoint
334+
topology maps will be encoded in an annotation and can be decoded back into the
335+
individual topology maps as needed. As there is no uniqueness guarantee on any
336+
of the endpoint fields, the index of the endpoint will be used when generating
337+
the annotation. Therefore any insertions, removals, and reordering of
338+
endpoints while using v1 clients will require the annotation to be
339+
regenerated.
340+
341+
The only key in the topology field that will not be preserved in the annotation
342+
will be **topology.kubernetes.io/zone** and instead its value will be converted
343+
into the [zone field](#zone-per-endpoint) on the Endpoint.
344+
345+
### Zone (Per Endpoint)
346+
A new `zone` field (string) is added to each endpoint that will indicate the
347+
zone where the endpoint is located. For resources before `v1` where the
348+
topology field is populated, if **topology.kubernetes.io/zone** exists, the
349+
value of that key will be converted to this new `zone` field. When converting
350+
back to a beta resource, the value will be added back to the endpoint's map.
351+
307352
### EndpointSlice Naming
308353
Use `generateName` with the Service name as prefix:
309354
```
@@ -643,8 +688,9 @@ The following will need to be covered as part of the testing plan:
643688
Default**
644689
* The EndpointSlice API will graduate to v1.
645690
* The topology field will be removed.
691+
* A new Zone field will be added to provide per endpoint topology information.
646692
* `EndpointSliceNodeName` feature gate will graduate to beta.
647-
* `EndpointSliceProxying` feature gate will graduate to beta on Windows:
693+
* `WindowsEndpointSliceProxying` feature gate will graduate to beta on Windows:
648694
* Kube-Proxy on Windows will use EndpointSlices by default.
649695
* A new `endpoints.kubernetes.io/over-capacity` label will be set to "warning"
650696
on Endpoints resources exceeding 1000 endpoints.

keps/sig-network/0752-endpointslices/kep.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ kep-number: 752
33
authors:
44
- "@freehan"
55
- "@robscott"
6+
- "@swetharepakula"
67
owning-sig: sig-network
78
reviewers:
89
- "@bowei"
@@ -15,10 +16,10 @@ approvers:
1516
prr-approvers:
1617
- "@wojtek-t"
1718
creation-date: 2019-06-01
18-
last-updated: 2020-09-29
19+
last-updated: 2021-01-28
1920
status: implementable
2021
# The target maturity stage in the current dev cycle for this KEP.
21-
stage: beta
22+
stage: stable
2223

2324
# The most recent milestone for which work toward delivery of this KEP has been
2425
# done. This can be the current (upcoming) milestone, if it is being actively

0 commit comments

Comments
 (0)