Skip to content
Neutree Documentation

Adjusting the HAMi scheduling policy through config_patch

Adjusting the HAMi scheduling policy through config_patch

Section titled “Adjusting the HAMi scheduling policy through config_patch”

When creating or updating a Kubernetes cluster, you can add HAMi configuration in spec.accelerator_virtualization.config_patch through YAML or API. Neutree supports configuring only devicePlugin, scheduler, and global in config_patch.

Configuration example

apiVersion: v1
kind: Cluster
metadata:
name: <cluster-name>
workspace: <workspace-name>
spec:
type: kubernetes
version: "v1.1.0"
image_registry: <image-registry>
accelerator_virtualization:
enabled: true
config_patch:
scheduler:
defaultSchedulerPolicy:
nodeSchedulerPolicy: binpack
gpuSchedulerPolicy: topology-aware
config:
kubernetes_config:
kubeconfig: <kubeconfig>

Operation example

To update an existing cluster, refer to the following example.

  1. First, export the existing cluster configuration by using the CLI, and then add accelerator_virtualization.config_patch to the exported YAML:

    Terminal window
    neutree-cli-<arch> get Cluster <cluster-name> \
    -w <workspace-name> \
    -o yaml \
    --api-key <api_key> \
    --server-url <server_url> \
    > hami-scheduler-policy.yaml
  2. Edit hami-scheduler-policy.yaml and add or adjust the following fields:

    spec:
    accelerator_virtualization:
    enabled: true
    config_patch:
    scheduler:
    defaultSchedulerPolicy:
    nodeSchedulerPolicy: binpack
    gpuSchedulerPolicy: topology-aware
  3. Save the file and run:

    Terminal window
    neutree-cli-<arch> apply -f hami-scheduler-policy.yaml \
    --api-key <api_key> \
    --server-url <server_url>
  4. View the updated cluster configuration:

    Terminal window
    neutree-cli-<arch> get Cluster <cluster-name> \
    -w <workspace-name> \
    -o yaml \
    --api-key <api_key> \
    --server-url <server_url>