knative-extensions / autoscaler-keda

Keda based Knative HPA Autoscaler
Apache License 2.0
2 stars 5 forks source link

Set the target correctly when deployment name is truncated #57

Closed skonto closed 2 months ago

skonto commented 2 months ago

Serving may create a deployment with a truncated name to make it a K8s valid resource. This is based on the revision name. For example:

...
                "name": "revision-timeout-wri2d4850700c12346b35cf98ea1f8abdf2-deployment",
                "namespace": "serving-tests",
                "ownerReferences": [
                    {
                        "apiVersion": "serving.knative.dev/v1",
                        "blockOwnerDeletion": true,
                        "controller": true,
                        "kind": "Revision",
                        "name": "revision-timeout-writes-first-byte-before-fnnvqttm-00001",
                        "uid": "3c582801-9342-45e1-ac96-57e981e369c8"
                    }
                ],

This leads to an error:

stream.go:304: E 14:00:53.445 autoscaler-keda-7f96b594c8-m6hnt [knative.dev.autoscaler-keda.pkg.reconciler.autoscaling.hpa.Reconciler] [serving-tests/revision-timeout-exceeds-timeout-seconds-nvbdfuht-00001] Reconcile error err=failed to create ScaledObject: admission webhook "vscaledobject.kb.io" denied the request: Deployment.apps "revision-timeout-exceeds-timeout-seconds-nvbdfuht-00001-deployment" not found