feat: let a PrefectServer require an auth string #411
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.68) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.68 · 409 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.360
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.068
Real PR Conversation Timeline
1 comments
"Review active on #411"
general
weight: 0.35
chrisguidry
A
PrefectServeraccepted API requests from anything that could reach it, including the operator acting for a resource in another namespace. A resource can name the server inspec.server, or put its Service URL inremoteApiUrl, so checkingspec.server.namespacealone can't limit which namespaces use a server.PrefectServer.spec.authnames a Secret key holdingusername:password. The operator setsPREFECT_SERVER_API_AUTH_STRINGfrom it, and Prefect then requires HTTP basic authentication on every request except/healthand/ready, so the probes keep working.spec.server.authon the other resources names a Secret in the resource's namespace with the same string. The operator reads it like an API key Secret: theprefect.io/allowed-api-urlsannotation must list the URL, and the client doesn't follow redirects.PREFECT_API_AUTH_STRING, whichsettingsmust not set.spec.authrequires Prefect 3.6.22. For an earlierprefecthq/prefectimage, the operator leaves the Deployment as it is and setsDeploymentReconciledtoFalsewith the reasonUnsupportedVersion. It can't tell the version of other images, of tags such as3-latestand3.6-python3.12, or of an image with a digest. It deploys those, and sets theAuthSupportedcondition toUnknown.secretKeyRef.optionalmust not betrue, so a server doesn't start without its auth string.AuthSupportedcondition, setsDeploymentReconciledtoFalsewith the reasonInvalidAuth, and retries.settingsmust not setPREFECT_SERVER_API_AUTH_STRINGwhenspec.authis set, because settings override the variables the operator derives. The CRD rejects the exact name. For the name in another case, the operator setsInvalidAuth.kuberneteswork pool, flow run Jobs read the auth string from the Secret instead of holding it in their manifest. The Secret must exist in the namespace the Jobs run in, which isdefaultin Prefect's default base job template. This requiresprefect-kubernetes0.6.3 in the worker's image. Workers of other types pass the auth string in their own way, which the guide notes.apiKeyandauth. The chart's admission policy requiresgeton the auth Secret, as it does for an API key Secret.A new guide covers turning on auth for a running server, sharing a server across namespaces by copying the Secret, the NetworkPolicy case, and the string being sent over plain HTTP inside the cluster.
Rollout caveats
no-op: servers without spec.auth behave as before.<details>
<summary>Session context</summary>
The first plan was a
spec.allowedNamespaceslist on the server. A resource can put the server's Service URL inremoteApiUrland skip that check, so authentication on the server itself replaced it. I tested auth on a kind cluster, with a server in one namespace and akuberneteswork pool in another. A flow run completed, and its Job held asecretKeyRef.</details>
🤖 Generated with Claude Code