Skip to content

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

Open
Wompipomp wants to merge 1 commit into
kcp-dev:mainfrom
Wompipomp:fix/cache-sync-timeout-flag
Open

Wompipomp wants to merge 1 commit into
kcp-dev:mainfrom
Wompipomp:fix/cache-sync-timeout-flag

Conversation

@Wompipomp

Copy link
Copy Markdown

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 ./..., make lint and
make test-e2e (kcp 0.32).

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 attempt.

Note: #201 and #205 touch the same struct and Add() in the sync manager (#205 also
the flag plumbing in options.go / main.go); the overlap is trivial, and if either lands first,
I will rebase this PR.

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).

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.

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>
@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. labels Nov 28, 2026
@kcp-ci-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign embik for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 kcp-ci-bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label 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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it 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

2 participants