Skip to content

Add --cache-sync-timeout flag for sync controllers - #210

Merged
kcp-ci-bot merged 1 commit into
kcp-dev:mainfrom
Wompipomp:fix/cache-sync-timeout-flag
Dec 2, 2026
Merged

kcp-ci-bot merged 1 commit into
kcp-dev:mainfrom
Wompipomp:fix/cache-sync-timeout-flag

Conversation

@Wompipomp

@Wompipomp Wompipomp commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Sync controllers are created unmanaged, so the manager's controller configuration does not apply
and controller-runtime always uses its 2m default CacheSyncTimeout. On startup, the informer for the
local Kind source of a PublishedResource with many (or large) objects can need longer than that, and the sync
controller then fails to start with a cache sync timeout.

This adds a --cache-sync-timeout flag that is passed through to the options of every
per-PublishedResource sync controller. The default stays at 2m, so behaviour only changes when the
flag is set. Non-positive values are rejected. Tested with go test -race ./... and make lint (no new findings) after the rebase; e2e runs in CI.

We run this with --cache-sync-timeout=5m for a PublishedResource with ~10,000 objects on the
service cluster; since then all sync controllers start after agent restarts. This complements
restarting failed controllers (#201): the retry recovers a controller after the timeout, the flag
avoids the failed first attempts.

Rebased onto main after #201 and #205 (the new flag sits next to --worker-count).

What Type of PR Is This?

/kind feature

Related Issue(s)

Fixes #207

Release Notes

Add `--cache-sync-timeout` flag to configure how long each sync controller waits for its caches to sync (default 2m).

@kcp-ci-bot kcp-ci-bot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has signed the DCO. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 28, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

Hi @Wompipomp. Thanks for your PR.

I'm waiting for a kcp-dev member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

@kcp-ci-bot kcp-ci-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 28, 2026
@xrstf

xrstf commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test
/approve

@kcp-ci-bot kcp-ci-bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 1, 2026
@mjudeikis

Copy link
Copy Markdown
Contributor

@Wompipomp merged what I can for current release. Ping us in kcp-dev stack and if you need we can make patch release for you if you need rest of the changes in more urgent matter :)

thanks for these :)

Sync controllers are created unmanaged, so the manager's controller
configuration does not apply and controller-runtime always falls back to
its 2m default CacheSyncTimeout. On startup, the informers for a
PublishedResource with many objects (tens of thousands, or large ones)
may need longer than that to sync, which makes the sync controller fail
to start. The controller is then restarted with backoff, but every
attempt until the informers have synced fails and delays syncing.

Add a --cache-sync-timeout flag and pass it through to the options of
each per-PublishedResource sync controller. The default stays at 2m, so
the behaviour does not change unless the flag is set.

on-behalf-of: @eon-se opensource@eon.com
Signed-off-by: Mark Altmann <mark.altmann.external@eon.com>
@Wompipomp
Wompipomp force-pushed the fix/cache-sync-timeout-flag branch from ede2f9d to 1f41643 Compare December 2, 2026 10:23
@kcp-ci-bot kcp-ci-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 2, 2026
@mjudeikis

Copy link
Copy Markdown
Contributor

/lgtm
/approve

@kcp-ci-bot kcp-ci-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 2, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mjudeikis, xrstf

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

The pull request process is described here

Details 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

@kcp-ci-bot

Copy link
Copy Markdown
Contributor

LGTM label has been added.

DetailsGit tree hash: 089cadd48096af58a42e2286cda2d15878df2707

@kcp-ci-bot
kcp-ci-bot merged commit d44461a into kcp-dev:main Dec 2, 2026
12 checks passed
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. dco-signoff: yes Indicates the PR's author has signed the DCO. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: make the cache sync timeout of sync controllers configurable

4 participants