@@ -25,9 +25,12 @@ import (
25
25
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
26
26
// +k8s:prerelease-lifecycle-gen:introduced=1.21
27
27
28
- // EndpointSlice represents a subset of the endpoints that implement a service.
29
- // For a given service there may be multiple EndpointSlice objects, selected by
30
- // labels, which must be joined to produce the full set of endpoints.
28
+ // EndpointSlice represents a set of service endpoints. Most EndpointSlices are created by
29
+ // the EndpointSlice controller to represent the Pods selected by Service objects. For a
30
+ // given service there may be multiple EndpointSlice objects which must be joined to
31
+ // produce the full set of endpoints; you can find all of the slices for a given service
32
+ // by listing EndpointSlices in the service's namespace whose `kubernetes.io/service-name`
33
+ // label contains the service's name.
31
34
type EndpointSlice struct {
32
35
metav1.TypeMeta `json:",inline"`
33
36
@@ -41,7 +44,10 @@ type EndpointSlice struct {
41
44
// supported:
42
45
// * IPv4: Represents an IPv4 Address.
43
46
// * IPv6: Represents an IPv6 Address.
44
- // * FQDN: Represents a Fully Qualified Domain Name.
47
+ // * FQDN: Represents a Fully Qualified Domain Name. (Deprecated)
48
+ // The EndpointSlice controller only generates, and kube-proxy only processes,
49
+ // slices of addressType "IPv4" and "IPv6". No semantics are defined for
50
+ // the "FQDN" type.
45
51
AddressType AddressType `json:"addressType" protobuf:"bytes,4,rep,name=addressType"`
46
52
47
53
// endpoints is a list of unique endpoints in this slice. Each slice may
@@ -50,10 +56,11 @@ type EndpointSlice struct {
50
56
Endpoints []Endpoint `json:"endpoints" protobuf:"bytes,2,rep,name=endpoints"`
51
57
52
58
// ports specifies the list of network ports exposed by each endpoint in
53
- // this slice. Each port must have a unique name. When ports is empty, it
54
- // indicates that there are no defined ports. When a port is defined with a
55
- // nil port value, it indicates "all ports". Each slice may include a
59
+ // this slice. Each port must have a unique name. Each slice may include a
56
60
// maximum of 100 ports.
61
+ // Services always have at least 1 port, so EndpointSlices generated by the
62
+ // EndpointSlice controller will likewise always have at least 1 port.
63
+ // EndpointSlices used for other purposes may have an empty ports list.
57
64
// +optional
58
65
// +listType=atomic
59
66
Ports []EndpointPort `json:"ports" protobuf:"bytes,3,rep,name=ports"`
@@ -76,12 +83,12 @@ const (
76
83
77
84
// Endpoint represents a single logical "backend" implementing a service.
78
85
type Endpoint struct {
79
- // addresses of this endpoint. The contents of this field are interpreted
80
- // according to the corresponding EndpointSlice addressType field. Consumers
81
- // must handle different types of addresses in the context of their own
82
- // capabilities. This must contain at least one address but no more than
83
- // 100. These are all assumed to be fungible and clients may choose to only
84
- // use the first element. Refer to: https://issue.k8s.io/106267
86
+ // addresses of this endpoint. For EndpointSlices of addressType "IPv4" or "IPv6",
87
+ // the values are IP addresses in canonical form. The syntax and semantics of
88
+ // other addressType values are not defined. This must contain at least one
89
+ // address but no more than 100. EndpointSlices generated by the EndpointSlice
90
+ // controller will always have exactly 1 address. No semantics are defined for
91
+ // additional addresses beyond the first, and kube-proxy does not look at them.
85
92
// +listType=set
86
93
Addresses []string `json:"addresses" protobuf:"bytes,1,rep,name=addresses"`
87
94
@@ -127,26 +134,25 @@ type Endpoint struct {
127
134
128
135
// EndpointConditions represents the current condition of an endpoint.
129
136
type EndpointConditions struct {
130
- // ready indicates that this endpoint is prepared to receive traffic,
137
+ // ready indicates that this endpoint is ready to receive traffic,
131
138
// according to whatever system is managing the endpoint. A nil value
132
- // indicates an unknown state. In most cases consumers should interpret this
133
- // unknown state as ready. For compatibility reasons, ready should never be
134
- // "true" for terminating endpoints, except when the normal readiness
135
- // behavior is being explicitly overridden, for example when the associated
136
- // Service has set the publishNotReadyAddresses flag.
139
+ // should be interpreted as "true". In general, an endpoint should be
140
+ // marked ready if it is serving and not terminating, though this can
141
+ // be overridden in some cases, such as when the associated Service has
142
+ // set the publishNotReadyAddresses flag.
137
143
// +optional
138
144
Ready * bool `json:"ready,omitempty" protobuf:"bytes,1,name=ready"`
139
145
140
- // serving is identical to ready except that it is set regardless of the
141
- // terminating state of endpoints. This condition should be set to true for
142
- // a ready endpoint that is terminating. If nil, consumers should defer to
143
- // the ready condition.
146
+ // serving indicates that this endpoint is able to receive traffic,
147
+ // according to whatever system is managing the endpoint. For endpoints
148
+ // backed by pods, the EndpointSlice controller will mark the endpoint
149
+ // as serving if the pod's Ready condition is True. A nil value should be
150
+ // interpreted as "true".
144
151
// +optional
145
152
Serving * bool `json:"serving,omitempty" protobuf:"bytes,2,name=serving"`
146
153
147
154
// terminating indicates that this endpoint is terminating. A nil value
148
- // indicates an unknown state. Consumers should interpret this unknown state
149
- // to mean that the endpoint is not terminating.
155
+ // should be interpreted as "false".
150
156
// +optional
151
157
Terminating * bool `json:"terminating,omitempty" protobuf:"bytes,3,name=terminating"`
152
158
}
@@ -183,8 +189,9 @@ type EndpointPort struct {
183
189
Protocol * v1.Protocol `json:"protocol,omitempty" protobuf:"bytes,2,name=protocol"`
184
190
185
191
// port represents the port number of the endpoint.
186
- // If this is not specified, ports are not restricted and must be
187
- // interpreted in the context of the specific consumer.
192
+ // If the EndpointSlice is derived from a Kubernetes service, this must be set
193
+ // to the service's target port. EndpointSlices used for other purposes may have
194
+ // a nil port.
188
195
Port * int32 `json:"port,omitempty" protobuf:"bytes,3,opt,name=port"`
189
196
190
197
// The application protocol for this port.
0 commit comments