-
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
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -202,8 +202,43 @@ type ParentStatus struct { | |
// | ||
// +required | ||
ParentRef ParentReference `json:"parentRef,omitzero"` | ||
|
||
// ControllerName is a domain/path string that indicates the name of the controller that | ||
// wrote this status. This corresponds with the GatewayClass controllerName field when the | ||
// parentRef references a Gateway kind. | ||
// | ||
// Example: "example.net/gateway-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 | ||
// | ||
// Controllers MUST populate this field when writing status. Controllers should ensure that | ||
// entries to status populated with their ControllerName are cleaned up when they are no | ||
// longer necessary. | ||
// | ||
// +required | ||
//nolint:kubeapilinter // should not have omitempty since the field is required | ||
ControllerName ControllerName `json:"controllerName"` | ||
} | ||
|
||
// ControllerName is the name of a controller that manages ParentStatus. 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 | ||
|
||
// InferencePoolConditionType is a type of status condition for the InferencePool. | ||
type InferencePoolConditionType string | ||
|
||
|
@@ -274,6 +309,38 @@ const ( | |
InferencePoolReasonInvalidExtensionRef InferencePoolReason = "InvalidExtensionRef" | ||
) | ||
|
||
const ( | ||
// InferencePoolConditionExported is a type of condition that indicates whether the | ||
// controller was able to export the InferencePool to the specified clusters. | ||
// | ||
// Possible reasons for this condition to be True are: | ||
// | ||
// * "Exported" | ||
// | ||
// Possible reasons for this condition to be False are: | ||
// | ||
// * "NotRequested" | ||
// * "NotSupported" | ||
// | ||
// Controllers MAY raise this condition with other reasons, but should | ||
// prefer to use the reasons listed above to improve interoperability. | ||
InferencePoolConditionExported InferencePoolConditionType = "Exported" | ||
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. 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. LGTM |
||
|
||
// InferencePoolReasonExported is a reason used with the "Exported" condition when the | ||
// condition is true. | ||
InferencePoolReasonExported InferencePoolReason = "Exported" | ||
|
||
// InferencePoolReasonNotRequested is a reason used with the "Exported" condition when the | ||
// condition is false and no export was requested by the InferencePool. This indicates a | ||
// deliberate non-action rather than an error. | ||
InferencePoolReasonNotRequested InferencePoolReason = "NotRequested" | ||
|
||
// InferencePoolReasonNotSupported is a reason used with the "Exported" condition when the | ||
// condition is false and the export was requested but is not supported by the implementation. | ||
// Controllers should include details in the condition message. | ||
InferencePoolReasonNotSupported InferencePoolReason = "NotSupported" | ||
) | ||
|
||
// ParentReference identifies an API object. It is used to associate the InferencePool with a | ||
// parent resource, such as a Gateway. | ||
type ParentReference struct { | ||
|
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"` | ||
} |
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.
Can we make these changes in a v1alpha3 inferencepool? I'm concerned about fullsending changes to v1 on the first iteration.
Cc: @robscott @ahg-g
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.
We should make this field optional so the change is backwards-compatible, but other than that, there's plenty of precedence for this field existing in GW API statuses. It was an accidental omission from the v1 API.
As far as the mechanics of API versions - we'd actually have to create
v2alpha1
if we wanted to make breaking changes. In Gateway API, we created an "experimental" channel that allows us to gate fields like this by only including them in experimental CRDs (conceptually similar to feature gates in k/k). While I think that's inevitable here, I personally don't think this change is large enough to justify creating the separate release channel.