-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to auto-reapply bundles #558
Conversation
Might be good to expose the interval too via config? I am pretty sure someone will reach out again in future to make it configurable :) |
I agree with @leodotcloud that the timing should be exposed via config as well. Perhaps as a separate feature request, it would be good to have this be fully configurable rather than just a Boolean. For example, have the following configuration options:
To get the default behavior today, something like this would be the default settings:
If you want to get the
This would make it always retry applying, every minute, forever. Then you could also create a middle-of-the-road configuration:
This would have the agent attempt to resolve the changes three times, waiting 3 minutes between each retry. If the last retry fails, it will wait an hour and then reset the retries counter and go at it again. |
@ibrokethecloud I'd be comfortable with some form of the above feedback from @skaven81 if you have the cycles. Apply delay does not seem as useful to me if we have max backoff and max retries, though I do see the use if the idea is not to hammer an external API (though, I'd argue you have other problems in that case). I would still prefer to have "resync" exist as a boolean though since we want an intuitive solution here. While us here understand that |
@nickgerace added additional logic to custom reapply settings Users can now either choose the standard resync behaviour, by specifying the fleld
The users can also customize the behavior as shown below
If users want unlimited max tries with a custom delay
|
This is awesome, and exactly what I was looking for. 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks a lot Gaurav for taking care of this.
Ping @StrongMonkey @nickgerace ... can you please review and merge this PR? |
@ibrokethecloud is this ready for re-review? |
if bd.Spec.Options.Resync || bd.Spec.StagedOptions.Resync { | ||
if bd.Spec.Options.ResyncPolicy == nil && bd.Spec.StagedOptions.ResyncPolicy == nil { | ||
if status.LastApply == nil { | ||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look correct.... if lastApply is nil and resync is true then we return false? Look like it will never be deployed since that's the initail state..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be deployed.
Right now there are two handles for BundleDeployments, DeployBundle and MonitorBundle.
The DeployBundle will deploy the bundle the first time and set the lastApply timestamp. I just wanted MonitorBundle to ignore reapply / re-queueing the bundle until the first deploy has happened.
return false | ||
} | ||
|
||
if policy.MaxRetries == DefaultMaxRetries && status.LastApply.Add(policy.ResyncDelay.Duration).Before(time.Now()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why do we even compare policy.MaxRetries == DefaultMaxRetries
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefaultMaxRetries was a specific case where you specify MaxRetries as -1
which means its an infinite loop where the objects will be queued at the custom reapply interval.
We are planning to correct drift instead of reapplying on an interval. We might revisit this in the future. |
The PR introduces a new boolean field in BundleDeploymentOptions
alwaysReapply
Users can use this flag to trigger re-application of modified bundled on downstream clusters.
When this field is set, the fleet-agent will trigger redeployment of the modified bundle at a fixed interval to avoid overloading the api server.