Repository navigation
feat: support gateway token passthrough for embedded controllers - #3263
codyhartsook wants to merge 5 commits into
Conversation
919ddbf to
447b070
Compare
|
🤖 AI-generated review. I think this is putting the extension behavior too high in the stack. The use case is that we want different behavior on the compiled Substrate Could we make type EgressPolicyCompiler interface {
Compile(context.Context, EgressPolicyInput, *ateapipb.EgressPolicy) error
}The OSS compiler would always run first and build the normal allowlist and credential effects. Embedded controllers could register additional compilers that run afterward and add their behavior for the relevant origins. The chain would validate the final policy and reject conflicting effects rather than using last-writer-wins. That would let the generic compilation path keep With that boundary, I don't think we need |
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
447b070 to
c73cf6a
Compare
| return egress.Access{}, nil, err | ||
| } | ||
| return egress.EffectiveAccess(base, grants, row.TokenPassthroughOrigins) | ||
| return access, targets, nil |
There was a problem hiding this comment.
should passthrough targets be a part of access?
There was a problem hiding this comment.
Yeah, makes sense. I kept them separate because targets are pinned to the revision, but they can live on Access
There was a problem hiding this comment.
Why are targets pinned to the revision?
There was a problem hiding this comment.
so the gateway policy matches the actor’s compiled config, even after the Agent or ModelConfig change
There was a problem hiding this comment.
updated so they are on Access
| // host set the request goes to that host, so api.ollama.com never | ||
| // needs to be reachable. | ||
| hasCredential := modelConfig.Spec.APIKeySecret != "" || modelConfig.Spec.TokenPassthrough | ||
| hasCredential := modelConfig.Spec.APIKeySecret != "" |
There was a problem hiding this comment.
Ollama doesn’t read the caller token today, so added a validation error for passthrough and removed because its now unreachable. Could split that into a separate fix
There was a problem hiding this comment.
I know there's the ability to use ollama cloud, but you're the Ollama client doesn't support passthrough?
There was a problem hiding this comment.
🤖 AI assisted response.
Ollama Cloud works with a Secret key, but our Ollama clients never read the caller token. The Go ADK takes the key only from OLLAMA_API_KEY, and the Python ADK ignores api_key_passthrough. So tokenPassthrough on an Ollama model has no effect today. With no key, a cloud model even routes to the local daemon. Supporting it means having the Ollama client use the passthrough token, which I'd do as a follow-up
There was a problem hiding this comment.
reverted, I'll address this in a follow up instead
| } | ||
| // Populate shared transport settings. | ||
| populateTLSFields(ollama, model.Spec.TLS) | ||
| ollama.ApiKeyPassthrough = model.Spec.TokenPassthrough |
There was a problem hiding this comment.
same reason as above, the ollama runtime never reads this flag. I’ll keep these changes together in a separate fix
|
|
||
| // Populate shared transport settings. | ||
| populateTLSFields(bedrock, model.Spec.TLS) | ||
| bedrock.ApiKeyPassthrough = model.Spec.TokenPassthrough |
There was a problem hiding this comment.
same issue with Bedrock, the runtime doesn’t use this flag to forward the caller token
|
|
||
| // validCredentialURI accepts ate-secret://<provider>/<path>. Provider names are | ||
| // lowercase DNS names without ports. k8s.io paths name one Secret key. | ||
| func validCredentialURI(raw string) error { |
There was a problem hiding this comment.
Did this functionality move or did it just get added?
There was a problem hiding this comment.
a bit of both. I pulled the existing validation into a helper for clarity and expanded it to allow other credential providers. The k8s.io checks stay intact. Func was getting a bit hard to read
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
…low-up Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Signed-off-by: Cody Hartsook <cody.hartsook@solo.io>
Lets an embedding controller deliver tokenPassthrough credentials at the egress gateway, through app.Options.EgressPolicyCompilers. Builds on #3177 and #3257.
Behavior change with no compiler registered:
The Migration Immutability check fails because this edits 000001_initial.sql, as that file's header allows until the 1.0 release.
Testing: the affected race suites and the migration and PostgreSQL round-trip tests pass locally, and CI lint passes.