[FIX] Address further review comments on multi-provider routing#2590
Merged
Arshardh merged 1 commit intoJul 11, 2026
Merged
Conversation
- Constrain LLMProxyTransformer.version to major-only in the management OpenAPI schema and the gateway-controller LLM validator. - Add operator-side LLMProxyTransformer type + additionalProviders[].transformer field; regenerate deepcopy and both CRD artifacts (operator + Helm). - Eagerly validate additionalProviders (existence + unique upstream names) at LLM proxy Create/Update, covered by Create/Update tests.
Aakashwije
requested review from
AnuGayan,
Arshardh,
CrowleyRajapakse,
HeshanSudarshana,
HiranyaKavishani,
Krishanx92,
PasanT9,
RakhithaRR,
Tharsanan1,
Thushani-Jayasekera,
VirajSalaka,
ashera96,
chamilaadhi,
dushaniw,
hisanhunais,
lasanthaS,
malinthaprasan,
pubudu538,
renuka-fernando,
senthuran16,
tgtshanika,
tharikaGitHub,
tharindu1st and
thivindu
as code owners
July 11, 2026 05:29
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Purpose
This is a follow-up to #2586 (multi-provider routing for LLM proxies), addressing
review feedback raised on that PR. Three gaps were flagged:
LLMProxyTransformer.versionis documented as major-only (e.g.
v1), but the schema only enforcedminLength: 1, so values likev1.0orlatestwere accepted at the APIboundary and only failed later at gateway transform time, where the value is
used as
api.Policy.Version(which requires^v\d+$).LLMProxyAdditionalProviderhad noTransformerfield, so the generated CRDssilently pruned
spec.additionalProviders[*].transformer— blockingconditional request/response translation for operator-managed proxies.
validated the primary
provider.idbut neveradditionalProviders[].id, so areference to a nonexistent provider or a duplicate upstream name passed the
API and only failed later at gateway transform time with a confusing
deployment-time error.
Related to: #2586
Goals
validator), matching the gateway's
^v\d+$policy-version contract.additionalProviders[*].transformerbyadding the field to the operator API and regenerating the CRDs.
additionalProvidersatCreate/Update instead of a deferred gateway failure.
Approach
pattern: '^v\d+$'toLLMProxyTransformer.versioningateway/gateway-controller/api/management-openapi.yaml.LLMValidator.validateLLMProxyTransformer(
gateway/gateway-controller/pkg/config/llm_validator.go), reusing theexisting package-level
majorVersionPatternso file-loaded configs (whichbypass HTTP request-schema validation) are also guarded.
LLMProxyTransformertype and aTransformer *LLMProxyTransformerfield on
LLMProxyAdditionalProviderinkubernetes/gateway-operator/api/v1alpha1/llmproxy_types.go(version marked+kubebuilder:validation:Pattern=^v\d+$``, params modeled as a schemalessruntime.RawExtension, mirroring existing policy params).zz_generated.deepcopy.goand both CRD artifacts (operatorconfig/crd/bases/…_llmproxies.yamland the Helm chart copy) with theproject-pinned
controller-gen v0.16.5. No controller wiring was needed —the controller serializes the whole spec to JSON, so the new field flows
through automatically.
validateAdditionalProvidershelper inplatform-api/internal/service/llm.go, called from bothCreateandUpdatebefore the model is built. It mirrors the gateway's transform-timechecks: every referenced provider must exist, and each upstream name (the
asalias, oridwhen unset) must be unique within the proxy and must notcollide with the primary provider id.
User stories
version, I get an immediate validation error instead of a deferred
deployment-time failure.
per-provider request/response transformer on an additional provider and have it
applied.
reuse an upstream name, Create/Update fails fast with a clear error.
Documentation
N/A — no user-facing doc impact. Changes are schema-level constraints, an operator
CRD field addition, and stricter server-side validation; the existing
multi-provider routing documentation from #2586 already describes the transformer
and
additionalProvidersshape.Automation tests
platform-api/internal/service/llm_test.gocovering thenew additional-provider validation on both handlers:
TestLLMProxyServiceCreateFailsWhenAdditionalProviderNotFoundTestLLMProxyServiceCreateFailsWhenAdditionalProviderNameCollidesTestLLMProxyServiceUpdateFailsWhenAdditionalProviderNotFoundTestLLMProxyServiceUpdateFailsWhenAdditionalProviderNameCollidesThey assert
ErrLLMProviderNotFound/ErrInvalidInputand that Update isrejected before persisting.
go test ./internal/service/(platform-api) andgo test ./pkg/config/(gateway-controller) pass.
go build ./...andgo vet ./api/...; the transformer version validator and OpenAPIpatternare enforced by existing schema/validation paths (no dedicated new unit test
added for those two — they reuse the already-tested major-only convention).
Security checks
Java/SpotBugs plugin; the modified code is Go (gateway-controller, platform-api,
operator).
other secrets? yes — the commit contains exactly 8 source/generated files;
the locally generated
platform-api/config/data/secret-encryption.keywasexplicitly excluded and never staged.
Samples
gateway/examples/openai-multi-provider-proxy.yaml(from #2586) exercisesadditionalProviders[*].transformerwith major-only versions (v1), which thenew schema pattern, validator, and eager validation all accept.
Related PRs
comments)
Test environment
repository mocks, no live DB required