-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
In what area(s)?
/area autoscale
What version of Knative?
HEAD as of 7/17
Note: you'll need to modify your cluster so that you can execute long running requests - in this case at least 10 minutes. Aside from tweaking my networking to not timeout idle connections, I also added these to the config-defaults configMap:
max-revision-timeout-seconds: "86400"
revision-timeout-seconds: "86400"
Using this script:
#!/bin/bash
set -ex
kn service delete echo > /dev/null 2>&1 || true
sleep 3
kn service create echo --image duglin/echo | tee out
URL=$(tail -1 out)
curl -s $URL?sleep=600 -d "sleep 600" &
sleep 1
kn service delete echo
sleep 1
kn service list
kubectl get -w pods
it will create a ksvc, curl it and tell the request to sleep for 10 minutes. Meanwhile, in parallel, after 1 second we kill the ksvc.
The ksvc is deleted and the pod is put into terminating state. However, the pod lives for the full 10 minutes rather than be deleted immediately. I understand why this happens, but I don't think it's correct.
Deleting a ksvc is not the same as deleting an instance, where we want (sometimes) to allow for the current requests to finish. In this case the user has specifically asked for all resources associated with the ksvc to be deleted, and therefore all requests should be stopped as well.
This is critical for users to at least two reasons:
1 - they may wish to halt the execution of the pods and stop their processing. If the pods are misbehaving then the user may need to stop that processing.
2 - once the user has tried to delete a ksvc, they should reasonable expect to no longer be charged for the pods running for the ksvc. It's fair for the provider to charge them while the pods are busy (even when in terminating state), so it becomes important from a cost perspective to allow the user to have control over their costs by halting the pods immediately.