components

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ComponentTypePredictor = "predictor"
	ComponentTypeEngine    = "engine"
	ComponentTypeDecoder   = "decoder"
)

ComponentType constants for different component types

Variables

This section is empty.

Functions

func ProcessBaseAnnotations

func ProcessBaseAnnotations(b *BaseComponentFields, isvc *v1beta1.InferenceService, annotations map[string]string) (map[string]string, error)

ProcessBaseAnnotations processes common annotations

func ProcessBaseLabels

func ProcessBaseLabels(b *BaseComponentFields, isvc *v1beta1.InferenceService, componentType v1beta1.ComponentType, labels map[string]string) map[string]string

ProcessBaseLabels processes common labels

func ReconcileFineTunedWeights

func ReconcileFineTunedWeights(b *BaseComponentFields, isvc *v1beta1.InferenceService) error

ReconcileFineTunedWeights reconciles fine-tuned weights for any component

func UpdateComponentStatus

func UpdateComponentStatus(b *BaseComponentFields, isvc *v1beta1.InferenceService, componentType v1beta1.ComponentType, objectMeta metav1.ObjectMeta, getPodLabelInfo func(bool, metav1.ObjectMeta, v1beta1.ComponentStatusSpec) (string, string)) error

UpdateComponentStatus updates component status based on deployment mode This method provides a systematic way to handle status updates across all components

func UpdateEnvVariables

func UpdateEnvVariables(b *BaseComponentFields, isvc *v1beta1.InferenceService, container *corev1.Container, objectMeta *metav1.ObjectMeta)

UpdateEnvVariables updates environment variables for the container

func UpdatePodSpecNodeSelector added in v0.1.3

func UpdatePodSpecNodeSelector(b *BaseComponentFields, isvc *v1beta1.InferenceService, podSpec *corev1.PodSpec)

UpdatePodSpecNodeSelector updates pod spec with node selector for model scheduling

func UpdatePodSpecVolumes

func UpdatePodSpecVolumes(b *BaseComponentFields, isvc *v1beta1.InferenceService, podSpec *corev1.PodSpec, objectMeta *metav1.ObjectMeta)

UpdatePodSpecVolumes updates pod spec with common volumes

func UpdateVolumeMounts

func UpdateVolumeMounts(b *BaseComponentFields, isvc *v1beta1.InferenceService, container *corev1.Container, objectMeta *metav1.ObjectMeta)

UpdateVolumeMounts updates volume mounts for the container

Types

type BaseComponentFields

type BaseComponentFields struct {
	Client                            client.Client
	Clientset                         kubernetes.Interface
	Scheme                            *runtime.Scheme
	InferenceServiceConfig            *controllerconfig.InferenceServicesConfig
	DeploymentMode                    constants.DeploymentModeType
	BaseModel                         *v1beta1.BaseModelSpec
	BaseModelMeta                     *metav1.ObjectMeta
	Runtime                           *v1beta1.ServingRuntimeSpec
	RuntimeName                       string
	FineTunedServing                  bool
	FineTunedServingWithMergedWeights bool
	FineTunedWeights                  []*v1beta1.FineTunedWeight
	StatusManager                     *status.StatusReconciler
	Log                               logr.Logger
}

BaseComponentFields contains common fields for all components

type Component

type Component interface {
	Reconcile(isvc *v1beta1.InferenceService) (ctrl.Result, error)
}

Component can be reconciled to create underlying resources for an InferenceService

func NewDecoder

func NewDecoder(
	client client.Client,
	clientset kubernetes.Interface,
	scheme *runtime.Scheme,
	inferenceServiceConfig *controllerconfig.InferenceServicesConfig,
	deploymentMode constants.DeploymentModeType,
	baseModel *v1beta1.BaseModelSpec,
	baseModelMeta *metav1.ObjectMeta,
	decoderSpec *v1beta1.DecoderSpec,
	runtime *v1beta1.ServingRuntimeSpec,
	runtimeName string,
) Component

NewDecoder creates a new Decoder component instance

func NewEngine

func NewEngine(
	client client.Client,
	clientset kubernetes.Interface,
	scheme *runtime.Scheme,
	inferenceServiceConfig *controllerconfig.InferenceServicesConfig,
	deploymentMode constants.DeploymentModeType,
	baseModel *v1beta1.BaseModelSpec,
	baseModelMeta *metav1.ObjectMeta,
	engineSpec *v1beta1.EngineSpec,
	runtime *v1beta1.ServingRuntimeSpec,
	runtimeName string,
) Component

NewEngine creates a new Engine component instance

func NewRouter

