Skip to content

fix: read live status before update comparison - #9509

Open
Aias00 wants to merge 8 commits into
envoyproxy:mainfrom
Aias00:worktree-issue-9432-programmed-recovery
Open

Aias00 wants to merge 8 commits into
envoyproxy:mainfrom
Aias00:worktree-issue-9432-programmed-recovery

Conversation

@Aias00

@Aias00 Aias00 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • read the current object through the uncached API reader before comparing status updates
  • keep status writes on the controller-runtime client while avoiding stale informer cache comparisons
  • add a regression test for stale cached Gateway status skipping a required Programmed recovery update

Test Plan

  • go test ./internal/provider/kubernetes ./internal/gatewayapi/status -count=1
  • git diff --check

Fixes #9432

Copilot AI review requested due to automatic review settings July 15, 2026 22:48
@Aias00
Aias00 requested a review from a team as a code owner July 15, 2026 22:48
@netlify

netlify Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cerulean-figolla-1f9435 ready!

Name Link
🔨 Latest commit 8d19288
🔍 Latest deploy log https://app.netlify.com/projects/cerulean-figolla-1f9435/deploys/6ac86e5aa1c59600083495ce
😎 Deploy Preview https://deploy-preview-9509--cerulean-figolla-1f9435.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a Kubernetes provider status-update edge case where comparing against a stale informer-cached object could incorrectly skip a required Gateway status update (e.g., Programmed recovery), by reading the live object from the API server before doing the status equality comparison.

Changes:

  • Inject a statusReader into the status UpdateHandler and use it to Get the current object before comparing status updates.
  • Wire the provider to pass mgr.GetAPIReader() to avoid stale cache reads during status comparison.
  • Add a regression test ensuring a stale cached Gateway status does not prevent a required Programmed recovery update.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
internal/provider/kubernetes/status_updater.go Adds an API-reader-based fetch path for status comparisons to avoid stale cache skipping updates.
internal/provider/kubernetes/status_updater_test.go Adds a regression test that exercises the stale-cache comparison scenario and asserts a status write occurs.
internal/provider/kubernetes/kubernetes.go Wires mgr.GetAPIReader() into the status update handler construction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@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: ab81d3505c

ℹ️ 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".

@Aias00
Aias00 force-pushed the worktree-issue-9432-programmed-recovery branch 2 times, most recently from 469d75c to fbc7846 Compare July 15, 2026 22:52
@codecov

codecov Bot commented Jul 15, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.54%. Comparing base (aa1a3ac) to head (8d19288).
⚠️ Report is 160 commits behind head on main.

Files with missing lines Patch % Lines
internal/provider/kubernetes/status_updater.go 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9509      +/-   ##
==========================================
- Coverage   81.55%   81.54%   -0.02%     
==========================================
  Files         266      266              
  Lines       41568    41567       -1     
==========================================
- Hits        33901    33896       -5     
- Misses       7666     7670       +4     
  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.

@Aias00
Aias00 force-pushed the worktree-issue-9432-programmed-recovery branch from fbc7846 to 18e7837 Compare July 15, 2026 23:33
@Aias00

Aias00 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

/retest

jukie
jukie previously approved these changes Jul 16, 2026

@jukie jukie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM with 1 nit

@eplightning

Copy link
Copy Markdown

Any chance to consider this for some future release, or is the plan to solve it some other way?

This messed with ArgoCD and other gitops tools that monitor health of gateway resources.

@zirain

zirain commented Sep 9, 2026

Copy link
Copy Markdown
Member

@codex review

@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: 21e8cc2dad

ℹ️ 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".

Comment on lines +23 to +26
func TestUpdateHandlerApplyReadsStatusFromStatusReader(t *testing.T) {
key := types.NamespacedName{Namespace: "default", Name: "gateway"}
staleCachedGateway := gatewayWithProgrammedStatus(key, metav1.ConditionTrue)
liveGateway := gatewayWithProgrammedStatus(key, metav1.ConditionFalse)

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 Add an end-to-end Programmed recovery regression

This user-visible bug occurs when Envoy replicas recover while the informer and API-server status differ, but the new test only constructs two disconnected fake clients and invokes apply directly. I checked test/e2e and found no scenario that makes a Gateway become unavailable and then verifies that its Programmed condition returns to True, so the manager wiring, status subscription, and actual recovery flow remain untested and could regress while this unit test still passes.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, when it's ready. Thank you for your contributions!

@github-actions github-actions Bot added the stale label Oct 9, 2026
@chatgpt-codex-connector

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

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T04:36:56.662357Z 8d19288 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.

@github-actions github-actions Bot removed the stale label Oct 9, 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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gateway status stays Programmed=False even after deployment recovers

6 participants