Skip to content

Commit 990bd74

Browse files
authored
fix api-ref-docs make target and generate result (kubernetes-sigs#1422)
1 parent 16737b1 commit 990bd74

File tree

3 files changed

+77
-210
lines changed

3 files changed

+77
-210
lines changed

Makefile

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,16 +298,16 @@ live-docs:
298298
docker run --rm -it -p 3000:3000 -v ${PWD}:/docs gaie/mkdocs
299299

300300
.PHONY: apix-ref-docs
301-
apix-ref-docs:
302-
crd-ref-docs \
301+
apix-ref-docs: crd-ref-docs
302+
${CRD_REF_DOCS} \
303303
--source-path=${PWD}/apix/v1alpha2 \
304304
--config=crd-ref-docs.yaml \
305305
--renderer=markdown \
306306
--output-path=${PWD}/site-src/reference/x-spec.md
307307

308308
.PHONY: api-ref-docs
309-
api-ref-docs:
310-
crd-ref-docs \
309+
api-ref-docs: crd-ref-docs
310+
${CRD_REF_DOCS} \
311311
--source-path=${PWD}/api \
312312
--config=crd-ref-docs.yaml \
313313
--renderer=markdown \
@@ -364,6 +364,7 @@ KUBECTL ?= kubectl
364364
KUSTOMIZE ?= $(LOCALBIN)/kustomize
365365
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
366366
ENVTEST ?= $(LOCALBIN)/setup-envtest
367+
CRD_REF_DOCS ?= $(LOCALBIN)/crd-ref-docs
367368
GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
368369
HELM = $(PROJECT_DIR)/bin/helm
369370
YQ = $(PROJECT_DIR)/bin/yq
@@ -374,6 +375,7 @@ GCI = $(LOCALBIN)/gci
374375
KUSTOMIZE_VERSION ?= v5.4.3
375376
CONTROLLER_TOOLS_VERSION ?= v0.16.1
376377
ENVTEST_VERSION ?= release-0.19
378+
CRD_REF_DOCS_VERSION ?= v0.2.0
377379
GOLANGCI_LINT_VERSION ?= v2.3.0
378380
HELM_VERSION ?= v3.17.1
379381
KUBECTL_VALIDATE_VERSION ?= v0.0.4
@@ -390,6 +392,11 @@ controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessar
390392
$(CONTROLLER_GEN): $(LOCALBIN)
391393
$(call go-install-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen,$(CONTROLLER_TOOLS_VERSION))
392394

395+
.PHONY: crd-ref-docs
396+
crd-ref-docs: $(CRD_REF_DOCS) ## Download crd-ref-docs locally if necessary.
397+
$(CRD_REF_DOCS): $(LOCALBIN)
398+
$(call go-install-tool,$(CRD_REF_DOCS),github.com/elastic/crd-ref-docs,$(CRD_REF_DOCS_VERSION))
399+
393400
.PHONY: envtest
394401
envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
395402
$(ENVTEST): $(LOCALBIN)

site-src/reference/spec.md

Lines changed: 46 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,6 @@ inference.networking.k8s.io API group.
1515

1616

1717

18-
#### EndpointPickerConfig
19-
20-
21-
22-
EndpointPickerConfig specifies the configuration needed by the proxy to discover and connect to the endpoint picker extension.
23-
This type is intended to be a union of mutually exclusive configuration options that we may add in the future.
24-
25-
26-
27-
_Appears in:_
28-
- [InferencePoolSpec](#inferencepoolspec)
29-
30-
| Field | Description | Default | Validation |
31-
| --- | --- | --- | --- |
32-
| `extensionRef` _[Extension](#extension)_ | Extension configures an endpoint picker as an extension service. | | Required: \{\} <br /> |
33-
34-
3518
#### Extension
3619

3720

@@ -41,34 +24,17 @@ Extension specifies how to configure an extension that runs the endpoint picker.
4124

4225

4326
_Appears in:_
44-
- [EndpointPickerConfig](#endpointpickerconfig)
4527
- [InferencePoolSpec](#inferencepoolspec)
4628

4729
| Field | Description | Default | Validation |
4830
| --- | --- | --- | --- |
49-
| `group` _[Group](#group)_ | Group is the group of the referent.<br />The default value is "", representing the Core API group. | | MaxLength: 253 <br />Pattern: `^$\|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` <br /> |
31+
| `group` _[Group](#group)_ | Group is the group of the referent.<br />The default value is "", representing the Core API group. | | MaxLength: 253 <br />MinLength: 0 <br />Pattern: `^$\|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` <br /> |
5032
| `kind` _[Kind](#kind)_ | Kind is the Kubernetes resource kind of the referent.<br />Defaults to "Service" when not specified.<br />ExternalName services can refer to CNAME DNS records that may live<br />outside of the cluster and as such are difficult to reason about in<br />terms of conformance. They also may not be safe to forward to (see<br />CVE-2021-25740 for more information). Implementations MUST NOT<br />support ExternalName Services. | Service | MaxLength: 63 <br />MinLength: 1 <br />Pattern: `^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` <br /> |
51-
| `name` _[ObjectName](#objectname)_ | Name is the name of the referent. | | MaxLength: 253 <br />MinLength: 1 <br />Required: \{\} <br /> |
33+
| `name` _[ObjectName](#objectname)_ | Name is the name of the referent. | | MaxLength: 253 <br />MinLength: 1 <br /> |
5234
| `portNumber` _[PortNumber](#portnumber)_ | The port number on the service running the extension. When unspecified,<br />implementations SHOULD infer a default value of 9002 when the Kind is<br />Service. | | Maximum: 65535 <br />Minimum: 1 <br /> |
5335
| `failureMode` _[ExtensionFailureMode](#extensionfailuremode)_ | Configures how the gateway handles the case when the extension is not responsive.<br />Defaults to failClose. | FailClose | Enum: [FailOpen FailClose] <br /> |
5436

5537

56-
#### ExtensionConnection
57-
58-
59-
60-
ExtensionConnection encapsulates options that configures the connection to the extension.
61-
62-
63-
64-
_Appears in:_
65-
- [Extension](#extension)
66-
67-
| Field | Description | Default | Validation |
68-
| --- | --- | --- | --- |
69-
| `failureMode` _[ExtensionFailureMode](#extensionfailuremode)_ | Configures how the gateway handles the case when the extension is not responsive.<br />Defaults to failClose. | FailClose | Enum: [FailOpen FailClose] <br /> |
70-
71-
7238
#### ExtensionFailureMode
7339

7440
_Underlying type:_ _string_
@@ -81,37 +47,13 @@ _Validation:_
8147

8248
_Appears in:_
8349
- [Extension](#extension)
84-
- [ExtensionConnection](#extensionconnection)
8550

8651
| Field | Description |
8752
| --- | --- |
8853
| `FailOpen` | FailOpen specifies that the proxy should forward the request to an endpoint of its picking when the Endpoint Picker fails.<br /> |
8954
| `FailClose` | FailClose specifies that the proxy should drop the request when the Endpoint Picker fails.<br /> |
9055

9156

92-
#### ExtensionReference
93-
94-
95-
96-
ExtensionReference is a reference to the extension.
97-
98-
If a reference is invalid, the implementation MUST update the `ResolvedRefs`
99-
Condition on the InferencePool's status to `status: False`. A 5XX status code MUST be returned
100-
for the request that would have otherwise been routed to the invalid backend.
101-
102-
103-
104-
_Appears in:_
105-
- [Extension](#extension)
106-
107-
| Field | Description | Default | Validation |
108-
| --- | --- | --- | --- |
109-
| `group` _[Group](#group)_ | Group is the group of the referent.<br />The default value is "", representing the Core API group. | | MaxLength: 253 <br />Pattern: `^$\|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` <br /> |
110-
| `kind` _[Kind](#kind)_ | Kind is the Kubernetes resource kind of the referent.<br />Defaults to "Service" when not specified.<br />ExternalName services can refer to CNAME DNS records that may live<br />outside of the cluster and as such are difficult to reason about in<br />terms of conformance. They also may not be safe to forward to (see<br />CVE-2021-25740 for more information). Implementations MUST NOT<br />support ExternalName Services. | Service | MaxLength: 63 <br />MinLength: 1 <br />Pattern: `^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` <br /> |
111-
| `name` _[ObjectName](#objectname)_ | Name is the name of the referent. | | MaxLength: 253 <br />MinLength: 1 <br />Required: \{\} <br /> |
112-
| `portNumber` _[PortNumber](#portnumber)_ | The port number on the service running the extension. When unspecified,<br />implementations SHOULD infer a default value of 9002 when the Kind is<br />Service. | | Maximum: 65535 <br />Minimum: 1 <br /> |
113-
114-
11557
#### Group
11658

11759
_Underlying type:_ _string_
@@ -134,11 +76,11 @@ Invalid values include:
13476

13577
_Validation:_
13678
- MaxLength: 253
79+
- MinLength: 0
13780
- Pattern: `^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
13881

13982
_Appears in:_
14083
- [Extension](#extension)
141-
- [ExtensionReference](#extensionreference)
14284
- [ParentGatewayReference](#parentgatewayreference)
14385

14486

@@ -160,7 +102,7 @@ InferencePool is the Schema for the InferencePools API.
160102
| `kind` _string_ | `InferencePool` | | |
161103
| `metadata` _[ObjectMeta](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#objectmeta-v1-meta)_ | Refer to Kubernetes API documentation for fields of `metadata`. | | |
162104
| `spec` _[InferencePoolSpec](#inferencepoolspec)_ | | | |
163-
| `status` _[InferencePoolStatus](#inferencepoolstatus)_ | Status defines the observed state of InferencePool. | \{ parent:[map[conditions:[map[lastTransitionTime:1970-01-01T00:00:00Z message:Waiting for controller reason:Pending status:Unknown type:Accepted]] parentRef:map[kind:Status name:default]]] \} | |
105+
| `status` _[InferencePoolStatus](#inferencepoolstatus)_ | Status defines the observed state of InferencePool. | \{ parent:[map[conditions:[map[lastTransitionTime:1970-01-01T00:00:00Z message:Waiting for controller reason:Pending status:Unknown type:Accepted]] parentRef:map[kind:Status name:default]]] \} | MinProperties: 1 <br /> |
164106

165107

166108

@@ -180,9 +122,9 @@ _Appears in:_
180122

181123
| Field | Description | Default | Validation |
182124
| --- | --- | --- | --- |
183-
| `selector` _object (keys:[LabelKey](#labelkey), values:[LabelValue](#labelvalue))_ | Selector defines a map of labels to watch model server Pods<br />that should be included in the InferencePool.<br />In some cases, implementations may translate this field to a Service selector, so this matches the simple<br />map used for Service selectors instead of the full Kubernetes LabelSelector type.<br />If specified, it will be applied to match the model server pods in the same namespace as the InferencePool.<br />Cross namesoace selector is not supported. | | Required: \{\} <br /> |
184-
| `targetPortNumber` _integer_ | TargetPortNumber defines the port number to access the selected model server Pods.<br />The number must be in the range 1 to 65535. | | Maximum: 65535 <br />Minimum: 1 <br />Required: \{\} <br /> |
185-
| `extensionRef` _[Extension](#extension)_ | Extension configures an endpoint picker as an extension service. | | Required: \{\} <br /> |
125+
| `selector` _[LabelSelector](#labelselector)_ | Selector determines which Pods are members of this inference pool.<br />It matches Pods by their labels only within the same namespace; cross-namespace<br />selection is not supported.<br />The structure of this LabelSelector is intentionally simple to be compatible<br />with Kubernetes Service selectors, as some implementations may translate<br />this configuration into a Service resource. | | |
126+
| `targetPorts` _[Port](#port) array_ | TargetPorts defines a list of ports that are exposed by this InferencePool.<br />Currently, the list may only include a single port definition. | | MaxItems: 1 <br />MinItems: 1 <br /> |
127+
| `extensionRef` _[Extension](#extension)_ | Extension configures an endpoint picker as an extension service. | | |
186128

187129

188130
#### InferencePoolStatus
@@ -191,7 +133,8 @@ _Appears in:_
191133

192134
InferencePoolStatus defines the observed state of InferencePool.
193135

194-
136+
_Validation:_
137+
- MinProperties: 1
195138

196139
_Appears in:_
197140
- [InferencePool](#inferencepool)
@@ -223,7 +166,6 @@ _Validation:_
223166

224167
_Appears in:_
225168
- [Extension](#extension)
226-
- [ExtensionReference](#extensionreference)
227169
- [ParentGatewayReference](#parentgatewayreference)
228170

229171

@@ -256,9 +198,26 @@ _Validation:_
256198
- MinLength: 1
257199
- Pattern: `^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?([A-Za-z0-9][-A-Za-z0-9_.]{0,61})?[A-Za-z0-9]$`
258200

201+
_Appears in:_
202+
- [LabelSelector](#labelselector)
203+
204+
205+
206+
#### LabelSelector
207+
208+
209+
210+
LabelSelector defines a query for resources based on their labels.
211+
This simplified version uses only the matchLabels field.
212+
213+
214+
259215
_Appears in:_
260216
- [InferencePoolSpec](#inferencepoolspec)
261217

218+
| Field | Description | Default | Validation |
219+
| --- | --- | --- | --- |
220+
| `matchLabels` _object (keys:[LabelKey](#labelkey), values:[LabelValue](#labelvalue))_ | matchLabels contains a set of required \{key,value\} pairs.<br />An object must match every label in this map to be selected.<br />The matching logic is an AND operation on all entries. | | MaxItems: 64 <br /> |
262221

263222

264223
#### LabelValue
@@ -283,7 +242,7 @@ _Validation:_
283242
- Pattern: `^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?$`
284243

285244
_Appears in:_
286-
- [InferencePoolSpec](#inferencepoolspec)
245+
- [LabelSelector](#labelselector)
287246

288247

289248

@@ -331,7 +290,6 @@ _Validation:_
331290

332291
_Appears in:_
333292
- [Extension](#extension)
334-
- [ExtensionReference](#extensionreference)
335293
- [ParentGatewayReference](#parentgatewayreference)
336294

337295

@@ -350,7 +308,7 @@ _Appears in:_
350308

351309
| Field | Description | Default | Validation |
352310
| --- | --- | --- | --- |
353-
| `group` _[Group](#group)_ | Group is the group of the referent. | gateway.networking.k8s.io | MaxLength: 253 <br />Pattern: `^$\|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` <br /> |
311+
| `group` _[Group](#group)_ | Group is the group of the referent. | gateway.networking.k8s.io | MaxLength: 253 <br />MinLength: 0 <br />Pattern: `^$\|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$` <br /> |
354312
| `kind` _[Kind](#kind)_ | Kind is kind of the referent. For example "Gateway". | Gateway | MaxLength: 63 <br />MinLength: 1 <br />Pattern: `^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$` <br /> |
355313
| `name` _[ObjectName](#objectname)_ | Name is the name of the referent. | | MaxLength: 253 <br />MinLength: 1 <br /> |
356314
| `namespace` _[Namespace](#namespace)_ | Namespace is the namespace of the referent. If not present,<br />the namespace of the referent is assumed to be the same as<br />the namespace of the referring object. | | MaxLength: 63 <br />MinLength: 1 <br />Pattern: `^[a-z0-9]([-a-z0-9]*[a-z0-9])?$` <br /> |
@@ -369,8 +327,24 @@ _Appears in:_
369327

370328
| Field | Description | Default | Validation |
371329
| --- | --- | --- | --- |
372-
| `parentRef` _[ParentGatewayReference](#parentgatewayreference)_ | GatewayRef indicates the gateway that observed state of InferencePool. | | |
373330
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | Conditions track the state of the InferencePool.<br />Known condition types are:<br />* "Accepted"<br />* "ResolvedRefs" | [map[lastTransitionTime:1970-01-01T00:00:00Z message:Waiting for controller reason:Pending status:Unknown type:Accepted]] | MaxItems: 8 <br /> |
331+
| `parentRef` _[ParentGatewayReference](#parentgatewayreference)_ | GatewayRef indicates the gateway that observed state of InferencePool. | | |
332+
333+
334+
#### Port
335+
336+
337+
338+
Port defines the network port that will be exposed by this InferencePool.
339+
340+
341+
342+
_Appears in:_
343+
- [InferencePoolSpec](#inferencepoolspec)
344+
345+
| Field | Description | Default | Validation |
346+
| --- | --- | --- | --- |
347+
| `number` _[PortNumber](#portnumber)_ | Number defines the port number to access the selected model server Pods.<br />The number must be in the range 1 to 65535. | | Maximum: 65535 <br />Minimum: 1 <br /> |
374348

375349

376350
#### PortNumber
@@ -385,7 +359,7 @@ _Validation:_
385359

386360
_Appears in:_
387361
- [Extension](#extension)
388-
- [ExtensionReference](#extensionreference)
362+
- [Port](#port)
389363

390364

391365

0 commit comments

Comments
 (0)