1package v1
2
3import (
4 "cue.dev/x/k8s.io/api/core/v1"
5 v1_9 "cue.dev/x/k8s.io/apimachinery/pkg/apis/meta/v1"
6)
7
8// Endpoint represents a single logical "backend" implementing a
9// service.
10#Endpoint: {
11 // addresses of this endpoint. For EndpointSlices of addressType
12 // "IPv4" or "IPv6", the values are IP addresses in canonical
13 // form. The syntax and semantics of other addressType values are
14 // not defined. This must contain at least one address but no
15 // more than 100. EndpointSlices generated by the EndpointSlice
16 // controller will always have exactly 1 address. No semantics
17 // are defined for additional addresses beyond the first, and
18 // kube-proxy does not look at them.
19 "addresses"!: [...string]
20
21 // conditions contains information about the current status of the
22 // endpoint.
23 "conditions"?: #EndpointConditions
24
25 // deprecatedTopology contains topology information part of the
26 // v1beta1 API. This field is deprecated, and will be removed
27 // when the v1beta1 API is removed (no sooner than kubernetes
28 // v1.24). While this field can hold values, it is not writable
29 // through the v1 API, and any attempts to write to it will be
30 // silently ignored. Topology information can be found in the
31 // zone and nodeName fields instead.
32 "deprecatedTopology"?: {
33 [string]: string
34 }
35
36 // hints contains information associated with how an endpoint
37 // should be consumed.
38 "hints"?: #EndpointHints
39
40 // hostname of this endpoint. This field may be used by consumers
41 // of endpoints to distinguish endpoints from each other (e.g. in
42 // DNS names). Multiple endpoints which use the same hostname
43 // should be considered fungible (e.g. multiple A values in DNS).
44 // Must be lowercase and pass DNS Label (RFC 1123) validation.
45 "hostname"?: string
46
47 // nodeName represents the name of the Node hosting this endpoint.
48 // This can be used to determine endpoints local to a Node.
49 "nodeName"?: string
50
51 // targetRef is a reference to a Kubernetes object that represents
52 // this endpoint.
53 "targetRef"?: v1.#ObjectReference
54
55 // zone is the name of the Zone this endpoint exists in.
56 "zone"?: string
57}
58
59// EndpointConditions represents the current condition of an
60// endpoint.
61#EndpointConditions: {
62 // ready indicates that this endpoint is ready to receive traffic,
63 // according to whatever system is managing the endpoint. A nil
64 // value should be interpreted as "true". In general, an endpoint
65 // should be marked ready if it is serving and not terminating,
66 // though this can be overridden in some cases, such as when the
67 // associated Service has set the publishNotReadyAddresses flag.
68 "ready"?: bool
69
70 // serving indicates that this endpoint is able to receive
71 // traffic, according to whatever system is managing the
72 // endpoint. For endpoints backed by pods, the EndpointSlice
73 // controller will mark the endpoint as serving if the pod's
74 // Ready condition is True. A nil value should be interpreted as
75 // "true".
76 "serving"?: bool
77
78 // terminating indicates that this endpoint is terminating. A nil
79 // value should be interpreted as "false".
80 "terminating"?: bool
81}
82
83// EndpointHints provides hints describing how an endpoint should
84// be consumed.
85#EndpointHints: {
86 // forNodes indicates the node(s) this endpoint should be consumed
87 // by when using topology aware routing. May contain a maximum of
88 // 8 entries.
89 "forNodes"?: [...#ForNode]
90
91 // forZones indicates the zone(s) this endpoint should be consumed
92 // by when using topology aware routing. May contain a maximum of
93 // 8 entries.
94 "forZones"?: [...#ForZone]
95}
96
97// EndpointPort represents a Port used by an EndpointSlice
98#EndpointPort: {
99 // The application protocol for this port. This is used as a hint
100 // for implementations to offer richer behavior for protocols
101 // that they understand. This field follows standard Kubernetes
102 // label syntax. Valid values are either:
103 //
104 // * Un-prefixed protocol names - reserved for IANA standard
105 // service names (as per RFC-6335 and
106 // https://www.iana.org/assignments/service-names).
107 //
108 // * Kubernetes-defined prefixed names:
109 // * 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext
110 // as described in
111 // https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-
112 // * 'kubernetes.io/ws' - WebSocket over cleartext as described in
113 // https://www.rfc-editor.org/rfc/rfc6455
114 // * 'kubernetes.io/wss' - WebSocket over TLS as described in
115 // https://www.rfc-editor.org/rfc/rfc6455
116 //
117 // * Other protocols should use implementation-defined prefixed
118 // names such as mycompany.com/my-custom-protocol.
119 "appProtocol"?: string
120
121 // name represents the name of this port. All ports in an
122 // EndpointSlice must have a unique name. If the EndpointSlice is
123 // derived from a Kubernetes service, this corresponds to the
124 // Service.ports[].name. Name must either be an empty string or
125 // pass DNS_LABEL validation: * must be no more than 63
126 // characters long. * must consist of lower case alphanumeric
127 // characters or '-'. * must start and end with an alphanumeric
128 // character. Default is empty string.
129 "name"?: string
130
131 // port represents the port number of the endpoint. If the
132 // EndpointSlice is derived from a Kubernetes service, this must
133 // be set to the service's target port. EndpointSlices used for
134 // other purposes may have a nil port.
135 "port"?: int32 & int
136
137 // protocol represents the IP protocol for this port. Must be UDP,
138 // TCP, or SCTP. Default is TCP.
139 "protocol"?: string
140}
141
142// EndpointSlice represents a set of service endpoints. Most
143// EndpointSlices are created by the EndpointSlice controller to
144// represent the Pods selected by Service objects. For a given
145// service there may be multiple EndpointSlice objects which must
146// be joined to produce the full set of endpoints; you can find
147// all of the slices for a given service by listing
148// EndpointSlices in the service's namespace whose
149// `kubernetes.io/service-name` label contains the service's
150// name.
151#EndpointSlice: {
152 // addressType specifies the type of address carried by this
153 // EndpointSlice. All addresses in this slice must be the same
154 // type. This field is immutable after creation. The following
155 // address types are currently supported: * IPv4: Represents an
156 // IPv4 Address. * IPv6: Represents an IPv6 Address. * FQDN:
157 // Represents a Fully Qualified Domain Name. (Deprecated) The
158 // EndpointSlice controller only generates, and kube-proxy only
159 // processes, slices of addressType "IPv4" and "IPv6". No
160 // semantics are defined for the "FQDN" type.
161 "addressType"!: string
162
163 // APIVersion defines the versioned schema of this representation
164 // of an object. Servers should convert recognized schemas to the
165 // latest internal value, and may reject unrecognized values.
166 // More info:
167 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
168 "apiVersion": "discovery.k8s.io/v1"
169
170 // endpoints is a list of unique endpoints in this slice. Each
171 // slice may include a maximum of 1000 endpoints.
172 "endpoints"!: [...#Endpoint]
173
174 // Kind is a string value representing the REST resource this
175 // object represents. Servers may infer this from the endpoint
176 // the client submits requests to. Cannot be updated. In
177 // CamelCase. More info:
178 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
179 "kind": "EndpointSlice"
180
181 // Standard object's metadata.
182 "metadata"?: v1_9.#ObjectMeta
183
184 // ports specifies the list of network ports exposed by each
185 // endpoint in this slice. Each port must have a unique name.
186 // Each slice may include a maximum of 100 ports. Services always
187 // have at least 1 port, so EndpointSlices generated by the
188 // EndpointSlice controller will likewise always have at least 1
189 // port. EndpointSlices used for other purposes may have an empty
190 // ports list.
191 "ports"?: [...#EndpointPort]
192}
193
194// EndpointSliceList represents a list of endpoint slices
195#EndpointSliceList: {
196 // APIVersion defines the versioned schema of this representation
197 // of an object. Servers should convert recognized schemas to the
198 // latest internal value, and may reject unrecognized values.
199 // More info:
200 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
201 "apiVersion": "discovery.k8s.io/v1"
202
203 // items is the list of endpoint slices
204 "items"!: [...#EndpointSlice]
205
206 // Kind is a string value representing the REST resource this
207 // object represents. Servers may infer this from the endpoint
208 // the client submits requests to. Cannot be updated. In
209 // CamelCase. More info:
210 // https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
211 "kind": "EndpointSliceList"
212
213 // Standard list metadata.
214 "metadata"?: v1_9.#ListMeta
215}
216
217// ForNode provides information about which nodes should consume
218// this endpoint.
219#ForNode: {
220 // name represents the name of the node.
221 "name"!: string
222}
223
224// ForZone provides information about which zones should consume
225// this endpoint.
226#ForZone: {
227 // name represents the name of the zone.
228 "name"!: string
229}