Skip to content

Commit c469119

Browse files
committed
Multi-Cluster: Adds v1alpha1 API Types and Docs
Signed-off-by: Daneyon Hansen <[email protected]>
1 parent ea15bdc commit c469119

40 files changed

+2095
-9
lines changed

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,13 +303,24 @@ live-docs:
303303
docker build -t gaie/mkdocs hack/mkdocs/image
304304
docker run --rm -it -p 3000:3000 -v ${PWD}:/docs gaie/mkdocs
305305

306-
.PHONY: apix-ref-docs
307-
apix-ref-docs: crd-ref-docs
306+
.PHONY: api-ref-docs-all
307+
api-ref-docs-all: apix-v1a1-ref-docs apix-v1a2-ref-docs api-ref-docs
308+
309+
.PHONY: apix-v1a1-ref-docs
310+
apix-v1a1-ref-docs: crd-ref-docs
311+
${CRD_REF_DOCS} \
312+
--source-path=${PWD}/apix/v1alpha1 \
313+
--config=crd-ref-docs.yaml \
314+
--renderer=markdown \
315+
--output-path=${PWD}/site-src/reference/x-v1a1-spec.md
316+
317+
.PHONY: apix-v1a2-ref-docs
318+
apix-v1a2-ref-docs: crd-ref-docs
308319
${CRD_REF_DOCS} \
309320
--source-path=${PWD}/apix/v1alpha2 \
310321
--config=crd-ref-docs.yaml \
311322
--renderer=markdown \
312-
--output-path=${PWD}/site-src/reference/x-spec.md
323+
--output-path=${PWD}/site-src/reference/x-v1a2-spec.md
313324

314325
.PHONY: api-ref-docs
315326
api-ref-docs: crd-ref-docs

api/v1/inferencepool_types.go

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,42 @@ type ParentStatus struct {
200200
//
201201
// +required
202202
ParentRef ParentReference `json:"parentRef,omitzero"`
203+
204+
// ControllerName is a domain/path string that indicates the name of the controller that
205+
// wrote this status. This corresponds with the GatewayClass controllerName field when the
206+
// parentRef references a Gateway kind.
207+
//
208+
// Example: "example.net/gateway-controller".
209+
//
210+
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are valid Kubernetes names:
211+
//
212+
// https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
213+
//
214+
// Controllers MUST populate this field when writing status. Controllers should ensure that
215+
// entries to status populated with their ControllerName are cleaned up when they are no
216+
// longer necessary.
217+
//
218+
// +required
219+
ControllerName ParentController `json:"controllerName"`
203220
}
204221

