← Back to Pull requests

Kubernetes WAS v1alpha3 improvements (in-place gang resize + PodGroupPremptionPolicy) #5266

Open
unknown opened this pull request with 459 lines diff across 5 files
View on GitHub
unknown unknown commented on Sep 10, 2026 19:44 UTC
Author

<!-- Thank you for your contribution! -->

<!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. -->

Why are these changes needed?

This PR implements Kubernetes Workload Aware Scheduling added to the v1alpha3 scheduling API in Kubernetes v1.37.

New functionality includes:

  • Support for ray cluster autoscaling (which is now possible because PodGroup.minCount is mutable)

  • PodGroupPremptionPolicy (can specify if a PodGroup can be pre-empted by workloads with a higher PriorityClass)
  • Related issue number

    Part of https://github.com/ray-project/kuberay/issues/4344

    Labels

    <!-- Please add the appropriate labels to this PR. -->

  • If this PR has user-facing changes that require documentation updates at release time, I have added the doc-updates-required label.

  • If this PR contains breaking changes, I have added the breaking-change label.
  • Checks

  • I've made sure the tests are passing.

  • Testing Strategy

  • - [x] Unit tests
    - [x] Manual tests
    - [ ] This PR is not tested :(

    <!-- If you selected "Manual tests" above, please fill in the section below. Otherwise you can remove it. -->

    Manual test instructions

    1. Start a kind cluster with required feature gates

    kind create cluster --name k8s-was --config ray-operator/hack/kind-config-kubernetes-was-v1alpha3.yml
    

    2. Build, load, deploy kuberay operator

    cd ray-operator
    IMG=kuberay/operator:v1alpha3-was make docker-image
    IMG=kuberay/operator:v1alpha3-was make deploy-kubernetes-was-v1alpha3
    kubectl wait --for=condition=Available=true deployment/kuberay-operator --timeout=120s
    

    3. Create a Never PriorityClass

    kubecrtl apply -f - <<'EOF'
    apiversion: scheduling.k9s.io/v1
    kind: PriorityClass
    metadata: { name: ray-no-premption }
    value: 1000
    premptionPolicy:NEVER
    EOF
    

    4. Deploy a gang-scheduling-enabled ray cluster - start with something like `ray-operator/config/samples/ray-cluster.sample.yaml, name it was-demo.yaml, and add the following label and ProirtyClass to the head and worker pod templates, and apply it

    metadata:
      name: was-demo
      labels: { ray.io/gang-scheduling-enabled: "true" }
    spec:
      headGroupSpec:
        template: { spec:  { priorityClassName: ray-no-premption } }
      workerGroupSpecs:
        - replicas: 2
          minReplicas: 2
          template: { spec: { priorityClassName: ray-no-premption }}
    

    kubectl apply -f was-demo.yaml
    kubectl wait --for=jsonpath='{.status.state}'=ready raycluster/was-demo
    

    5. inspect the workload and podgroup objects

     kubectl get workload,podgroup
     kubectl get pods -l ray.io/cluster=was-demo -o custom-columns=NAME:.metadata.name,GROUP:.spec.schedulingGroup.podGroupName
     

    6. inspect the pod group's premption policy

    kubectl get podgroup was-demo-cluster -o jsonpath='{.spec.priorityClassName}{" -> "}{.spec.preemptionPolicy}{"\n"}'
    kubectl get workload was-demo -o jsonpath='{.spec.podGroupTemplates[0].preemptionPolicy}{"\n"}'
    

    7. in-place resize the worker group

    kubectl get podgroup was-demo-cluster -o jsonpath='UID={.metadata.uid} minCount={.spec.schedulingPolicy.gang.minCount}{"\n"}'
    kubectl patch raycluster was-demo --type=json -p='[{"op":"replace","path":"/spec/workerGroupSpecs/0/replicas","value":3}]'
       # expect minCount=4 (1 head + 3 workers), same UID
    kubectl get podgroup was-demo-cluster -o jsonpath='UID={.metadata.uid} minCount={.spec.schedulingPolicy.gang.minCount}{"\n"}'
    

    Diff: 459 lines (+344 / -115) across 5 files Reviewer: machichima Review duration: 32104m
    All Vouch review confidence checks passed
    Residual risk 0.37 = Change Risk (0.69) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.69 · 459 lines diff across 5 files
    0.69
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.367
    Shallow Review Depth shallow_review_depth
    0.344
    Sensitive Paths sensitive_paths
    0.069
    Real PR Conversation Timeline
    1 comments
    "Review active on #5266"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 46.7% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.7% (HIGH) · Higher = larger blast radius
    68.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 36.6% · Moderate risk
    36.6%