func NewRouter(
	client client.Client,
	clientset kubernetes.Interface,
	scheme *runtime.Scheme,
	inferenceServiceConfig *controllerconfig.InferenceServicesConfig,
	deploymentMode constants.DeploymentModeType,
	baseModel *v1beta1.BaseModelSpec,
	baseModelMeta *metav1.ObjectMeta,
	routerSpec *v1beta1.RouterSpec,
	runtime *v1beta1.ServingRuntimeSpec,
	runtimeName string,
) Component

NewRouter creates a new Router component instance

type ComponentBuilder

type ComponentBuilder struct {
	// contains filtered or unexported fields
}

ComponentBuilder helps build components with common configuration

func NewComponentBuilder

func NewComponentBuilder(
	client client.Client,
	clientset kubernetes.Interface,
	scheme *runtime.Scheme,
	inferenceServiceConfig *controllerconfig.InferenceServicesConfig,
) *ComponentBuilder

NewComponentBuilder creates a new component builder

func (*ComponentBuilder) BuildCustomComponent

func (b *ComponentBuilder) BuildCustomComponent(componentType v1beta1.ComponentType, strategy ComponentConfig) Component

BuildCustomComponent creates a custom component with a strategy

func (*ComponentBuilder) BuildDecoder

func (b *ComponentBuilder) BuildDecoder(spec *v1beta1.DecoderSpec) Component

BuildDecoder creates a Decoder component

func (*ComponentBuilder) BuildEngine

func (b *ComponentBuilder) BuildEngine(spec *v1beta1.EngineSpec) Component

BuildEngine creates an Engine component

func (*ComponentBuilder) BuildRouter

func (b *ComponentBuilder) BuildRouter(spec *v1beta1.RouterSpec) Component

BuildRouter creates a Router component

func (*ComponentBuilder) WithBaseModel

func (b *ComponentBuilder) WithBaseModel(spec *v1beta1.BaseModelSpec, meta *metav1.ObjectMeta) *ComponentBuilder

WithBaseModel sets the base model

func (*ComponentBuilder) WithDeploymentMode

func (b *ComponentBuilder) WithDeploymentMode(mode constants.DeploymentModeType) *ComponentBuilder

WithDeploymentMode sets the deployment mode

func (*ComponentBuilder) WithLogger

func (b *ComponentBuilder) WithLogger(logger logr.Logger) *ComponentBuilder

WithLogger sets a custom logger

func (*ComponentBuilder) WithRuntime

func (b *ComponentBuilder) WithRuntime(spec *v1beta1.ServingRuntimeSpec, name string) *ComponentBuilder

WithRuntime sets the runtime

type ComponentBuilderFactory

type ComponentBuilderFactory struct {
	// contains filtered or unexported fields
}

ComponentBuilderFactory provides a factory for creating builders

func NewComponentBuilderFactory

func NewComponentBuilderFactory(
	client client.Client,
	clientset kubernetes.Interface,
	scheme *runtime.Scheme,
	inferenceServiceConfig *controllerconfig.InferenceServicesConfig,
) *ComponentBuilderFactory

NewComponentBuilderFactory creates a new factory

func (*ComponentBuilderFactory) CreateDecoderComponent

func (f *ComponentBuilderFactory) CreateDecoderComponent(
	deploymentMode constants.DeploymentModeType,
	baseModel *v1beta1.BaseModelSpec,
	baseModelMeta *metav1.ObjectMeta,
	decoderSpec *v1beta1.DecoderSpec,
	runtime *v1beta1.ServingRuntimeSpec,
	runtimeName string,
) Component

CreateDecoderComponent is a convenience method to create a decoder component

func (*ComponentBuilderFactory) CreateEngineComponent

func (f *ComponentBuilderFactory) CreateEngineComponent(
	deploymentMode constants.DeploymentModeType,
	baseModel *v1beta1.BaseModelSpec,
	baseModelMeta *metav1.ObjectMeta,
	engineSpec *v1beta1.EngineSpec,
	runtime *v1beta1.ServingRuntimeSpec,
	runtimeName string,
) Component

CreateEngineComponent is a convenience method to create an engine component

func (*ComponentBuilderFactory) CreateRouterComponent

func (f *ComponentBuilderFactory) CreateRouterComponent(
	deploymentMode constants.DeploymentModeType,
	baseModel *v1beta1.BaseModelSpec,
	baseModelMeta *metav1.ObjectMeta,
	routerSpec *v1beta1.RouterSpec,
	runtime *v1beta1.ServingRuntimeSpec,
	runtimeName string,
) Component

CreateRouterComponent is a convenience method to create a router component

func (*ComponentBuilderFactory) NewBuilder

func (f *ComponentBuilderFactory) NewBuilder() *ComponentBuilder