222+
// ParentController is the name of a controller that manages ParentStatus. It must be a domain prefixed
223+
// path.
224+
//
225+
// Valid values include:
226+
//
227+
// * "example.com/bar"
228+
//
229+
// Invalid values include:
230+
//
231+
// * "example.com" - must include path
232+
// * "foo.example.com" - must include path
233+
//
234+
// +kubebuilder:validation:MinLength=1
235+
// +kubebuilder:validation:MaxLength=253
236+
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$`
237+
type ParentController string
238+
205239
// InferencePoolConditionType is a type of status condition for the InferencePool.
206240
type InferencePoolConditionType string
207241

@@ -272,6 +306,32 @@ const (
272306
InferencePoolReasonInvalidExtensionRef InferencePoolReason = "InvalidExtensionRef"
273307
)
274308

309+
const (
310+
// InferencePoolConditionExported is a type of condition that indicates whether the
311+
// controller was able to export the InferencePool to the specified clusters.
312+
//
313+
// Possible reasons for this condition to be True are:
314+
//
315+
// * "Exported"
316+
//
317+
// Possible reasons for this condition to be False are:
318+
//
319+
// * "Invalid"
320+
//
321+
// Controllers MAY raise this condition with other reasons, but should
322+
// prefer to use the reasons listed above to improve interoperability.
323+
InferencePoolConditionExported InferencePoolConditionType = "Exported"
324+
325+
// InferencePoolReasonExported is a reason used with the "Exported" condition when the
326+
// condition is true.
327+
InferencePoolReasonExported InferencePoolReason = "Exported"
328+
329+
// InferencePoolReasonInvalid is a reason used with the "Exported" condition when the
330+
// InferencePool cannot be exported for some reason. A controller should provide
331+
// additional information in the condition message.
332+
InferencePoolReasonInvalid InferencePoolReason = "Invalid"
333+
)
334+
275335
// ParentReference identifies an API object. It is used to associate the InferencePool with a
276336
// parent resource, such as a Gateway.
277337
type ParentReference struct {

apix/v1alpha1/doc.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
// Package v1alpha1 contains API Schema definitions for the
18+
// inference.networking.x-k8s.io API group.
19+
//
20+
// +kubebuilder:object:generate=true
21+
// +groupName=inference.networking.x-k8s.io
22+
package v1alpha1
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
import (
20+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
21+
22+
v1 "sigs.k8s.io/gateway-api-inference-extension/api/v1"
23+
)
24+
25+
// InferencePoolImport is the Schema for the InferencePoolImports API.
26+
//
27+
// +kubebuilder:object:root=true
28+
// +kubebuilder:resource:shortName=infpimp
29+
// +kubebuilder:subresource:status
30+
// +kubebuilder:storageversion
31+
// +genclient
32+
type InferencePoolImport struct {
33+
metav1.TypeMeta `json:",inline"`
34+
35+
// +optional
36+
metav1.ObjectMeta `json:"metadata,omitempty"`
37+
38+
// Spec defines the desired state of the InferencePoolImport.
39+
//
40+
// +required
41+
Spec InferencePoolImportSpec `json:"spec,omitzero"`
42+
43+
// Status defines the observed state of the InferencePoolImport.
44+
//
45+
// +optional
46+
//nolint:kubeapilinter // status should not be a pointer.
47+
Status InferencePoolImportStatus `json:"status,omitempty"`
48+
}
49+
50+
// InferencePoolImportList contains a list of InferencePoolImports.
51+
//
52+
// +kubebuilder:object:root=true
53+
type InferencePoolImportList struct {
54+
metav1.TypeMeta `json:",inline"`
55+
metav1.ListMeta `json:"metadata,omitempty"`
56+
Items []InferencePoolImport `json:"items"`
57+
}
58+
59+
// InferencePoolImportSpec defines the desired state of the InferencePoolImport.
60+
type InferencePoolImportSpec struct {}
61+
62+
// InferencePoolImportStatus defines the observed state of the InferencePoolImport.
63+
type InferencePoolImportStatus struct {
64+
// Controllers is a list of controllers that are responsible for managing the InferencePoolImport.
65+
//
66+
// +listType=map
67+
// +listMapKey=name
68+
// +kubebuilder:validation:MaxItems=8
69+
// +kubebuilder:validation:Required
70+
Controllers []ImportController `json:"controllers"`
71+
}
72+
73+
// ImportController defines a controller that is responsible for managing the InferencePoolImport.
74+
type ImportController struct {
75+
// Name is a domain/path string that indicates the name of the controller that manages the
76+
// InferencePoolImport. Name corresponds to the GatewayClass controllerName field when the
77+
// controller will manage parents of type "Gateway". Otherwise, the name is implementation-specific.
78+
//
79+
// Example: "example.net/import-controller".
80+
//
81+
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are valid Kubernetes
82+
// names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names).
83+
//
84+
// A controller MUST populate this field when writing status and ensure that entries to status
85+
// populated with their controller name are removed when they are no longer necessary.
86+
//
87+
// +required
88+
Name ControllerName `json:"name"`
89+
90+
// ExportingClusters is a list of clusters that exported the InferencePool(s) that back the
91+
// InferencePoolImport. Required when the controller is responsible for CRUD'ing the InferencePoolImport
92+
// from the exported InferencePool(s).
93+
//
94+
// +optional
95+
ExportingClusters []ExportingCluster `json:"exportingClusters,omitempty"`
96+
97+
// Parents is a list of parent resources, typically Gateways, that are associated with the
98+
// InferencePoolImport, and the status of the InferencePoolImport with respect to each parent.
99+
//
100+
// Ancestor would be a more accurate name, but Parent is consistent with InferencePool terminology.
101+
//
102+
// Required when the controller manages the InferencePoolImport as an HTTPRoute backendRef. The controller
103+
// must add an entry for each parent it manages and remove the parent entry when the controller no longer
104+
// considers the InferencePoolImport to be associated with that parent.
105+
//
106+
// +optional
107+
// +listType=atomic
108+
Parents []v1.ParentStatus `json:"parents,omitempty"`
109+
110+
// Conditions track the state of the InferencePoolImport.
111+
//
112+
// Known condition types are:
113+
//
114+
// * "Accepted"
115+
//
116+
// +optional
117+
// +listType=map
118+
// +listMapKey=type
119+
// +kubebuilder:validation:MaxItems=8
120+
Conditions []metav1.Condition `json:"conditions,omitempty"`
121+
}
122+
123+
// ControllerName is the name of a controller that manages a resource. It must be a domain prefixed path.
124+
//
125+
// Valid values include:
126+
//
127+
// * "example.com/bar"
128+
//
129+
// Invalid values include:
130+
//
131+
// * "example.com" - must include path
132+
// * "foo.example.com" - must include path
133+
//
134+
// +kubebuilder:validation:MinLength=1
135+
// +kubebuilder:validation:MaxLength=253
136+
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/[A-Za-z0-9\/\-._~%!$&'()*+,;=:]+$`
137+
type ControllerName string
138+
139+
// ExportingCluster defines a cluster that exported the InferencePool associated to this InferencePoolImport.
140+
type ExportingCluster struct {
141+
// Name of the exporting cluster (must be unique within the list).
142+
//
143+
// +kubebuilder:validation:Required
144+
Name string `json:"name"`
145+
}

apix/v1alpha1/shared_types.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2025 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package v1alpha1
18+
19+
// ExportAnnotationKey is the annotation key used to export an InferencePool.
20+
var ExportAnnotationKey = "inference.networking.x-k8s.io/export"
21+
22+
// ExportAnnotationVal is the annotation value used to export an InferencePool
23+
// to all clusters.
24+
var ExportAnnotationVal = "ClusterSet"

0 commit comments

Comments
 (0)