Implementation:Kserve Kserve InferenceServiceReconciler
| Knowledge Sources | |
|---|---|
| Domains | Kubernetes, Operator_Pattern, Reconciliation |
| Last Updated | 2026-02-13 00:00 GMT |
Overview
Concrete Go reconciler that drives InferenceService resources from declared spec to running serving endpoints with status tracking.
Description
The InferenceServiceReconciler is the core controller in KServe. It implements the ctrl.Reconciler interface and manages the full lifecycle of InferenceService resources. The reconciler loads configuration from the central ConfigMap, determines deployment mode, reconciles each component (predictor, transformer, explainer) into Knative Services or Deployments, reconciles ingress, and updates status conditions.
Usage
This reconciler runs automatically as part of the KServe controller manager. It processes every InferenceService create, update, and delete event in the cluster.
Code Reference
Source Location
- Repository: kserve
- File: pkg/controller/v1beta1/inferenceservice/controller.go, Lines 109-670
Signature
// InferenceServiceReconciler reconciles InferenceService objects
type InferenceServiceReconciler struct {
Client client.Client
ClientConfig *rest.Config
Clientset kubernetes.Interface
Log logr.Logger
Scheme *runtime.Scheme
Recorder record.EventRecorder
}
// Reconcile is the main reconciliation loop
func (r *InferenceServiceReconciler) Reconcile(ctx context.Context,
req ctrl.Request) (ctrl.Result, error)
Import
import "github.com/kserve/kserve/pkg/controller/v1beta1/inferenceservice"
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| ctx | context.Context | Yes | Reconciliation context |
| req | ctrl.Request | Yes | Namespaced name of InferenceService to reconcile |
Outputs
| Name | Type | Description |
|---|---|---|
| ctrl.Result | ctrl.Result | Requeue directive (empty = no requeue) |
| error | error | Non-nil triggers exponential backoff requeue |
| Side effects | Kubernetes resources | Knative Services, Deployments, VirtualServices, HTTPRoutes created/updated |
| Status update | InferenceServiceStatus | conditions[Ready]=True when PredictorReady AND IngressReady, status.url set |
Usage Examples
Reconciliation Flow
// Simplified reconciliation pseudocode
func (r *InferenceServiceReconciler) Reconcile(ctx context.Context,
req ctrl.Request) (ctrl.Result, error) {
// 1. Fetch InferenceService
isvc := &v1beta1.InferenceService{}
r.Client.Get(ctx, req.NamespacedName, isvc)
// 2. Load ConfigMap
configMap := &v1.ConfigMap{}
r.Client.Get(ctx, types.NamespacedName{Name: "inferenceservice-config"}, configMap)
// 3. Determine deployment mode
deploymentMode := isvc.GetDeploymentMode(configMap)
// 4. Reconcile each component
for _, component := range []string{"predictor", "transformer", "explainer"} {
reconcileComponent(isvc, component, deploymentMode)
}
// 5. Reconcile ingress
ingressReconciler.Reconcile(ctx, isvc)
// 6. Update status
isvc.Status.PropagateStatus()
r.Client.Status().Update(ctx, isvc)
return ctrl.Result{}, nil
}
Checking Readiness
# Check if reconciliation completed successfully
kubectl get inferenceservice my-model -o jsonpath='{.status.conditions}'
# Expected when ready:
# [{"type":"IngressReady","status":"True"},
# {"type":"PredictorReady","status":"True"},
# {"type":"Ready","status":"True"}]