Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultRoutePath(service *aimv1alpha1.AIMService) string
- func FindMatchingCustomModel(ctx context.Context, c client.Client, namespace string, ...) (*aimv1alpha1.AIMModel, error)
- func GenerateCustomModelName(custom *aimv1alpha1.AIMServiceModelCustom) string
- func GenerateHTTPRouteName(serviceName, namespace string) (string, error)
- func GenerateInferenceServiceName(serviceName, namespace string) (string, error)
- func GenerateModelName(imageURI string) (string, error)
- func GenerateTemplateCacheName(templateName, namespace, serviceName, serviceIdentity string, ...) (string, error)
- func ResolveServiceRoutePath(service *aimv1alpha1.AIMService, ...) (string, error)
- func ResolveServiceRouteTimeout(service *aimv1alpha1.AIMService, ...) *string
- type CandidateEvaluation
- type ModelFetchResult
- type SelectionDiagnostics
- type ServiceFetchResult
- type ServiceObservation
- type ServiceReconciler
- func (r *ServiceReconciler) ComposeState(_ context.Context, _ controllerutils.ReconcileContext[*aimv1alpha1.AIMService], ...) ServiceObservation
- func (r *ServiceReconciler) DecorateStatus(status *aimv1alpha1.AIMServiceStatus, _ *controllerutils.ConditionManager, ...)
- func (r *ServiceReconciler) FetchRemoteState(ctx context.Context, c client.Client, ...) ServiceFetchResult
- func (r *ServiceReconciler) PlanResources(ctx context.Context, ...) controllerutils.PlanResult
- type TemplateCandidate
- type TemplateFetchResult
- type TemplateSelectionResult
Constants ¶
const (
// DefaultPVCHeadroomPercent is the default headroom percentage for PVC sizing
DefaultPVCHeadroomPercent = 10
)
const ( // MaxRoutePathLength is the maximum allowed length for a route path. // This prevents excessively long paths that could cause issues with gateways or proxies. MaxRoutePathLength = 200 )
Variables ¶
var ErrMultipleModelsFound = errors.New("multiple models found with the same image")
ErrMultipleModelsFound is returned when multiple models exist with the same image URI
Functions ¶
func DefaultRoutePath ¶
func DefaultRoutePath(service *aimv1alpha1.AIMService) string
DefaultRoutePath returns the default HTTP route prefix.
func FindMatchingCustomModel ¶
func FindMatchingCustomModel( ctx context.Context, c client.Client, namespace string, custom *aimv1alpha1.AIMServiceModelCustom, ) (*aimv1alpha1.AIMModel, error)
FindMatchingCustomModel searches for an existing AIMModel that matches the custom model spec. Matching is based on: - spec.image == custom.baseImage - spec.modelSources match (including env vars for S3 endpoint differentiation)
Only namespace-scoped models are searched since custom models from AIMService are always namespace-scoped.
Returns nil if no matching model is found.
func GenerateCustomModelName ¶
func GenerateCustomModelName(custom *aimv1alpha1.AIMServiceModelCustom) string
GenerateCustomModelName generates a unique name for a custom model. Uses the existing utils.GenerateDerivedName to ensure consistent naming with proper sanitization and hash suffix. Format: {modelId-sanitized}-{hash}
func GenerateHTTPRouteName ¶
GenerateHTTPRouteName creates a deterministic name for the HTTPRoute.
func GenerateInferenceServiceName ¶
GenerateInferenceServiceName creates a deterministic name for the InferenceService. KServe creates hostnames in format {isvc-name}-predictor-{namespace}, which must be ≤ 63 chars. We calculate the maximum allowed InferenceService name length based on the namespace length to ensure the final hostname stays within DNS limits.
func GenerateModelName ¶
GenerateModelName creates a Kubernetes-valid name from an image URI using utils.GenerateDerivedName. Returns an error if the image URI cannot be parsed.
func GenerateTemplateCacheName ¶
func GenerateTemplateCacheName( templateName, namespace, serviceName, serviceIdentity string, cachingMode aimv1alpha1.AIMCachingMode, ) (string, error)
GenerateTemplateCacheName creates a deterministic name for a template cache. For dedicated mode, serviceIdentity should be the service UID to avoid conflicts when a service is deleted and recreated with the same name.
func ResolveServiceRoutePath ¶
func ResolveServiceRoutePath(service *aimv1alpha1.AIMService, runtimeConfig *aimv1alpha1.AIMRuntimeConfigCommon) (string, error)
ResolveServiceRoutePath renders the HTTP route prefix using service and runtime config context. The precedence order is: 1. Service.Spec.Routing.PathTemplate (highest priority) 2. RuntimeConfig.Routing.PathTemplate (base layer)
func ResolveServiceRouteTimeout ¶
func ResolveServiceRouteTimeout(service *aimv1alpha1.AIMService, runtimeConfig *aimv1alpha1.AIMRuntimeConfigCommon) *string
ResolveServiceRouteTimeout resolves the HTTP route timeout using service and runtime config context. The precedence order is: 1. Service.Spec.Routing.RequestTimeout (highest priority) 2. RuntimeConfig.Routing.RequestTimeout (base layer) Returns nil if no timeout is configured at any level.
Types ¶
type CandidateEvaluation ¶
type CandidateEvaluation struct {
Candidate TemplateCandidate
Status string // "chosen" or "rejected"
Reason string // CamelCase reason
Rank int // For candidates that passed all filters
}
CandidateEvaluation captures why a specific candidate was chosen or rejected.
type ModelFetchResult ¶
type ModelFetchResult struct {
Model controllerutils.FetchResult[*aimv1alpha1.AIMModel]
ClusterModel controllerutils.FetchResult[*aimv1alpha1.AIMClusterModel]
// ImageURI is set when Model.Image is specified (needed for building the model in PlanResources).
ImageURI string
// CustomSpec is set when Model.Custom is specified (needed for building the model in PlanResources).
CustomSpec *aimv1alpha1.AIMServiceModelCustom
}
ModelFetchResult holds the result of fetching/resolving a model for the service.
type SelectionDiagnostics ¶
type SelectionDiagnostics struct {
TotalCandidates int
AfterAvailabilityFilter int
AfterUnoptimizedFilter int
AfterOverridesFilter int
AfterGPUAvailabilityFilter int
UnoptimizedTemplatesWereFiltered bool
}
SelectionDiagnostics provides detailed information about why template selection failed.
type ServiceFetchResult ¶
type ServiceFetchResult struct {
// contains filtered or unexported fields
}
ServiceFetchResult holds all fetched resources needed for AIMService reconciliation.
type ServiceObservation ¶
type ServiceObservation struct {
ServiceFetchResult
// contains filtered or unexported fields
}
ServiceObservation embeds the fetch result and adds derived state.
func (ServiceObservation) GetComponentHealth ¶
func (obs ServiceObservation) GetComponentHealth(ctx context.Context, clientset kubernetes.Interface) []controllerutils.ComponentHealth
GetComponentHealth returns health status for each component. NOTE: Unlike other controllers where this is on FetchResult, AIMService defines it on ServiceObservation because model health depends on derived state (needsModelCreation) computed in ComposeState. The template/isvc/cache health helpers remain on ServiceFetchResult and are accessible via embedding.
type ServiceReconciler ¶
type ServiceReconciler struct {
Clientset kubernetes.Interface
Scheme *runtime.Scheme
}
ServiceReconciler implements the domain logic for AIMService reconciliation.
func (*ServiceReconciler) ComposeState ¶
func (r *ServiceReconciler) ComposeState( _ context.Context, _ controllerutils.ReconcileContext[*aimv1alpha1.AIMService], fetch ServiceFetchResult, ) ServiceObservation
ComposeState creates the observation from fetched data, deriving semantic state.
func (*ServiceReconciler) DecorateStatus ¶
func (r *ServiceReconciler) DecorateStatus( status *aimv1alpha1.AIMServiceStatus, _ *controllerutils.ConditionManager, obs ServiceObservation, )
DecorateStatus sets domain-specific status fields. Resolved references are only set when the upstream resource is Ready. This ensures we don't "lock in" a reference until it's actually usable, allowing the fetch logic to re-search for better alternatives on subsequent reconciles.
func (*ServiceReconciler) FetchRemoteState ¶
func (r *ServiceReconciler) FetchRemoteState( ctx context.Context, c client.Client, reconcileCtx controllerutils.ReconcileContext[*aimv1alpha1.AIMService], ) ServiceFetchResult
FetchRemoteState fetches all resources needed for AIMService reconciliation. - Always fetch: InferenceService, HTTPRoute, TemplateCache (for health visibility) - Fetch when ISVC not found OR successfully fetched: Model, Template (for both creation and update) - Skip on transient ISVC fetch errors: Model, Template (to avoid accidental SSA re-applies)
func (*ServiceReconciler) PlanResources ¶
func (r *ServiceReconciler) PlanResources( ctx context.Context, _ controllerutils.ReconcileContext[*aimv1alpha1.AIMService], obs ServiceObservation, ) controllerutils.PlanResult
PlanResources determines what resources need to be created or updated.
type TemplateCandidate ¶
type TemplateCandidate struct {
Name string
Namespace string
Scope aimv1alpha1.AIMResolutionScope
Spec aimv1alpha1.AIMServiceTemplateSpecCommon
Status aimv1alpha1.AIMServiceTemplateStatus
}
TemplateCandidate captures the information needed to evaluate a template during selection.
type TemplateFetchResult ¶
type TemplateFetchResult struct {
Template controllerutils.FetchResult[*aimv1alpha1.AIMServiceTemplate]
ClusterTemplate controllerutils.FetchResult[*aimv1alpha1.AIMClusterServiceTemplate]
}
TemplateFetchResult holds the result of fetching/resolving a template for the service.
type TemplateSelectionResult ¶
type TemplateSelectionResult struct {
SelectedTemplate *aimv1alpha1.AIMServiceTemplate
SelectedClusterTemplate *aimv1alpha1.AIMClusterServiceTemplate
CandidateCount int
TemplatesExistButNotReady bool
SelectionReason string
SelectionMessage string
MatchingResults []aimv1alpha1.AIMTemplateCandidateResult
Error error
}
TemplateSelectionResult captures the result of template auto-selection.