docs: correct failOpen, reload and anonymous access text

This commit is contained in:
2026-11-29 00:24:58 +00:00
parent 7de4448b7d
commit df1b86a5a5
2 changed files with 57 additions and 11 deletions
+17 -11
View File
@@ -242,22 +242,21 @@ that still has requests after `-reload-drain-timeout` closes anyway.
[`requestTimeout`](#request-timeout) — a progress-based watchdog, five
minutes by default — not a proxy deadline.
- **Config changes need a restart.** Traefik rebuilds the plugin
automatically on a CR change; a binary has no such hook. Roll the pods
by putting a checksum of the `ConfigMap` in the Deployment's pod
annotations, so an ArgoCD sync restarts them. There is deliberately no
SIGHUP and no file watcher: a rebuild re-runs the synchronous discovery
warm-fill, and a single-file watch never fires on a `ConfigMap` update
anyway (the kubelet swaps the whole directory's symlink).
- **Config changes reload on their own.** Traefik rebuilds the plugin
automatically on a CR change. The binary reloads when the file content
changes and on `SIGHUP`; see [Config reload in the binary](#config-reload-in-the-binary).
A checksum of the `ConfigMap` in the Deployment's pod annotations, so an
ArgoCD sync restarts the pods, is optional.
**The users file is the exception and needs none of this.** It still
hot-reloads on its own 5-second mtime poll from the request path, exactly
as in the plugin form. Do not add a watcher for it — it would race the
existing one.
- **Provider keys resolve once, at construction**, in both forms. Rotating
one means a restart even though the mounted file changed. Only
file-sourced *user* keys re-resolve on the users-file reload.
- **Provider keys resolve once per gateway build.** In the binary, `SIGHUP`
rebuilds the gateway and picks up a rotated `file:` provider key. In the
plugin form, a rebuild is the only way. Only file-sourced *user* keys
re-resolve on the users-file reload.
- **Mount the same secret volumes.** A `file:/llmgw/providers/openai`
`apiKey` reads that exact path in the binary too. Reproduce the volumes,
@@ -751,7 +750,11 @@ as the reserved user `anonymous` in that group:
```yaml
groups:
public:
providers: ["openai"]
models: ["gpt-5-mini"]
mcpServers: ["-none-"]
agents: ["-none-"]
passthroughPaths: ["-none-"]
limits: { requestsPerDay: 5000 }
memberLimits: { requestsPerMinute: 30 }
users:
@@ -780,6 +783,9 @@ to serve those requests as `anonymous` too:
- The admin API and the metrics key fallback still need a valid admin key.
Anyone who can reach the gateway can spend the providers this group allows.
An empty `mcpServers`, `agents` or `passthroughPaths` list on this group
allows every MCP server, A2A agent and native passthrough path. The example
sets each to a pattern that matches no name (`-none-`) to deny them.
Set group `limits` and `memberLimits`, and restrict who can reach the route
at the proxy.
@@ -3543,7 +3549,7 @@ plugin's config.
a temporary gap in the series is the honest signal; a fabricated `0`
would read to Prometheus as a counter reset followed by a phantom spike
the instant the store recovers. This holds regardless of
`redis.failOpen`: with `failOpen: false` (or unset) the request itself
`redis.failOpen`: with `failOpen: false` the request itself
is refused during the outage, and with `failOpen: true` (the default)
requests keep flowing against the in-process fallback, but `/metrics`
still treats the affected scopes as unreadable rather than presenting
+40
View File
@@ -0,0 +1,40 @@
package traefikllmgateway
import (
"net/http"
"net/http/httptest"
"testing"
)
// The values mirror the README "Anonymous access" example.
func TestReadmeAnonymousExample_DeniesTargets(t *testing.T) {
cfg := &Config{
Providers: map[string]*ProviderConfig{"openai": {Type: "openai", APIKey: "k"}},
Groups: map[string]*GroupConfig{
"public": {
Providers: []string{"openai"},
Models: []string{"gpt-5-mini"},
MCPServers: []string{"-none-"},
Agents: []string{"-none-"},
PassthroughPaths: []string{"-none-"},
Limits: &LimitsConfig{RequestsPerDay: 5000},
MemberLimits: &LimitsConfig{RequestsPerMinute: 30},
},
},
Users: &UsersConfig{AnonymousGroup: "public"},
}
a, err := newAuthStore(cfg)
if err != nil {
t.Fatal(err)
}
_, grp, ok := a.identify(httptest.NewRequest(http.MethodPost, "/v1/chat/completions", nil))
if !ok {
t.Fatal("anonymous request not identified")
}
if grp.allowsMCP("docs") || grp.allowsAgent("planner") || grp.allowsPassthroughPath("v1/files") {
t.Fatal("README anonymous example allows an MCP server, agent or passthrough path")
}
if !grp.allowsProvider("openai") {
t.Fatal("README anonymous example denies its own provider")
}
}