Skip to content
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

Do not reschedule, if already scheduled in the next MinInterval #2609

Merged

Conversation

claudiumocanu
Copy link
Contributor

Description

When cfg.UpdateEvents is true, any service or ingress change in the Source, is invoking ctrl.ScheduleRunOnce, allowing a reconciliation to be eventually scheduled earlier than cfg.Interval, but not more often than cfg.MinEventSyncInterval.

The problem happens in a scenario where services or ingresses changes happen more often than cfg.MinEventSyncInterval, because the Controller.nextRunAt is recalculated as now + cfg.MinEventSyncInterval, allowing the next reconciliation to be pushed forward, even if it is already planned to happen, eventually even further than cfg.Interval and virtually forever.

For the sake of the example, in a very busy K8s cluster, in which one service is updated once every second, while the cfg.MinEventSyncInterval set to something bigger than one second, the reconciliation never happens.

The change I am submitting for your review, blocks the Controller.nextRunAt from being recalculated, if a reconciliation is already planned to happen sooner than the cfg.MinEventSyncInterval.
Alternatively, the cfg.Interval could be used instead of cfg.MinEventSyncInterval, as a maximum amount of time that a reconciliation is allowed to be delayed.

Fixes #ISSUE.
There is no issue opened on this topic.

Checklist

  • Unit tests updated
  • End user documentation updated - I found no documentation around this topic.

PS: This is my first PR. Looking forward for any feedback. Thanks!

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Feb 17, 2022

CLA Signed

The committers are authorized under a signed CLA.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Feb 17, 2022
@k8s-ci-robot
Copy link
Contributor

Welcome @claudiumocanu!

It looks like this is your first PR to kubernetes-sigs/external-dns 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/external-dns has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Feb 17, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 18, 2022
@antifuchs
Copy link

/remove-lifecycle stale

We're hit by the exact issue that this PR fixes, and would love to see it land. In the meantime, we'll probably have to live off a fork that pulls this change in.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 3, 2022
@Raffo Raffo closed this Jul 20, 2022
@Raffo Raffo reopened this Jul 20, 2022
@szuecs
Copy link
Contributor

szuecs commented Jul 20, 2022

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

@szuecs: changing LGTM is restricted to collaborators

In response to this:

/lgtm
/approve

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@Raffo Raffo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@claudiumocanu thanks for your PR, just one fix for the comment and we can ship this.

controller/controller.go Outdated Show resolved Hide resolved
Co-authored-by: Raffaele Di Fazio <raffo@github.com>
@szuecs
Copy link
Contributor

szuecs commented Jul 23, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 23, 2022
@claudiumocanu claudiumocanu requested a review from Raffo July 25, 2022 13:16
@szuecs
Copy link
Contributor

szuecs commented Jul 25, 2022

/assign Raffo

@Raffo
Copy link
Contributor

Raffo commented Jul 29, 2022

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: claudiumocanu, Raffo, szuecs

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 29, 2022
@k8s-ci-robot k8s-ci-robot merged commit 03e3d22 into kubernetes-sigs:master Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants