Skip to content

feat(templates): declarative K8S compute configs for 3 pilot templates - #940

Open
Aydin-ab wants to merge 3 commits into
mainfrom
add-azure-declarative-compute-config
Open

feat(templates): declarative K8S compute configs for 3 pilot templates#940
Aydin-ab wants to merge 3 commits into
mainfrom
add-azure-declarative-compute-config

Conversation

@Aydin-ab

@Aydin-ab Aydin-ab commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Adds an optional K8S: compute-config key pointing at a declarative k8s.yamlrequired_resources shapes resolved server-side into free pods, no registered instance types, one config covering AKS/EKS/GKE. Three pilots span the shape space: workspace-intro (single node), getting-started (multi-node CPU), pytorch-fsdp (multi-node GPU, 2×T4 via required_labels: {ray.io/accelerator-type: T4} — Azure GPU pools have no L4/A10G). The validator accepts the new key and enforces the declarative contract: no instance_type, no auto_select_worker_config (incompatible with declarative configs), and GPU counts paired with the accelerator-type label (launch validation reads the label, not a required_resources.accelerator key).

Groundwork for the Azure/K8s template path: rayapp build already carries the key into bundles as-is; the product launch path selecting + honoring it lands separately (today it force-selects AWS and flattens on K8s clouds), so the key is inert in prod until then.

Testing

  • pre-commit run --all-files green (BUILD.yaml validator gate included).
  • rayapp build: all 56 bundles build; the three pilots' ray-app.json carry the K8S config with required_resources + required_labels preserved verbatim.
  • All three files parse through anyscale.compute_config.models.ComputeConfig (instance_typecustom).
  • Shapes checked against https://docs.anyscale.com/configuration/compute/declarative and the backend's check_gpu_accelerator_consistency (GPU count must pair with the ray.io/accelerator-type label; auto-select unsupported with declarative).
  • Validator negative cases exercised: instance_type, auto_select_worker_config, GPU without label, accelerator inside required_resources, empty required_resources, non-dict nodes, cross-dir K8S path, wrong filename — each fails with a targeted error.

https://claude.ai/code/session_013BsS5dSk6s6xsLx2FbBy7g

The AWS/GCP compute keys name VM instance types, which K8s-stack
clouds (AKS/EKS/GKE) cannot honor — the backend currently flattens
them to a head-only CPU pod at launch. A declarative k8s.yaml
(required_resources) instead resolves server-side into free pods,
needing no registered instance types, and one config covers every
K8s stack — hence a single K8S key rather than per-provider ones.

Pilots span the shape space: single node + auto-select
(workspace-intro), multi-node CPU (getting-started), multi-node GPU
(pytorch-fsdp, 2x T4 — chosen because Azure GPU pools have no
L4/A10G). The validator keeps k8s.yaml declarative (instance_type
is an error) so the file class cannot drift back into per-cluster
registration dependencies.

Claude-Session: https://claude.ai/code/session_013BsS5dSk6s6xsLx2FbBy7g
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
@Aydin-ab
Aydin-ab requested a review from a team as a code owner August 8, 2026 01:22
A non-dict node (e.g. a bare string in worker_nodes) crashed the hook
with a traceback before collected errors printed — pydantic already
reports those, so skip them here. And required_resources: {} slipped
past the is-None guard while the SDK rejects it at deploy time; treat
empty as missing.

Claude-Session: https://claude.ai/code/session_013BsS5dSk6s6xsLx2FbBy7g
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Two authoring errors vs the declarative contract
(docs.anyscale.com/configuration/compute/declarative + product
compute_templates.py check_gpu_accelerator_consistency):
auto_select_worker_config is not compatible with declarative configs,
and the GPU type must ride in required_labels
(ray.io/accelerator-type) — the launch-time GPU validation never
reads required_resources.accelerator, so the previous form would
have been rejected at launch.

basic-single-node becomes an explicit single cpu_worker group, heads
slim to coordinator sizing (4CPU/8Gi, they are CPU: 0), the FSDP GPU
workers keep the AWS-proven g4dn.xlarge shape (4CPU/16Gi/1xT4). The
hook now enforces all three rules so the next k8s.yaml can't repeat
this.

Claude-Session: https://claude.ai/code/session_013BsS5dSk6s6xsLx2FbBy7g
Signed-off-by: Aydin Abiar <aydin@anyscale.com>
@@ -0,0 +1,12 @@
head_node:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we rename them to azure.yaml to match the convention of the other templates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants