feat: adapt requeuing when session is hibernated - #1185
Conversation
Once a pod has been hibernated, queue for the MaxHibernationDuration. If it's awaken before, there will be an event and otherwise, it avoids checking it every 10 seconds.
leafty
left a comment
There was a problem hiding this comment.
This change prevents prometheus metrics to be collected for a paused session.
See:
|
Thinking about this a bit more:
|
I agree, yes. We should not be prevented from adjusting this just for the sake of publishing metrics.
So in the meantime we can go to 60 sec for hibernated sessions. I would go for merging this with 60 sec hibernation interval and without breaking the metrics. Then in a followup pr lets change the metrics collection and further increase the requeue interval as you originally intended. Wdyt? If not we can do everything all at once. Let me know @sgaist |
|
Sounds good to me |
This allows to keep meaningful metrics while keeping the operator less occupied. Metrics gathering will be refactored in a subsequent patch.
|
@sgaist the cyclomatic complexity on the linter is triggering. You can ignore that rule on the current fuction or you can just fully disable that. It is one of the default checks on the linter we got for "free" but we never consciously turned it on. |
The same logic was copied in multiple places with just small differences. These are small enough that they can be put in function that can be passed to to status update function.
|
@olevski I added some cleanups as they where hanging things that I wanted to tackle anyway and it fixed the cyclomatic complexity issue. |
Describe your changes
Currently, the operator checks on all sessions every 10 seconds.
This is not needed anymore once a pod has been hibernated.
Therefore queue for the MaxHibernationDuration.
If it's awaken before, there will be an event that will trigger an earlier reconciliation.