Repository navigation
runnerhttp, server: add :8081 runner HTTP handler, Actor JWT auth, an… - #635
Conversation
|
ref #631 (comment) |
mayawang
left a comment
There was a problem hiding this comment.
Nice work, the JWT handling fails closed and the egress rule is tight. One fix before merge: jwt.go reads actor_uid/uid at the top level, but Substrate v1.0 puts it inside "actor.ate.dev": {atespace, actorName, actorUID} (see Substrate's actor-jwts guide), so every real token gets "missing actor_uid claim" and prewarm setup hangs. The tests hand-craft the old shape, worth one using Substrate's example token.
Follow-up before Runnable gets set: the ActorUID check only runs when row.ActorUID is set, and nothing writes it yet, so any incarnation's token passes. Could it fail closed when empty, with the reconciler recording ActorUID and resetting the token per incarnation?
Also, CI didn't run here since it targets #633's branch, worth a run once rebased onto main.
c5f797a to
ae2485f
Compare
f1c2315 to
ae2485f
Compare
| flag.StringVar(&runnerEndpoint, "runner-endpoint", substrate.DefaultRunnerEndpoint, "In-cluster host:port of the :8081 runner service allowed in actor EgressPolicies (env: AX_RUNNER_ENDPOINT)") | ||
| flag.StringVar(&actorJWTIssuer, "actor-jwt-issuer", "https://idp.ate-system.svc", "Substrate OIDC issuer URL for verifying Actor JWTs on :8081 (env: AX_ACTOR_JWT_ISSUER)") | ||
| flag.StringVar(&actorJWTAudience, "actor-jwt-audience", substrate.DefaultRunnerAudience, "Expected OIDC audience for Actor JWTs on :8081 (env: AX_ACTOR_JWT_AUDIENCE)") | ||
| flag.BoolVar(&enablePrewarm, "enable-prewarm", false, "Enable Workspace snapshot pre-warming via the :8081 runner setup coordinator (env: AX_ENABLE_PREWARM)") |
There was a problem hiding this comment.
Any case we will disable it? I think we will enable it by default once we finish implementation.
There was a problem hiding this comment.
It's a temporary guard before the pull-based ax-task-runner lands.
| workspaces := controller.NewWorkspaceManager(subClient, controller.WorkspaceManagerOptions{ | ||
| Locker: backend, | ||
| Store: backend, | ||
| SetupCoordinator: setupCoordinator, |
There was a problem hiding this comment.
Good to see there is a setup coordinator in place. But do we need another one with db to support multiple replicas case?
There was a problem hiding this comment.
deploy/ax-server.yaml currently runs replicas: 1, so an in-memory coordinator is sufficient for now.
|
|
||
| // RegisterSetup records an expected Workspace setup actor incarnation prior to | ||
| // ResumeActor so ClaimAssignment can immediately serve ASSIGNMENT_MODE_SETUP. | ||
| func (s *Server) RegisterSetup(_ context.Context, atespace, setupActor, actorUID string, ws *v1alpha1.Workspace) error { |
There was a problem hiding this comment.
I would think it may be cleaner if we have a standalone object to implement the in-memory coordinator as we probably need a persisted one when we support multiple replica ax-server.
Ok to be follow up
There was a problem hiding this comment.
Ack, will follow-up.
…vents, and return IDLE for interactive tasks
ae2485f to
291f5d8
Compare
mayawang
left a comment
There was a problem hiding this comment.
Thanks, both look right now, LGTM. Heads up for wiring: with the ActorUID check failing closed, nothing writes row.ActorUID yet, so task claims will 401 until the reconciler records it when it creates the actor. Worth landing that alongside #637.
Summary
Adds
ax-server's internal:8081pull-based runner HTTP handler (internal/runnerhttp), Substrate Actor JWT OIDC verification, in-memorySetupCoordinatorfor Workspace pre-warming, andRunnerEgressRule(internal/substrate/runner_egress.go).Zero file overlap with #630 (
internal/store), #631 (deploy/ax-server.yamlNetworkPolicy/Service), or #624 (internal/substrate/client.go,runner/).Key Changes
internal/runnerhttp(jwt.go,server.go,server_test.go): ServesGET /healthz,POST /runner/v1/assignment:claim, andPOST /runner/v1/eventswith Substrate Actor JWT verification (OIDCVerifier), implementscontroller.SetupCoordinator(RegisterSetup,AwaitSetup,DeleteSetup), and flushes HTTP200 OKbefore asynchronously parking finished task actors (ActorParker.SuspendActor).internal/substrate/runner_egress.go: AddsRunnerEgressRule(:8081+ActorJwtSourceheader replacement).internal/controller/workspace.go: Always bindsRunnerEgressRuleon temporaryax-ws-setup-*setup actors (even whensetupGateway == nil).cmd/ax-server/main.go: Wires--runner-addr=:8081,--actor-jwt-issuer,--actor-jwt-audience, and--enable-prewarm(defaultfalseuntil the pull-basedax-task-runnerlands).Testing
go test -count=1 ./internal/runnerhttp/... ./internal/lifecycle/... ./internal/controller/... ./internal/substrate/... ./cmd/ax-server/...golangci-lint(0 issues)