fix(gateway): circuit breaker should check if upstream exists before creating#326
Open
stefan-ctrl wants to merge 8 commits into
Open
fix(gateway): circuit breaker should check if upstream exists before creating#326stefan-ctrl wants to merge 8 commits into
stefan-ctrl wants to merge 8 commits into
Conversation
…tream for circuit breaker
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Circuit Breaker feature’s Kong Admin API interaction so that upstream targets are upserted (idempotent reconciliation) rather than always created.
Changes:
- Switch Circuit Breaker target management from
CreateTargetForUpstreamWithResponse(POST) toUpsertTargetForUpstreamWithResponse(PUT). - Extend the
KongAdminApiinterface and regenerate the gomock client to includeUpsertTargetForUpstreamWithResponse. - Update Circuit Breaker unit tests to mock/verify the new upsert target call.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| gateway/pkg/kong/client/mock/client.gen.go | Adds the gomock method/recorder for UpsertTargetForUpstreamWithResponse. |
| gateway/pkg/kong/client/client.go | Extends KongAdminApi interface with the new upsert-target method. |
| gateway/internal/features/feature/circuit_breaker.go | Uses target upsert (PUT) and updates status-code/error handling for targets. |
| gateway/internal/features/feature/circuit_breaker_test.go | Updates mocks/assertions for the new upsert-target call. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -155,25 +156,27 @@ var _ = Describe("CircuitBreakerFeature", func() { | |||
| } | |||
| mockKongAdminApi.EXPECT().UpsertUpstreamWithResponse(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(upsertUpstreamWithResponse_func).Times(1) | |||
… constraint violation
…nce target is known
ron96g
reviewed
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(gateway): circuit breaker should check if upstream exists before creating
refactor(gateway): circuit breaker requests have better logging by showing the path the caused the error