Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/apis/serving/v1alpha1/servingruntime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,8 @@ type WorkerSpec struct {

func init() {
SchemeBuilder.Register(&ServingRuntime{}, &ServingRuntimeList{})
SchemeBuilder.Register(&ClusterServingRuntime{}, &ClusterServingRuntimeList{})
// ODH does not have ClusterServingRuntime
// SchemeBuilder.Register(&ClusterServingRuntime{}, &ClusterServingRuntimeList{})
}

func (srSpec *ServingRuntimeSpec) IsDisabled() bool {
Expand Down
90 changes: 45 additions & 45 deletions pkg/controller/v1beta1/inferenceservice/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,37 +455,37 @@ func (r *InferenceServiceReconciler) servingRuntimeFunc(ctx context.Context, obj
return requests
}

func (r *InferenceServiceReconciler) clusterServingRuntimeFunc(ctx context.Context, obj client.Object) []reconcile.Request {
clusterServingRuntimeObj, ok := obj.(*v1alpha1.ClusterServingRuntime)

if !ok || clusterServingRuntimeObj == nil {
return nil
}

var isvcList v1beta1.InferenceServiceList
if err := r.Client.List(ctx, &isvcList, client.InNamespace(clusterServingRuntimeObj.Namespace)); err != nil {
r.Log.Error(err, "unable to list InferenceServices", "clusterServingRuntime", clusterServingRuntimeObj.Name)
return nil
}

requests := make([]reconcile.Request, 0, len(isvcList.Items))
for _, isvc := range isvcList.Items {
annotations := isvc.GetAnnotations()
if annotations != nil {
if disableAutoUpdate, found := annotations[constants.DisableAutoUpdateAnnotationKey]; found && disableAutoUpdate == "true" && isvc.Status.IsReady() {
r.Log.Info("Auto-update is disabled for InferenceService", "InferenceService", isvc.Name)
continue
}
}
requests = append(requests, reconcile.Request{
NamespacedName: types.NamespacedName{
Namespace: isvc.Namespace,
Name: isvc.Name,
},
})
}
return requests
}
// func (r *InferenceServiceReconciler) clusterServingRuntimeFunc(ctx context.Context, obj client.Object) []reconcile.Request {
// clusterServingRuntimeObj, ok := obj.(*v1alpha1.ClusterServingRuntime)
//
// if !ok || clusterServingRuntimeObj == nil {
// return nil
// }
//
// var isvcList v1beta1.InferenceServiceList
// if err := r.Client.List(ctx, &isvcList, client.InNamespace(clusterServingRuntimeObj.Namespace)); err != nil {
// r.Log.Error(err, "unable to list InferenceServices", "clusterServingRuntime", clusterServingRuntimeObj.Name)
// return nil
// }
//
// requests := make([]reconcile.Request, 0, len(isvcList.Items))
// for _, isvc := range isvcList.Items {
// annotations := isvc.GetAnnotations()
// if annotations != nil {
// if disableAutoUpdate, found := annotations[constants.DisableAutoUpdateAnnotationKey]; found && disableAutoUpdate == "true" && isvc.Status.IsReady() {
// r.Log.Info("Auto-update is disabled for InferenceService", "InferenceService", isvc.Name)
// continue
// }
// }
// requests = append(requests, reconcile.Request{
// NamespacedName: types.NamespacedName{
// Namespace: isvc.Namespace,
// Name: isvc.Name,
// },
// })
// }
// return requests
//}

func (r *InferenceServiceReconciler) SetupWithManager(mgr ctrl.Manager, deployConfig *v1beta1.DeployConfig, ingressConfig *v1beta1.IngressConfig) error {
r.ClientConfig = mgr.GetConfig()
Expand Down Expand Up @@ -519,9 +519,9 @@ func (r *InferenceServiceReconciler) SetupWithManager(mgr ctrl.Manager, deployCo
if isvc.Status.ServingRuntimeName != "" {
return []string{isvc.Status.ServingRuntimeName}
}
if isvc.Status.ClusterServingRuntimeName != "" {
return []string{isvc.Status.ClusterServingRuntimeName}
}
// if isvc.Status.ClusterServingRuntimeName != "" {
// return []string{isvc.Status.ClusterServingRuntimeName}
// }
return nil
}); err != nil {
return err
Expand All @@ -539,16 +539,16 @@ func (r *InferenceServiceReconciler) SetupWithManager(mgr ctrl.Manager, deployCo
}

// TODO: Find a way to distinguish if the ServingRuntime is a ClusterServingRuntime or not
clusterServingRuntimesPredicate := predicate.Funcs{
UpdateFunc: func(e event.UpdateEvent) bool {
oldClusterServingRuntime := e.ObjectOld.(*v1alpha1.ClusterServingRuntime)
newClusterServingRuntime := e.ObjectNew.(*v1alpha1.ClusterServingRuntime)
return !reflect.DeepEqual(oldClusterServingRuntime.Spec, newClusterServingRuntime.Spec)
},
CreateFunc: func(e event.CreateEvent) bool { return false },
DeleteFunc: func(e event.DeleteEvent) bool { return false },
GenericFunc: func(e event.GenericEvent) bool { return false },
}
// clusterServingRuntimesPredicate := predicate.Funcs{
// UpdateFunc: func(e event.UpdateEvent) bool {
// oldClusterServingRuntime := e.ObjectOld.(*v1alpha1.ClusterServingRuntime)
// newClusterServingRuntime := e.ObjectNew.(*v1alpha1.ClusterServingRuntime)
// return !reflect.DeepEqual(oldClusterServingRuntime.Spec, newClusterServingRuntime.Spec)
// },
// CreateFunc: func(e event.CreateEvent) bool { return false },
// DeleteFunc: func(e event.DeleteEvent) bool { return false },
// GenericFunc: func(e event.GenericEvent) bool { return false },
// }

ctrlBuilder := ctrl.NewControllerManagedBy(mgr).
For(&v1beta1.InferenceService{}).
Expand Down Expand Up @@ -607,7 +607,7 @@ func (r *InferenceServiceReconciler) SetupWithManager(mgr ctrl.Manager, deployCo
}

return ctrlBuilder.Watches(&v1alpha1.ServingRuntime{}, handler.EnqueueRequestsFromMapFunc(r.servingRuntimeFunc), builder.WithPredicates(servingRuntimesPredicate)).
Watches(&v1alpha1.ClusterServingRuntime{}, handler.EnqueueRequestsFromMapFunc(r.clusterServingRuntimeFunc), builder.WithPredicates(clusterServingRuntimesPredicate)).
// Watches(&v1alpha1.ClusterServingRuntime{}, handler.EnqueueRequestsFromMapFunc(r.clusterServingRuntimeFunc), builder.WithPredicates(clusterServingRuntimesPredicate)).
Complete(r)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1672,16 +1672,16 @@ var _ = Describe("v1beta1 inference service controller", func() {
},
},
},
URL: &apis.URL{
Scheme: "http",
Host: "raw-foo-2-default.example.com",
},
Address: &duckv1.Addressable{
URL: &apis.URL{
Scheme: "http",
Host: fmt.Sprintf("%s-predictor.%s.svc.cluster.local", serviceKey.Name, serviceKey.Namespace),
},
},
URL: &apis.URL{
Scheme: "http",
Host: "raw-foo-2-default.example.com",
},
Components: map[v1beta1.ComponentType]v1beta1.ComponentStatusSpec{
v1beta1.PredictorComponent: {
LatestCreatedRevision: "",
Expand Down Expand Up @@ -10446,16 +10446,16 @@ var _ = Describe("v1beta1 inference service controller", func() {
},
},
},
URL: &apis.URL{
Scheme: "https",
Host: "raw-auth-default.example.com",
},
Address: &duckv1.Addressable{
URL: &apis.URL{
Scheme: "https",
Host: fmt.Sprintf("%s-predictor.%s.svc.cluster.local:8443", serviceKey.Name, serviceKey.Namespace),
},
},
URL: &apis.URL{
Scheme: "https",
Host: "raw-auth-default.example.com",
},
Components: map[v1beta1.ComponentType]v1beta1.ComponentStatusSpec{
v1beta1.PredictorComponent: {
LatestCreatedRevision: "",
Expand Down
Loading