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
- Install the operator on a cluster without KEDA
- Create a VLLMRuntime resource without
autoscalingConfig (or with autoscalingConfig.enabled: false)
- 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.
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
keda.shAPI group registered)Steps to Reproduce
autoscalingConfig(or withautoscalingConfig.enabled: false)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, whenautoscalingConfigis nil or disabled, theelsebranch attempts to delete a ScaledObject as a cleanup measure:production-stack/operator/internal/controller/vllmruntime_controller.go
Lines 360 to 370 in 9b78da7
The guard
!errors.IsNotFound(err)only catches the case where the ScaledObject resource does not exist (i.e., thekeda.shAPI group is registered, but no ScaledObject with that name is found). It does not catch the case where thekeda.shAPI 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 satisfyerrors.IsNotFound(), causing the reconciliation to fail.