NewBuilder creates a new component builder

type ComponentConfig

type ComponentConfig interface {
	// GetComponentType returns the component type (engine, decoder, etc.)
	GetComponentType() v1beta1.ComponentType

	// GetComponentSpec returns the component extension spec
	GetComponentSpec() *v1beta1.ComponentExtensionSpec

	// GetServiceSuffix returns the suffix for the service name
	GetServiceSuffix() string

	// ValidateSpec validates the component spec
	ValidateSpec() error
}

ComponentConfig defines the interface for component-specific configuration

type ComponentFactory

type ComponentFactory interface {
	// CreateComponent creates a component based on the spec
	CreateComponent(spec interface{}) (Component, error)

	// GetSupportedComponentTypes returns the component types this factory can create
	GetSupportedComponentTypes() []v1beta1.ComponentType
}

ComponentFactory defines the interface for creating components

type ComponentReconciler

type ComponentReconciler interface {
	Component
	ComponentConfig
	PodSpecProvider
}

ComponentReconciler defines the full interface for a component reconciler

type Decoder

type Decoder struct {
	BaseComponentFields
	// contains filtered or unexported fields
}

Decoder reconciles resources for the decoder component

func (*Decoder) Reconcile

func (d *Decoder) Reconcile(isvc *v1beta1.InferenceService) (ctrl.Result, error)

Reconcile implements the Component interface for Decoder

type DeploymentStrategy

type DeploymentStrategy interface {
	// SupportsDeploymentMode checks if the component supports a deployment mode
	SupportsDeploymentMode(mode constants.DeploymentModeType) bool

	// GetPreferredDeploymentMode returns the preferred deployment mode
	GetPreferredDeploymentMode() constants.DeploymentModeType
}

DeploymentStrategy defines deployment-specific operations

type Engine

type Engine struct {
	BaseComponentFields
	// contains filtered or unexported fields
}

Engine reconciles resources for the engine component

func (*Engine) Reconcile

func (e *Engine) Reconcile(isvc *v1beta1.InferenceService) (ctrl.Result, error)

Reconcile implements the Component interface for Engine

type MetadataProvider

type MetadataProvider interface {
	// ProcessAnnotations processes component-specific annotations
	ProcessAnnotations(isvc *v1beta1.InferenceService, existing map[string]string) (map[string]string, error)

	// ProcessLabels processes component-specific labels
	ProcessLabels(isvc *v1beta1.InferenceService, existing map[string]string) map[string]string

	// DetermineServiceName determines the service name for the component
	DetermineServiceName(isvc *v1beta1.InferenceService) (string, error)
}

MetadataProvider defines operations for component metadata

type PodSpecProvider

type PodSpecProvider interface {
	// GetPodSpec returns the pod spec for the component
	GetPodSpec() *v1beta1.PodSpec

	// GetRunnerSpec returns the runner spec if available
	GetRunnerSpec() *v1beta1.RunnerSpec

	// GetLeaderSpec returns the leader spec for multi-node deployments
	GetLeaderSpec() (*v1beta1.PodSpec, *v1beta1.RunnerSpec)

	// GetWorkerSpec returns the worker spec for multi-node deployments
	GetWorkerSpec() (*v1beta1.PodSpec, *v1beta1.RunnerSpec, *int)
}

PodSpecProvider defines the interface for providing pod specifications

type ReconcileHooks

type ReconcileHooks interface {
	// BeforeReconcile is called before main reconciliation logic
	BeforeReconcile(isvc *v1beta1.InferenceService) error

	// AfterReconcile is called after successful reconciliation
	AfterReconcile(isvc *v1beta1.InferenceService, result ctrl.Result) error

	// OnReconcileError is called when reconciliation fails
	OnReconcileError(isvc *v1beta1.InferenceService, err error) error
}

ReconcileHooks defines optional hooks for customizing reconciliation

type Router

type Router struct {
	BaseComponentFields
	// contains filtered or unexported fields
}

Router reconciles resources for the router component

func (*Router) Reconcile

func (r *Router) Reconcile(isvc *v1beta1.InferenceService) (ctrl.Result, error)

Reconcile implements the Component interface for Router

type StatusUpdater

type StatusUpdater interface {
	// UpdateComponentStatus updates the component-specific status
	UpdateComponentStatus(isvc *v1beta1.InferenceService, objectMeta metav1.ObjectMeta) error

	// GetPodLabelInfo returns pod label key and value for status tracking
	GetPodLabelInfo(rawDeployment bool, objectMeta metav1.ObjectMeta, statusSpec v1beta1.ComponentStatusSpec) (string, string)
}

StatusUpdater defines component-specific status update operations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL