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