Skip to content

Old revision does not scale down when TargetBurstCapacity set to 0 #13487

Closed

Description

@yuzisun

What version of Knative?

1.7.x

Expected Behavior

After updating the knative service, the previous revision should be scaled down once the new revision is in ready state no matter targetBurstCapacity is set or not.

Actual Behavior

Both old and new revisions are running when targetBurstCapacity is set to 0 to remove the activator from the path. It works as expected when we do not set targetBurstCapacity explicitly on the annotations.

Note: This wasn't an issue in 1.0 version

Steps to Reproduce the Problem

  1. Create a Knative Service with annotation autoscaling.knative.dev/targetBurstCapacity: "0"
apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: helloworld-go
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/targetBurstCapacity: "0"
    spec:
      containers:
        - image: docker.io/yuzisun/helloworld-python
          env:
            - name: TARGET
              value: "Go Sample v1"
kubectl get revisions

NAME                                   CONFIG NAME                      K8S SERVICE NAME   GENERATION   READY   REASON             ACTUAL REPLICAS   DESIRED REPLICAS
helloworld-go-00002                    helloworld-go                                       2            True                       1                 1
  1. Update the Knative service by changing the env value, the old revision is not scaled down.
kubectl get revisions

NAME                                   CONFIG NAME                      K8S SERVICE NAME   GENERATION   READY   REASON   ACTUAL REPLICAS   DESIRED REPLICAS
helloworld-go-00002                    helloworld-go                                       2            True                       1                 1
helloworld-go-00003                    helloworld-go                                       3            True                       1                 1
kubectl get pods
NAME                                                              READY   STATUS    RESTARTS   AGE
helloworld-go-00002-deployment-7f995798dd-54jq2                   2/2     Running   0          4m27s
helloworld-go-00003-deployment-9f6997666-sfcpt                    2/2     Running   0          3m

Activity

  1. added
    kind/bug
    on Nov 19, 2022
  2. added this to the v1.9.0 milestone on Nov 19, 2022
  3. dprotaso commented on Nov 19, 2022

    @dprotaso
    Member

    /triage accepted

  4. added
    triage/accepted
    on Nov 19, 2022
  5. psschwei commented on Nov 21, 2022

    @psschwei
    Member

    Another interesting thing is that the new pod is still running too... in general, we'd expect a pod not getting requests to scale down much sooner than that (under two minutes).

  6. dprotaso commented on Nov 21, 2022

    @dprotaso
    Member

    Bisected it to this PR - #12033

    Looks like the autoscaler tries to probe that the activator is in the path but the request is not being directed to the 'probing logic'. So it's being forwarded to the user container and being counted as regular request.

    So effectively in low-TBC (to be confirmed if this affects TBC>0) this prevents scaling to 0.

    Thankfully it's a simple fix but we'll probably want to cherry pick this back to earlier releases.

    /assign @dprotaso

  7. yuzisun commented on Nov 21, 2022

    @yuzisun
    Author

    Thanks @dprotaso ! Would appreciate if you can help patch this to 1.7 release.

  8. dprotaso commented on Nov 22, 2022

    @dprotaso
    Member

    Yeah - I'll be pulling this fix back to older releases (probably back to 1.5)

  9. dprotaso commented on Nov 24, 2022

    @dprotaso
    Member

    @yuzisun Point releases should be out next Tuesday when the automation kicks off.

    I'll post a nightly link when that becomes available if you care to verify the fix beforehand.

  10. yuzisun commented on Nov 28, 2022

    @yuzisun
    Author

    @yuzisun Point releases should be out next Tuesday when the automation kicks off.

    I'll post a nightly link when that becomes available if you care to verify the fix beforehand.

    Thanks, will check tomorrow and verify the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugtriage/accepted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions