serving icon indicating copy to clipboard operation
serving copied to clipboard

Non-Active Revisions with ScaleToZeroPodRetention and min-non-active-revisions > 1 is not scaled down

Open AswinT22 opened this issue 2 years ago • 12 comments

What version of Knative?

1.9.2

Expected Behavior

Non active must be scaled down with autoscaling.knative.dev/scale-to-zero-pod-retention-period set

Actual Behavior

Non active revisions are not scaled down

Steps to Reproduce the Problem

Deploy a Knative service with scale-to-zero-pod-retention-period (make sure this value is higher so you will be able to see the issue)

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: hello-example
  namespace: default
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/initial-scale: "1"
        autoscaling.knative.dev/min-scale: "0"
        autoscaling.knative.dev/scale-to-zero-pod-retention-period: "1h"
    spec:
      containerConcurrency: 0
      containers:
      - env:
        - name: TARGET
          value: World
        image: gcr.io/knative-samples/helloworld-go
        name: user-container

Edit the config-map config-gc and set below values

max-non-active-revisions: "2"
min-non-active-revisions: "1"
retain-since-create-time: disabled
retain-since-last-active-time: disabled
  • Deploy The knative service
  • Then alter the service to deploy a newer revisions
  • You will see the old revision not scaling down

AswinT22 avatar Mar 23 '23 18:03 AswinT22

autoscaling.knative.dev/scale-to-zero-pod-retention-period: "1h"

I lowered this from an hour (1h) to 10 miuntes (10m) and the pod scaled down after 10 minutes. Are you seeing something else?

/triage needs-user-input

dprotaso avatar Mar 24 '23 17:03 dprotaso

Hey @dprotaso,

Thanks for taking time to check this out.

Indeed, it eventually scales down, but I think the non-active revisions can be scaled down immediately. Am i missing something?

AswinT22 avatar Mar 31 '23 07:03 AswinT22

I guess to clarify your ask is

A revision, that has no route pointed to it, should scale down and ignore the configured scale-to-zero-pod-retention-period' ?

Or another way to phrase it

scale-to-zero-pod-retention-period should only apply to revisions that can be reached by a route

This issue might be covered by this PR - https://github.com/knative/serving/pull/13731 but would need to confirm

dprotaso avatar Mar 31 '23 17:03 dprotaso

/triage accepted

I'm assuming your ask what I've described - if so I agree that revisions that aren't routable should ignore the scale down retention periods.

dprotaso avatar Mar 31 '23 17:03 dprotaso

I'm assuming your ask what I've described - if so I agree that revisions that aren't routable should ignore the scale down retention periods.

You are right and let me check the PR

AswinT22 avatar Apr 03 '23 16:04 AswinT22

I guess to clarify your ask is

A revision, that has no route pointed to it, should scale down and ignore the configured scale-to-zero-pod-retention-period' ?

Or another way to phrase it

scale-to-zero-pod-retention-period should only apply to revisions that can be reached by a route

This issue might be covered by this PR - #13731 but would need to confirm

Hey @dprotaso I checked the PR, and as far as I am aware it is not covered. Will start working on it once you confirm.

AswinT22 avatar Apr 03 '23 16:04 AswinT22

/remove-triage needs-user-input

AswinT22 avatar Apr 20 '23 13:04 AswinT22

@dprotaso, can I go ahead with the fix ?

AswinT22 avatar Apr 20 '23 13:04 AswinT22

@AswinT22 sure

/assign @AswinT22

dprotaso avatar Apr 24 '23 19:04 dprotaso

@AswinT22 are you still working on this?

dprotaso avatar May 29 '23 18:05 dprotaso

/unassign @AswinT22

dprotaso avatar Nov 21 '23 19:11 dprotaso

@dprotaso hi can I work on this?

eddy-oum avatar Apr 15 '24 06:04 eddy-oum