Repository navigation
Conversation
|
FYI @MushuEE, @bdubs00 has a working branch for Task egress on #449 (spec.egress with per-protocol rules, hostnames and ports): #449 (comment). Worth comparing with the egress shape here, so we land one API. |
spec.egress.hosts replaces spec.egress.rules, the shape that google#499 proposes for the API: a list of DNS names, each with an optional scheme and port. A name alone is TLS on port 443 that the egress gateway forwards without decryption, http:// is cleartext HTTP on port 80, https:// is HTTPS on port 443 that the gateway intercepts, and a port after the name replaces the default. ParseEgressHost reads one entry. The API server validates every entry at apply time and refuses two entries that name the same host and port, which Substrate refuses in one policy. The controller writes one rule per host. The scheme and the port matter for a task that reaches services inside the cluster, such as a model proxy or a message bus on port 8080 over cleartext HTTP, which a hosts-only list over TLS on 443 cannot express. Refs google#449, google#499
Hey Maya! I lined the branch up with #499 (main...bdubs00:ax:feat/task-egress-policy)- spec.egress is now a hosts list, and the controller creates the actor’s egress policy right after EnsureActor. To reach in-cluster services over cleartext HTTP or non-443 ports, entries can also take http://, https://, or :port. Each form maps directly to a Substrate rule (TLSPassthroughRule, HTTPRule, HTTPSRule), so per Jaana’s note on #501 it stays within the EgressPolicy schema rather than defining its own shape. Everything else behaves as before, and make test passes. |
Agent Substrate denies all sandbox egress by default, so a task that calls a model API has to say which hosts it needs. spec.egress.hosts lists lowercase DNS names, optionally with a leading "*." label, or "*"; apply-time validation also rejects duplicates, numeric top-level labels and more than 256 hosts, all of which Substrate would refuse later on a task that cannot be edited. The message and field name match upstream's draft google#499; the field number is 8 because this fork already uses 7 for agent. The runner's unknown-field test now uses a field that is still unknown.
… API API only. TaskSpec gains egress.hosts (field 8), and EnvVar gains secretRef: a secret in one of the atespace's SecretStores plus where Agent Substrate's egress gateway should inject it (host, header, prefix, matching Substrate's CredentialHeader). SecretStore is a new atespace-scoped resource for where secrets live, with a Kubernetes Secrets backend. Nothing acts on these yet: CreateTask rejects tasks that use egress or secretRef with Unimplemented, and the SecretStore RPCs are unimplemented. Follow-up changes add the store, egress policies (#449), and credential injection. The runner's unknown-field test used "egress" as its example of an unknown field; it now uses a name that stays unknown. Part of #475.
|
Closing in favor of other changes from branch drift |
First step for #475: the API for egress hosts and secret-backed env vars, with no behavior change yet. Splitting this up so the API shape can be reviewed on its own before anything acts on it.
What's in here
TaskSpec.egress.hosts: the outbound hosts a task may reach (TLS on 443,*.prefix for subdomains).EnvVar.secretRef: an env var backed by a secret instead of a literal value. The task gets a placeholder, and the secret is meant to be injected into outbound requests by Substrate's egress gateway.injectmirrors Substrate'sCredentialHeader(header + prefix), plus the host it applies to:SecretStore: a new atespace-scoped resource for where an atespace's secrets live, so tasks just name a secret and the atespace decides the backend. v1 has a Kubernetes Secrets backend only (spec.kubernetes.namespace, defaulting to the atespace name). Get/List/Update/Delete RPCs are defined.Validation covers hostnames, header names, mutually exclusive
value/secretRef, URI-safe secret names and keys, and the same header injected twice for one host.Nothing acts on it yet
CreateTaskreturnsUnimplementedfor tasks that setegressorsecretRef, so nothing runs without the network or credentials it asked for.SecretStoreRPCs are unimplemented.Coming next
The rest of the stack is tracked on #475:
egress.hostsplus the egress trust bundle (Tasks have no network access on current Agent Substrate because ax never creates an egress policy #449)secretRefNotes
ax_grpc.pb.gowas regenerated with protoc 5.28.2 to matchax.pb.go, so its header version line changes.go vet ./...andgo test ./...pass.