Skip to content

bug: The VLLMRuntime controller fails on every reconciliation when running on a cluster that does not have KEDA installed #981

Description

@J0HN50N133

Describe the bug

The VLLMRuntime controller fails on every reconciliation when running on a cluster that does not have KEDA installed, even if no VLLMRuntime resource enables autoscaling. This makes the operator unusable on clusters without KEDA.

To Reproduce

Environment

  • vLLM Production Stack Operator
  • Cluster without KEDA (no keda.sh API group registered)

Steps to Reproduce

  1. Install the operator on a cluster without KEDA
  2. Create a VLLMRuntime resource without autoscalingConfig (or with autoscalingConfig.enabled: false)
  3. Observe the controller logs

Expected behavior

The VLLMRuntime reconciles successfully. Since autoscaling is not requested, the operator should not require KEDA to be present.

Additional context

Root cause:

In operator/internal/controller/vllmruntime_controller.go:360-370, when autoscalingConfig is nil or disabled, the else branch attempts to delete a ScaledObject as a cleanup measure:

} else {
scaledObject := &unstructured.Unstructured{}
scaledObject.SetAPIVersion("keda.sh/v1alpha1")
scaledObject.SetKind("ScaledObject")
scaledObject.SetName(vllmRuntime.Name + "-scaledobject")
scaledObject.SetNamespace(vllmRuntime.Namespace)
if err := r.Delete(ctx, scaledObject); err != nil && !errors.IsNotFound(err) {
log.Error(err, "Failed to delete ScaledObject")
return ctrl.Result{}, err
}
}

The guard !errors.IsNotFound(err) only catches the case where the ScaledObject resource does not exist (i.e., the keda.sh API group is registered, but no ScaledObject with that name is found). It does not catch the case where the keda.sh API group itself is not registered on the cluster. In that scenario, the API server returns a different error (e.g., "the server could not find the requested resource") that does not satisfy errors.IsNotFound(), causing the reconciliation to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions