When the ephemeral runner finishes, the listener issues a scale-down patch to the ephemeral runner set. But if ephemeral runner set reacts quicker than the listener, it may re-create the ephemeral runner, and quickly remove it.
To avoid this problem, this PR introduces the following changes:
Ephemeral runner cleans up its resources as soon as it is done
Ephemeral runner set keeps finished ephemeral runners until the next patch request is received.
The target count is calculated only on patch ID difference (or patchID == 0), i.e. when the listener patches the ephemeral runner set.
The listener issues a patch request when there is a change in the state, or in case it gets notified that the job is done.
When the ephemeral runner finishes, the listener issues a scale-down patch to the ephemeral runner set. But if ephemeral runner set reacts quicker than the listener, it may re-create the ephemeral runner, and quickly remove it. To avoid this problem, this PR introduces the following changes:
This change also requires a change in the CRD.