-
Notifications
You must be signed in to change notification settings - Fork 176
Multi-Cluster: Adds v1alpha1 API Types and Docs #1658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
// Package v1alpha1 contains API Schema definitions for the | ||
// inference.networking.x-k8s.io API group. | ||
// | ||
// +kubebuilder:object:generate=true | ||
// +groupName=inference.networking.x-k8s.io | ||
package v1alpha1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
v1 "sigs.k8s.io/gateway-api-inference-extension/api/v1" | ||
) | ||
|
||
// InferencePoolImport is the Schema for the InferencePoolImports API. | ||
// | ||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:shortName=infpimp | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:storageversion | ||
// +genclient | ||
type InferencePoolImport struct { | ||
metav1.TypeMeta `json:",inline"` | ||
|
||
// +optional | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Status defines the observed state of the InferencePoolImport. | ||
// | ||
// +optional | ||
//nolint:kubeapilinter // status should not be a pointer. | ||
Status InferencePoolImportStatus `json:"status,omitempty"` | ||
} | ||
|
||
// InferencePoolImportList contains a list of InferencePoolImports. | ||
// | ||
// +kubebuilder:object:root=true | ||
type InferencePoolImportList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []InferencePoolImport `json:"items"` | ||
} | ||
|
||
// InferencePoolImportStatus defines the observed state of the InferencePoolImport. | ||
type InferencePoolImportStatus struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we have some field like this in here? https://github.com/kubernetes-sigs/gateway-api/blob/530c1ee46e0d851d369810e4500f0339c40d8aa1/apis/v1/gateway_types.go#L1022 This can be useful for some implementation specific metadata propagation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bexxmodd adding ^ would modify the proposal. I can potentially see differing views on how this metadata should be propagated. If this important to you, can you create an issue or link it to here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SG. I'll create a new issue. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @bexxmodd when you have a moment, please link the issue here and resolve this conversation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /link #1674 |
||
// Controllers is a list of controllers that are responsible for managing the InferencePoolImport. | ||
// | ||
// +listType=map | ||
// +listMapKey=name | ||
// +kubebuilder:validation:MaxItems=8 | ||
// +kubebuilder:validation:Required | ||
Controllers []ImportController `json:"controllers"` | ||
} | ||
|
||
// ImportController defines a controller that is responsible for managing the InferencePoolImport. | ||
type ImportController struct { | ||
danehans marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Name is a domain/path string that indicates the name of the controller that manages the | ||
// InferencePoolImport. Name corresponds to the GatewayClass controllerName field when the | ||
// controller will manage parents of type "Gateway". Otherwise, the name is implementation-specific. | ||
// | ||
// Example: "example.net/import-controller". | ||
// | ||
// The format of this field is DOMAIN "/" PATH, where DOMAIN and PATH are valid Kubernetes | ||
// names (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names). | ||
// | ||
// A controller MUST populate this field when writing status and ensure that entries to status | ||
// populated with their controller name are removed when they are no longer necessary. | ||
// | ||
// +required | ||
Name ControllerName `json:"name"` | ||
|
||
// ExportingClusters is a list of clusters that exported the InferencePool(s) that back the | ||
// InferencePoolImport. Required when the controller is responsible for CRUD'ing the InferencePoolImport | ||
// from the exported InferencePool(s). | ||
// | ||
// +optional | ||
ExportingClusters []ExportingCluster `json:"exportingClusters,omitempty"` | ||
|
||
// Parents is a list of parent resources, typically Gateways, that are associated with the | ||
// InferencePoolImport, and the status of the InferencePoolImport with respect to each parent. | ||
// | ||
// Ancestor would be a more accurate name, but Parent is consistent with InferencePool terminology. | ||
// | ||
// Required when the controller manages the InferencePoolImport as an HTTPRoute backendRef. The controller | ||
// must add an entry for each parent it manages and remove the parent entry when the controller no longer | ||
// considers the InferencePoolImport to be associated with that parent. | ||
// | ||
// +optional | ||
// +listType=atomic | ||
Parents []v1.ParentStatus `json:"parents,omitempty"` | ||
|
||
// Conditions track the state of the InferencePoolImport. | ||
// | ||
// Known condition types are: | ||
// | ||
// * "Accepted" | ||
// | ||
// +optional | ||
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MaxItems=8 | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// ControllerName is the name of a controller that manages a resource. It must be a domain prefixed path. | ||
// | ||
// Valid values include: | ||
// | ||
// - "example.com/bar" | ||
// | ||
// Invalid values include: | ||
// | ||
// - "example.com" - must include path | ||
// - "foo.example.com" - must include path | ||
// | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=253 | ||
// +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\/\-._~%!$&'()*+,;=:]+$` | ||
type ControllerName string | ||
|
||
// ClusterName is the name of a cluster that exported the InferencePool. | ||
// | ||
// +kubebuilder:validation:MinLength=1 | ||
// +kubebuilder:validation:MaxLength=253 | ||
type ClusterName string | ||
|
||
// ExportingCluster defines a cluster that exported the InferencePool that backs this InferencePoolImport. | ||
type ExportingCluster struct { | ||
// Name of the exporting cluster (must be unique within the list). | ||
// | ||
// +kubebuilder:validation:Required | ||
Name ClusterName `json:"name"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Was chatting with @bexxmodd about this earlier today and he pointed out that we likely also need some basic information about the EPP in each cluster here. I think this can/should be an additive change, so don't want to block this PR for this, just raising it as an addition that would be helpful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could also be useful to store some per-cluster metadata beyond name, maybe conceptually similar to the |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Copyright 2025 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
// ExportAnnotationKey is the annotation key used to export an InferencePool. | ||
var ExportAnnotationKey = "inference.networking.x-k8s.io/export" | ||
|
||
// ExportAnnotationVal is the annotation value used to export an InferencePool | ||
// to all clusters. | ||
var ExportAnnotationVal = "ClusterSet" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the value for a non-exported InferencePool? "Invalid" doesn't sound right IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah +1, Added some suggested reasons above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are a few other options we can take:
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commit f0fbeb9 proceeds with option 3 above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the recommendations in 3. If the InferencePool has not been exported, then that should be clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@keithmattix commit f0fbeb9 proceeds with option 3, PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM