generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Open
danehans
wants to merge
2
commits into
kubernetes-sigs:main
Choose a base branch
from
danehans:issue_1654
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,077
−10
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
||
// 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"` | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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