Skip to content

Avoid looping with two mutually exclusive desired state #1288

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

Closed
scrocquesel opened this issue Jun 15, 2022 · 1 comment · Fixed by #1290
Closed

Avoid looping with two mutually exclusive desired state #1288

scrocquesel opened this issue Jun 15, 2022 · 1 comment · Fixed by #1290

Comments

@scrocquesel
Copy link
Contributor

Given a CRD that allows to set a value on a given key in a config map and an operator using informer as event source for the secondary resource (configmap)

When those two CRs

spec:
  configmap: my-config
  key: fruit
  value: banana
spec:
  configmap: my-config
  key: fruit
  value: apple

are accidentally deployed, the operator loops and reconciliations of each CR are fighting to set their value. This cause an heavy load on the k8s api.

The current version of my operator is based on an old version of the framework and basically use a timed reconciliation with withReschedule. The targetted config map was only flickering every minutes or so.

I would like to refactor and use informer, but need a circuit breaker when thing goes wrong. For eg, limiting the number of reconciliation after a burst is detected for a given period of time.

This should also ensure a reonciliation will always occured at the end of this "peace" period of time even if no new event happened, This is because if I removed one of the conflicting CR, the remaining one may not be the one that win the last fight.

While it should be possible to implement skiping in the reconcile method and have a reconciliationMaxInterval, I think that maybe #1281 could help, or maybe have a throttled event source wrapping the informer.

Any idea ?

@metacosm
Copy link
Collaborator

Yes, I think that this scenario should be covered by #1281 as the SDK should never DoS the API server even in the presence of badly designed operators and/or user error.

@csviri csviri linked a pull request Jun 16, 2022 that will close this issue
@csviri csviri closed this as completed Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants