Skip to content

fix(provider): confirm against the API server before skipping a status write - #10409

Merged
zirain merged 6 commits into
envoyproxy:mainfrom
nobbs:fix/gatewayclass-generation-flake
Nov 16, 2026
Merged

zirain merged 6 commits into
envoyproxy:mainfrom
nobbs:fix/gatewayclass-generation-flake

Conversation

@nobbs

@nobbs nobbs commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The status updater decides whether a write is needed by comparing the desired status with the object from the manager's cache, and skips the write when they are equal. Right after its own write, the cache can still hold the previous version of the object. When two updates for one object arrive out of order, the updater writes the older status and then skips the newer one:

write status S2          the cache catches up, S2
write status S1, late    API server S1, cache still S2
write status S2          equal to the cache, "status unchanged", skipped
the object keeps S1 until something else updates it

This is how GatewayClassObservedGenerationBump flakes (117 failed conformance jobs between 12 and 26 Oct): the Gateway API runner stores a GatewayClass status from an older snapshot (fixed in #10408), and the corrective write is skipped. Any kind with more than one writer, or with out-of-order updates, can end up the same way.

This PR records the resourceVersion of each of the updater's writes, keyed by UID. When the status looks unchanged but the cache shows another resourceVersion than the recorded write, the updater reads the object from the API server before skipping:

 newObj := update.Mutator.Mutate(obj)
+if isStatusEqual(obj, newObj) && u.cacheMayLag(obj) { // a recorded write, another resourceVersion in the cache
+	// read obj from the API server and mutate it again
+}
 if isStatusEqual(obj, newObj) {
 	// skip
 }
 ...
+u.lastWritten[newObj.GetUID()] = lastWrite{resourceVersion: newObj.GetResourceVersion(), at: time.Now()}

A ticker on the updater's goroutine drops records older than a minute, since a record only matters until the cache has seen the write. The extra read happens only when a write is about to be skipped while the cache may be behind.

Evidence:

  • Before: TestStatusUpdateIsNotSkippedWhileCacheLagsBehindOwnWrite, the first unit test for the status updater, runs the sequence above against a fake API server with a cache the test holds behind, and the object ends at S1.
    After: it ends at S2.
  • TestStatusUpdateRetriedAfterConflictIsNotSkippedWhileCacheLags makes the write after the API-server read conflict once; the retry still meets the stale cache and writes S2. TestStatusUpdateRecordsExpire checks that a sweep a minute after writing 100 GatewayClasses leaves no records.
  • The envtest loop from fix(gatewayapi): keep an older translation from overwriting a newer GatewayClass status #10408, with the interleaving forced and without the runner change: 8 of 8 iterations ended at the old observedGeneration before, 0 of 8 after.
  • The provider unit tests (also under -race) and the envtest integration tests pass.

Merge danger: a two-way door. The blast radius is every status write the provider makes. In the case above the updater reads the object from the API server once before deciding, and it keeps a record of each write for one to two minutes. Otherwise nothing changes.

Which issue(s) this PR fixes:

Fixes #9691


PR Checklist

  • Authorship & ownership: Coding agents / AI assistants are welcome, but I have reviewed every change, understand how and why it works, can explain and maintain it, and take full responsibility for this PR. I have not submitted generated output I do not understand.
  • DCO: All commits are signed off (git commit -s). See DCO: Sign your work.
  • API agreed first: If this PR contains API changes (changes under /api), the API was discussed and agreed before the implementation. The API change can be in a separate PR, or in the same PR, but the API must be agreed before implementation. N/A if this PR does not contain API changes. (N/A: no API changes.)
  • Required checks pass: make generate gen-check, make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, but gen-check, lint, and coverage MUST pass.) (make lint and the provider unit and integration tests pass locally. gen-check and the full coverage run are left to CI.)
  • Tests added/updated: New/changed code is covered by appropriate tests. N/A if this PR does not contain code changes.
  • Docs: User-facing changes update the docs, either in this PR or a follow-up PR. N/A if this PR does not contain user-facing changes. (N/A: a status fix with no documented behavior to change.)
  • Release notes: For any non-trivial change, added a release-note fragment under release-notes/current/<section>/<pr-number>-<slug>.md (see release-notes/current/README.md for sections and naming). N/A if this PR does not contain non-trivial changes.
  • Generated files committed: Ran make gen-check and committed the result if API/helm charts/modules changed. (N/A: nothing generated changed.)
  • Scope & compatibility: The PR is reasonably scoped (no unrelated changes) and preserves backward compatibility, or any breaking change is called out above and documented in release-notes/current/breaking_changes/.
  • Codex review: Requested a Codex review and addressed all of its comments.
  • Copilot review: Requested a Copilot review and addressed all of its comments.

