Repository navigation
Clean up v1alpha1 field names and drop unused fields - #485
Conversation
- ModelSpec: drop the reserved ranges left over from the typed generation settings and renumber secret_key (6 -> 3) and parameters (7 -> 4). - TaskStatus: remove pending_approval and usage, along with the PendingApproval and UsageStats messages. Nothing set or read them. - Rename ResourceReqs to ResourcesSpec. - Rename Condition.last_transition_time to update_time and ObjectMeta.creation_timestamp to create_time, following the AIP timestamp naming. update_time also matches what the controller does: setCondition refreshes it on every update, not only when the status changes. - Add a TODO to reconsider WorkspaceRef.goal. This is a breaking change. The ModelSpec renumbering changes the wire format, so the ax CLI and ax-server must be upgraded together. The JSON/YAML keys lastTransitionTime and creationTimestamp become updateTime and createTime; records already stored in Redis load without those timestamps, and the server re-stamps the creation time on the next update.
There was a problem hiding this comment.
Code Review
This pull request refactors the API schema by renaming several timestamp fields (such as creation_timestamp to create_time and last_transition_time to update_time), renaming ResourceReqs to ResourcesSpec, and removing unused fields from TaskStatus. A critical feedback points out that renumbering the protobuf tags for secret_key and parameters in ModelSpec breaks binary compatibility with existing serialized data, which could lead to decoding failures and data loss. It is highly recommended to retain the original tags and keep the deleted tags reserved.
mayawang
left a comment
There was a problem hiding this comment.
LGTM overall, the AIP naming and dropping the dead fields is a good cleanup. Two things to coordinate: dropping status.usage overlaps with #471 (budgets), which proposes filling it, so worth a note there that usage comes back through that design. And the ResourceReqs rename will need another rebase of #405 from an external contributor; maybe land #405 first, or let them know.
google#485 renamed ResourceReqs to ResourcesSpec, so this branch no longer built against main (pkg/apis/v1alpha1/resources.go:40). Use the new name in ValidateResources, substrate.ResourceLimits, and their tests.
* feat(controller): apply Task resource limits to the ActorTemplate
TaskSpec.resources is documented and accepted by ax-server, but the
controller never read it, so spec.resources.limits had no effect on the
sandbox. Translate limits.cpu and limits.memory into the Substrate
ActorTemplate resources block (Substrate's {name, quantity} list) when
provisioning the per-task template.
Substrate sizes sandboxes by limits only, so requests are documented as
not applied. A limits change already yields a new template because the
launch spec is part of the template digest via AX_TASK_YAML; a test now
pins that behaviour.
Fixes #369
Co-authored-by: Matt Van Horn <[email protected]>
* controller: validate resource limits and never fall back without them
Address review on #405:
- Validate spec.resources before provisioning, at apply time via
ValidateTask and again in the reconciler. Quantities follow the
Kubernetes quantity grammar, must be greater than zero, and the cpu
limit must be below 1000 cores, matching what Substrate enforces on the
ActorTemplate. Invalid values fail the reconcile with Ready=False,
reason InvalidResources.
- When a task has limits and Substrate rejects the per-task template,
fail the reconcile (reason TemplateCreationFailed) instead of falling
back to the default template, which would run the task without the
limits it asked for. Tasks without limits keep the existing fallback.
- Reject spec.resources.requests with a clear message: Substrate sizes
sandboxes by limits alone, so accepting and ignoring it was misleading.
The docs and examples/task.yaml drop the requests block.
- Tests: failure paths for invalid limits and for a rejected template
with and without limits, plus an explicit assertion that a limits
change yields a differently named template.
Co-authored-by: Matt Van Horn <[email protected]>
* test: name the ValidateTask fixtures in TestValidateResources
Keeps the test valid alongside metadata.name validation (#406).
Co-authored-by: Matt Van Horn <[email protected]>
* v1alpha1: follow the ResourceReqs to ResourcesSpec rename
#485 renamed ResourceReqs to ResourcesSpec, so this branch no longer
built against main (pkg/apis/v1alpha1/resources.go:40). Use the new name
in ValidateResources, substrate.ResourceLimits, and their tests.
---------
Co-authored-by: Matt Van Horn <[email protected]>
This is a breaking change. The ModelSpec renumbering changes the wire format, so the ax CLI and ax-server must be upgraded together. The JSON/YAML keys lastTransitionTime and creationTimestamp become updateTime and createTime; records already stored in Redis load without those timestamps, and the server re-stamps the creation time on the next update.