bottlerocket-update-operator icon indicating copy to clipboard operation
bottlerocket-update-operator copied to clipboard

Make polling `apiclient update check` frequency configurable

Open jpmcb opened this issue 2 years ago • 3 comments

Frequency of polled updates

Currently, polling for a new update seem to be every 10 seconds:

https://github.com/bottlerocket-os/bottlerocket-update-operator/blob/c2e9504d7671c263ecdf7ea59fea69609b92e15e/agent/src/apiclient.rs#L123-L128

It would be great if there was an brupop setting that made polling for updates configurable

        - name: POLLING_UPDATE_FREQUENCY
          value: 10

where the value is an expected length of seconds

Why?

Some users may not want egress traffic to the updates endpoint very frequently. Or maybe they want to poll for an update more frequently. This may be a network traffic restriction, the fact that nodes are deployed on edge (and polling for frequent updates are not ideal), etc.

jpmcb avatar May 23 '23 16:05 jpmcb

I don't think it's correct maybe I'm wrong.

Currently, pooling for a new update seem to be every 10 seconds:

The attempt logic here is to deal with 423 Locked response. The apiclient only sleep 10 sec if the update API return 423; otherwise if will return the output or error. Update API doesn't support frequent ask at short time, and it will return 423 busy if they are executing something.

https://github.com/bottlerocket-os/bottlerocket-update-operator/blob/c2e9504d7671c263ecdf7ea59fea69609b92e15e/agent/src/apiclient.rs#L144-L148

Base on that, that setting you think we should introduce might not be related to this part. If I understand correct, we probably can look at agentclient which asks to invoke apiclient update check.

gthao313 avatar Jun 01 '23 19:06 gthao313

Good call - yeah I wasn't sure if that was exactly where we have the logic for frequency of polling. But somewhere, we should have a setting that we can make it configurable for users who need much less polling than we currently provide.

jpmcb avatar Jun 02 '23 16:06 jpmcb

#524 reduces the default polling interval to 2 minutes, but I agree that we should make this configurable.

cbgbt avatar Aug 16 '23 22:08 cbgbt