@netlify

netlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

👷 Deploy request for cerulean-figolla-1f9435 pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 560e68b

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T20:29:49.752990Z 560e68b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf0f1c3cd2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.94737% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.76%. Comparing base (d246d85) to head (560e68b).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/provider/kubernetes/status_updater.go 78.94% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10409      +/-   ##
==========================================
- Coverage   82.77%   82.76%   -0.02%     
==========================================
  Files         278      278              
  Lines       44517    44535      +18     
==========================================
+ Hits        36851    36861      +10     
- Misses       7665     7673       +8     
  Partials        1        1              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nobbs
nobbs marked this pull request as draft October 26, 2026 15:15
@nobbs

nobbs commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@nobbs
nobbs marked this pull request as ready for review October 26, 2026 15:49

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f136544ad

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


// lastWriteTTL is how long a record of a status write is kept. The record is only needed until the
// cache has seen the write, which takes far less.
const lastWriteTTL = time.Minute

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve lag guards until the cache catches up

When the cache remains behind the last write past this TTL and the next sweep (one to two minutes), expireLastWrites removes the only signal that forces an API-server read. In the same S2 → stale-cache S1 → corrective S2 sequence covered by the new test, delaying the correction until after expiry makes cacheMayLag false, so the updater treats cached S2 as current and leaves server-side S1 in place; the deduplicating status store may never emit S2 again. Cleanup therefore needs to distinguish records whose resource version has been observed by the cache, or otherwise retain a bounded guard that survives prolonged cache lag.

Useful? React with 👍 / 👎.

@nobbs
nobbs force-pushed the fix/gatewayclass-generation-flake branch from 7f13654 to 064d62d Compare October 27, 2026 07:19
@zirain zirain added this to the Backlog milestone Oct 27, 2026
@nobbs
nobbs force-pushed the fix/gatewayclass-generation-flake branch 2 times, most recently from 03a6c97 to 14a957f Compare October 30, 2026 20:18
zhaohuabing
zhaohuabing previously approved these changes Nov 5, 2026

@zhaohuabing zhaohuabing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM thanks!

@zirain

zirain commented Nov 5, 2026

Copy link
Copy Markdown
Member

this's conflicted.

@eplightning

Copy link
Copy Markdown

I guess this also fixes #9432 if I'm understanding correctly?

@nobbs

nobbs commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

I guess this also fixes #9432 if I'm understanding correctly?

As far as I can tell from your issue, yes, it should also fix it. There might be some edge-cases with this PR that could occur on leader reelections, e.g. controller restarts or upgrades.

…s write

The status updater compares the desired status with the object from the
manager's cache and skips the write when they are equal. Right after its
own write, the cache can still hold the previous version of the object.
When updates for an object arrive out of order, as when the Gateway API
runner stores a status computed from an older snapshot, the updater wrote
the older status and then skipped the newer one, because the cache still
showed the newer status from its write before. The object kept the older
status, as seen in the flaky GatewayClassObservedGenerationBump
conformance test.

Remember the resourceVersion of the updater's last write per object.
When the cache is behind it and the status looks unchanged, read the
object from the API server before deciding. The entry is dropped once
the cache has caught up or the object was read from the server.

Signed-off-by: Alexej Disterhoft <[email protected]>
…onfirmed

When the cache looked behind the status updater's last write, the updater
dropped its record of that write before checking the API server. If the
following write then conflicted, the retry met the same stale cache
without the record, took the cached status for the current one, and
skipped the write.

Keep the record until the server confirms the status is unchanged, the
object is gone, or a write succeeds.

Signed-off-by: Alexej Disterhoft <[email protected]>
The status updater keyed its last-write records by kind and name. Extension
policy kinds are unstructured, and two of them can share a Kind in
different API groups, so their objects of the same namespace and name
shared a record. An update for one could consume the other's record, and
that object's next correction was then compared with its stale cache and
skipped.

Include the API group in the key.

Signed-off-by: Alexej Disterhoft <[email protected]>
A last-write record was only dropped by the next update of the same
object. The last update of most objects is a write, and updates for
deleted objects never arrive, so the records of every object that ever
had its status written stayed for the life of the process.

Record when each write happened and drop records older than a minute, at
most once a minute. A record is only needed until the cache has seen the
write, which takes far less.

Signed-off-by: Alexej Disterhoft <[email protected]>
…ater

