Skip to content
Open
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
9 changes: 8 additions & 1 deletion operator/internal/controller/vllmruntime_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -363,7 +364,13 @@ func (r *VLLMRuntimeReconciler) Reconcile(
scaledObject.SetKind("ScaledObject")
scaledObject.SetName(vllmRuntime.Name + "-scaledobject")
scaledObject.SetNamespace(vllmRuntime.Namespace)
if err := r.Delete(ctx, scaledObject); err != nil && !errors.IsNotFound(err) {
// Best-effort cleanup of a stale ScaledObject when autoscaling is
// disabled. Tolerate IsNoMatchError so the reconcile still succeeds on
// clusters where KEDA is not installed (the keda.sh API group is not
// registered): there is nothing to delete, and requiring KEDA here
// would make the operator unusable on non-autoscaling clusters.
if err := r.Delete(ctx, scaledObject); err != nil &&
!errors.IsNotFound(err) && !meta.IsNoMatchError(err) {
log.Error(err, "Failed to delete ScaledObject")
return ctrl.Result{}, err
}
Expand Down
Loading