Skip to content

Commit

Permalink
Adds Initial InferencePool Support to GatewayParameters
Browse files Browse the repository at this point in the history
Signed-off-by: Daneyon Hansen <[email protected]>
  • Loading branch information
danehans committed Feb 11, 2025
1 parent ee7fa7b commit 110b220
Show file tree
Hide file tree
Showing 10 changed files with 391 additions and 11 deletions.
23 changes: 23 additions & 0 deletions api/applyconfiguration/api/v1alpha1/endpointpickerextension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions api/applyconfiguration/api/v1alpha1/inferenceextension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions api/applyconfiguration/api/v1alpha1/inferencepoolobjref.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 19 additions & 10 deletions api/applyconfiguration/api/v1alpha1/kubernetesproxyconfig.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions api/applyconfiguration/internal/internal.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions api/applyconfiguration/utils.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions api/v1alpha1/gateway_parameters_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ type KubernetesProxyConfig struct {
// +kubebuilder:validation:Optional
AiExtension *AiExtension `json:"aiExtension,omitempty"`

// InferenceExtension defines the desired state of the Gateway API inference extension.
// For additional details, see: https://gateway-api-inference-extension.sigs.k8s.io/.
//
// InferenceExtension can only be specified when GatewayParameters is referenced by a Gateway.
//
// +kubebuilder:validation:Optional
InferenceExtension *InferenceExtension `json:"inferenceExtension,omitempty"`

// Used to unset the `runAsUser` values in security contexts.
FloatingUserId *bool `json:"floatingUserId,omitempty"`
}
Expand Down Expand Up @@ -612,6 +620,52 @@ type AiExtension struct {
Stats *AiExtensionStats `json:"stats,omitempty"`
}

// InferenceExtension defines the desired state of the Gateway API inference extension.
// For additional details, see: https://gateway-api-inference-extension.sigs.k8s.io/.
type InferenceExtension struct {
// EndpointPickers defines a list of EndpointPicker extensions.
//
// +kubebuilder:validation:MaxItems=8
EndpointPickers []EndpointPickerExtension `json:"endpointPickers"`
}

// EndpointPickerExtension defines the desired state of an EndpointPicker extension.
type EndpointPickerExtension struct {
// PoolRef is a reference to an InferencePool associated to the Endpoint Picker extension.
// The referenced InferencePool must exist in the same namespace as the Gateway that references
// this GatewayParameters.
//
// +kubebuilder:validation:Required
PoolRef InferencePoolObjRef `json:"poolRef"`
}

// InferencePoolObjRef is a reference to an InferencePool.
type InferencePoolObjRef struct {
// Group is the group of the referent.
//
// +optional
// +kubebuilder:default="inference.networking.x-k8s.io"
// +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])?)*$`
Group string `json:"group,omitempty"`

// Kind is kind of the referent.
//
// +optional
// +kubebuilder:default="InferencePool"
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$`
Kind string `json:"kind,omitempty"`

// Name is the name of the referent.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Required
Name string `json:"name"`
}

func (in *AiExtension) GetEnabled() *bool {
if in == nil {
return nil
Expand Down
56 changes: 56 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,39 @@ spec:
type: object
floatingUserId:
type: boolean
inferenceExtension:
properties:
endpointPickers:
items:
properties:
poolRef:
properties:
group:
default: inference.networking.x-k8s.io
maxLength: 253
pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$
type: string
kind:
default: InferencePool
maxLength: 63
minLength: 1
pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$
type: string
name:
maxLength: 253
minLength: 1
type: string
required:
- name
type: object
required:
- poolRef
type: object
maxItems: 8
type: array
required:
- endpointPickers
type: object
istio:
properties:
customSidecars:
Expand Down
Loading

0 comments on commit 110b220

Please sign in to comment.