Key the records by UID instead of group, kind and name, since no two
objects share a UID. Records are now only added by writes and only
dropped when they expire. The early drops, once the cache showed the
write or the API server confirmed the status, only spared an API read
in rare cases.

Sweep expired records from a ticker on the Start goroutine instead of
throttling a sweep inside apply, which needs neither a sweep timestamp
nor an injected clock.

Signed-off-by: Alexej Disterhoft <[email protected]>
@nobbs
nobbs force-pushed the fix/gatewayclass-generation-flake branch from cdedb13 to 560e68b Compare November 13, 2026 20:26
@zirain
zirain requested a review from zhaohuabing November 13, 2026 23:35
@zirain
zirain merged commit 0c2157f into envoyproxy:main Nov 16, 2026
70 of 72 checks passed
zirain added a commit that referenced this pull request Nov 16, 2026
* fix: missing digest in proxy version (#10445)

* fix: missing digest in proxy version (#10425)

Signed-off-by: Thomas Weiß <[email protected]>

* fix: missing digest in proxy version (#10425)

Signed-off-by: Thomas Weiß <[email protected]>

---------

Signed-off-by: Thomas Weiß <[email protected]>
(cherry picked from commit 5230879)

* fix: name the jwt requirement after its owning SecurityPolicy (#10442)

* fix: name the jwt requirement after its owning SecurityPolicy

Signed-off-by: kkk777-7 <[email protected]>

* renumber release notes

Signed-off-by: kkk777-7 <[email protected]>

* fix: name the jwt requirement after the policies applied to the route

Signed-off-by: kkk777-7 <[email protected]>

* fix: pick the local JWKS ConfigMap fallback key deterministically

Signed-off-by: kkk777-7 <[email protected]>

---------

Signed-off-by: kkk777-7 <[email protected]>
(cherry picked from commit fca6bee)

* fix: retry status updates on transient errors (#10449)

* fix: retry status updates on transient errors

The status writer only retried conflicts, so a timeout, throttling or a brief
API server outage dropped the update. Since the same status isn't re-sent,
the object kept a stale status until something else changed. Transient errors
are now retried with backoff, and each attempt gets its own timeout and stops
on shutdown.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* docs: name release note after PR number

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix: drop the per-attempt timeout from status retries

The timeout made client-side rate limiting fail early with an error that isn't
treated as transient, and cancelled in-flight writes on shutdown. The API calls
go back to a background context, and the handler's context now only stops the
backoff wait. Tests skip the real backoff waits.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix: use one backoff for status conflicts and transient errors

Conflicts and transient errors now share a single retry loop instead of a
nested one, so the worst case stays at about 1.5s. The loop uses
wait.ExponentialBackoffWithContext, which already stops waiting on shutdown.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix: go back to retry.OnError for status retries

Use retry.OnError with the shared backoff, the same pattern crdExists uses,
so the code reads like it did before. Each attempt checks for shutdown first,
so nothing is written once the handler stops.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix: keep the status retry change minimal

Go back to the original retry call and only add transient errors to what it
retries, with a longer backoff so they have time to clear. The shutdown
handling and the refactor are dropped to keep the change small.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* test: drop the status updater retry test

Remove the new test file to keep this change small.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix: count transient status retries under their own reason

Transient retries were counted as errors, so one lost update showed up as
several and a retry that later succeeded still looked like a failure. They
now use a separate transient reason, and error only counts updates that fail.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

* fix: treat connection-level API errors as transient

A refused or reset connection comes back from client-go as a transport error,
not a Kubernetes status error, so status writes gave up on the first attempt
while the API server was briefly unreachable. Widening isTransientError covers
both the status updater and the controller, which now requeues instead of
reporting a resource as invalid on a network blip.

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>

---------

Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
(cherry picked from commit c89fb11)

* fix(shutdown-manager): allow readiness responses after long waits (#10563)

Signed-off-by: floriankoch <[email protected]>
(cherry picked from commit 67f3a1c)

* fix(egctl): load ListenerSets from YAML (#10565)

* fix(egctl): load ListenerSets from YAML

`egctl x translate` silently dropped every ListenerSet in its input, and
with it every route whose parentRef points at a ListenerSet. The YAML
loader had no case for the ListenerSet kind, so the object fell through
the kind switch and was ignored. The rest of the pipeline already
supports ListenerSets: the kind constant, the Resources field and its
sort order exist, and the translator handles them when the Kubernetes
provider fills the field.

The file provider (standalone mode) uses the same loader, so it also
ignored ListenerSets until now. With this change, ListenerSets in a
watched directory are translated and programmed, as they are in
Kubernetes.

The new case has the same shape as the other typed-spec kinds. The CRD
defaulter and the local validator already know the ListenerSet schema:
the loader applies the allowedRoutes default, and an invalid listener
port is rejected with a schema error.

The translator tests in internal/gatewayapi did not catch this, because
they unmarshal their fixtures directly into Resources and do not use
the loader.

Tests: a ListenerSet in the loader fixture, and an egctl translate case
(gateway-api,ir, and xds route and listener) with a route attached to
a ListenerSet listener. Both fail without the fix.

Signed-off-by: Johan Dewe <[email protected]>

* docs: add release note for loading ListenerSets from YAML

Signed-off-by: Johan Dewe <[email protected]>

* fix(file): store ListenerSets in the standalone resource store

The file provider loads ListenerSets from YAML, but storeResources wrote
every loaded resource slice to the offline client except ListenerSets.
The offline controller never saw them, so in standalone mode their
listeners and attached routes were still not programmed.

The offline controller already supports ListenerSets: it assumes the
CRD exists and registers the ListenerSet indexes. Storing the slice is
the only missing step. Stale ListenerSets are removed through the same
key tracking as the other kinds.

Tests: TestFileProvider now writes a ListenerSet attached to each test
Gateway and expects it in the provider output. It fails without this
change.

Signed-off-by: Johan Dewe <[email protected]>

---------

Signed-off-by: Johan Dewe <[email protected]>
(cherry picked from commit d246d85)

* fix(egctl): set the controller namespace in translate (#10566)

* fix(egctl): set the controller namespace in translate

egctl x translate built its translators without ControllerNamespace,
so it was "". The OIDC translation reads the HMAC Secret from
<ControllerNamespace>/envoy-oidc-hmac, so every OIDC SecurityPolicy
failed with "HMAC secret /envoy-oidc-hmac not found" and every route it
targeted got a 500 direct response. This happened for all output types
(gateway-api, ir, xds), even when the input had the Secret in
envoy-gateway-system.

The three gatewayapi.Translator literals and the xDS
translator.Translator now use the existing -n/--namespace flag
(default envoy-gateway-system, "Namespace where envoy gateway is
installed"), as the controller does for both
(internal/gatewayapi/runner/runner.go, internal/xds/runner/runner.go).
TranslateGatewayAPIToXds already received the namespace for the rate
limit service URL; the two private helpers now take it as an argument.

The same field also sets the proxy namespace in the infra IR
(internal/gatewayapi/translator.go, gwInfraIR.Proxy.Namespace). With
--to ir, infraIR.proxy.namespace is now envoy-gateway-system instead
of "", which changes one line in the quickstart and extension-backends
golden files. This is intended: the controller sets the same value
from its own namespace, and the gatewayapi translator goldens already
show envoy-gateway-system there. xDS output does not change.

TranslateGatewayAPIToXds keeps its signature. Its other callers,
test/fuzz and test/gobench, pass "default", so their global-resource
lookups and infra IR proxy namespace now use "default" instead of "".
Their inputs have no envoy, envoy-oidc-hmac or envoy-ratelimit
resources, so only the unchecked infra IR namespace changes there.

Rejected alternatives:
- Clear Proxy.Namespace again in egctl to keep the old goldens. egctl
  would then keep printing a value that differs from the controller.
- Add a separate Translator field only for the HMAC lookup. That adds
  a field to a shared type only for egctl.

The egctl testdata had no OIDC case, which is why this was not caught.
The new oidc case covers gateway-api and xds (route) output, and ir.
The oidc-custom-namespace case puts the HMAC Secret in another
namespace and passes --namespace, so it fails if the flag stops
reaching the translators.

Signed-off-by: Johan Dewe <[email protected]>

* docs: add release note for the egctl OIDC namespace fix

egctl x translate now uses --namespace as the controller namespace, so OIDC SecurityPolicies translate offline. Users of egctl see the fix, so it needs a release note.

Signed-off-by: Johan Dewe <[email protected]>

---------

Signed-off-by: Johan Dewe <[email protected]>
(cherry picked from commit a3621b9)

* fix(provider): index OIDC provider backendRefs for SecurityPolicy (#10602)

* fix(provider): index OIDC provider backendRefs for SecurityPolicy

backendSecurityPolicyIndexFunc indexed ExtAuth and JWT remoteJWKS
backendRefs but not oidc.provider.backendRefs, so EndpointSlice and
Service changes for an IdP Service referenced only by an OIDC provider
were dropped by the reconcile predicates. Envoy kept the IdP's old pod IP
after a restart and token exchange failed until an unrelated reconcile.

Fixes #10601

Signed-off-by: Michael Erps <[email protected]>

* docs(release-notes): add OIDC backendRefs index fix

Signed-off-by: Michael Erps <[email protected]>

---------

Signed-off-by: Michael Erps <[email protected]>
(cherry picked from commit fcd46cd)

* fix: support certificates.k8s.io/v1 ClusterTrustBundle (#10579)

* fix: support certificates.k8s.io/v1 ClusterTrustBundle

Signed-off-by: zirain <[email protected]>

* fix docs

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: zirain <[email protected]>
(cherry picked from commit 11b5698)

* fix(provider): confirm against the API server before skipping a status write (#10409)

* fix(provider): confirm against the API server before skipping a status write

The status updater compares the desired status with the object from the
manager's cache and skips the write when they are equal. Right after its
own write, the cache can still hold the previous version of the object.
When updates for an object arrive out of order, as when the Gateway API
runner stores a status computed from an older snapshot, the updater wrote
the older status and then skipped the newer one, because the cache still
showed the newer status from its write before. The object kept the older
status, as seen in the flaky GatewayClassObservedGenerationBump
conformance test.

Remember the resourceVersion of the updater's last write per object.
When the cache is behind it and the status looks unchanged, read the
object from the API server before deciding. The entry is dropped once
the cache has caught up or the object was read from the server.

Signed-off-by: Alexej Disterhoft <[email protected]>

* docs: name the release note after the PR

Signed-off-by: Alexej Disterhoft <[email protected]>

* fix(provider): keep the last-write record until a skipped status is confirmed

When the cache looked behind the status updater's last write, the updater
dropped its record of that write before checking the API server. If the
following write then conflicted, the retry met the same stale cache
without the record, took the cached status for the current one, and
skipped the write.

Keep the record until the server confirms the status is unchanged, the
object is gone, or a write succeeds.

Signed-off-by: Alexej Disterhoft <[email protected]>

* fix(provider): key last-write records by group and kind

The status updater keyed its last-write records by kind and name. Extension
policy kinds are unstructured, and two of them can share a Kind in
different API groups, so their objects of the same namespace and name
shared a record. An update for one could consume the other's record, and
that object's next correction was then compared with its stale cache and
skipped.

Include the API group in the key.

Signed-off-by: Alexej Disterhoft <[email protected]>

* fix(provider): expire last-write records of the status updater

A last-write record was only dropped by the next update of the same
object. The last update of most objects is a write, and updates for
deleted objects never arrive, so the records of every object that ever
had its status written stayed for the life of the process.

Record when each write happened and drop records older than a minute, at
most once a minute. A record is only needed until the cache has seen the
write, which takes far less.

Signed-off-by: Alexej Disterhoft <[email protected]>

* refactor(provider): simplify the last-write records of the status updater

Key the records by UID instead of group, kind and name, since no two
objects share a UID. Records are now only added by writes and only
dropped when they expire. The early drops, once the cache showed the
write or the API server confirmed the status, only spared an API read
in rare cases.

Sweep expired records from a ticker on the Start goroutine instead of
throttling a sweep inside apply, which needs neither a sweep timestamp
nor an injected clock.

Signed-off-by: Alexej Disterhoft <[email protected]>

---------

Signed-off-by: Alexej Disterhoft <[email protected]>
(cherry picked from commit 0c2157f)

* test(egctl): adapt OIDC fixtures for release v1.9

Signed-off-by: zirain <[email protected]>

---------

Signed-off-by: Thomas Weiß <[email protected]>
Signed-off-by: kkk777-7 <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
Signed-off-by: floriankoch <[email protected]>
Signed-off-by: Johan Dewe <[email protected]>
Signed-off-by: Michael Erps <[email protected]>
Signed-off-by: zirain <[email protected]>
Signed-off-by: Alexej Disterhoft <[email protected]>
Co-authored-by: panos-- <[email protected]>
Co-authored-by: Kota Kimura <[email protected]>
Co-authored-by: Huabing (Robin) Zhao <[email protected]>
Co-authored-by: Florian Koch <[email protected]>
Co-authored-by: Johan Dewe <[email protected]>
Co-authored-by: merplerps <[email protected]>
Co-authored-by: Alexej Disterhoft <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestGatewayAPIConformance/GatewayClassObservedGenerationBump is flaky

4 participants