Skip to content

test(evals): add update-vm-instancetype eval task#814

Open
lyarwood wants to merge 1 commit intocontainers:mainfrom
lyarwood:kubevirt-instancetype-double-eval
Open

test(evals): add update-vm-instancetype eval task#814
lyarwood wants to merge 1 commit intocontainers:mainfrom
lyarwood:kubevirt-instancetype-double-eval

Conversation

@lyarwood
Copy link
Contributor

/cc @ksimon1
/cc @codingben
/cc @Ruclo

Add a new kubevirt eval that tests doubling VM memory by changing instance types. Includes a verify_instancetype_changed helper function.

$ mcpchecker view mcpchecker-kubevirt-basic-operations-out.json
Task: update-vm-instancetype
  Path: /home/lyarwood/redhat/devel/src/k8s/kubernetes-mcp-server/evals/tasks/kubevirt/update-vm-instancetype/task.yaml
  Difficulty: hard
  Status: PASSED
  Prompt: A Fedora VirtualMachine named fedora-vm exists in the vm-test namespace using the u1.small instancetype. Double its memory by updating the instance type.                              Assertions: 3/3 passed
  Call history: tools=4 (kubernetes:4 ok)
    Tool output:
      • kubernetes::resources_get (ok)
        apiVersion: kubevirt.io/v1
        kind: VirtualMachine
        metadata:
          annotations:
            kubevirt.io/latest-observed-api-version: v1
            kubevirt.io/storage-observed-api-version: v1
        … (+52 lines)
      • kubernetes::resources_get (ok)
        apiVersion: instancetype.kubevirt.io/v1beta1
        kind: VirtualMachineClusterInstancetype
        metadata:
          annotations:
            instancetype.kubevirt.io/description: |-
              The U Series is quite neutral and provides resources for
        … (+33 lines)
      • kubernetes::resources_list (ok)
        APIVERSION                         KIND                                NAME             AGE   LABELS
        instancetype.kubevirt.io/v1beta1 VirtualMachineClusterInstancetype cx1.2xlarge 22m
        app.kubernetes.io/component=kubevirt,app.kubernetes.io/managed-by=virt-operator,instancetype.kubevirt.io/class=compute.exclusive,instancetype.kubevirt.io/common-instancetypes-version=v1.5.1,instancetype.kubevirt.io/cpu=8,instancetype.kubevirt.io/dedicatedCPUPlacement=true,instancetype.kubevirt.io/hugepages=2Mi,instancetype.kubevirt.io/icon-pf=pficon-registry,instancetype.kubevirt.io/isolateEmulatorThread=true,instancetype.kubevirt.io/memory=16Gi,instancetype.kubevirt.io/numa=true,instancetype.kubevirt.io/size=2xlarge,instancetype.kubevirt.io/vendor=kubevirt.io,instancetype.kubevirt.io/version=1
        instancetype.kubevirt.io/v1beta1 VirtualMachineClusterInstancetype cx1.2xlarge1gi 22m
        app.kubernetes.io/component=kubevirt,app.kubernetes.io/managed-by=virt-operator,instancetype.kubevirt.io/class=compute.exclusive,instancetype.kubevirt.io/common-instancetypes-version=v1.5.1,instancetype.kubevirt.io/cpu=8,instancetype.kubevirt.io/dedicatedCPUPlacement=true,instancetype.kubevirt.io/hugepages=1Gi,instancetype.kubevirt.io/icon-pf=pficon-registry,instancetype.kubevirt.io/isolateEmulatorThread=true,instancetype.kubevirt.io/memory=16Gi,instancetype.kubevirt.io/numa=true,instancetype.kubevirt.io/size=2xlarge1gi,instancetype.kubevirt.io/vendor=kubevirt.io,instancetype.kubevirt.io/version=1
        instancetype.kubevirt.io/v1beta1 VirtualMachineClusterInstancetype cx1.4xlarge 22m
        … (+105 lines)
      • kubernetes::resources_create_or_update (ok)
        # The following resources (YAML) have been created or updated successfully
        - apiVersion: kubevirt.io/v1
          kind: VirtualMachine
          metadata:
            annotations:
              kubevirt.io/latest-observed-api-version: v1
        … (+135 lines)
  Timeline:
    - note: Done. The `fedora-vm` VirtualMachine has been updated from `u1.small` to `u1.medium`, doubling its
      memory:
    - note: | | Instance Type | CPU | Memory | |---|---|---|---| | Before | `u1.small` | 1 | 2Gi | | After |
      `u1.medium` | 1 | 4Gi |
    - note: The VM is currently stopped (`runStrategy: Halted`), so the new instance type will take effect on
      the next start.

Copy link
Collaborator

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for adding more evals @lyarwood !

Comment on lines +54 to +74
kubectl get virtualmachine "$VM_NAME" -n "$NS" > /dev/null
echo "VirtualMachine $VM_NAME exists"

# Verify VM uses the expected u1.medium instancetype
INSTANCETYPE=$(kubectl get virtualmachine "$VM_NAME" -n "$NS" -o jsonpath='{.spec.instancetype.name}')
if [ "$INSTANCETYPE" != "u1.medium" ]; then
echo "ERROR: Expected instancetype 'u1.medium', found: '$INSTANCETYPE'"
exit 1
fi
echo "Instancetype is u1.medium"

# Verify no direct resource specification
GUEST_MEMORY=$(kubectl get virtualmachine "$VM_NAME" -n "$NS" -o jsonpath='{.spec.template.spec.domain.memory.guest}')
if [ -n "$GUEST_MEMORY" ]; then
echo "WARNING: VirtualMachine has direct memory specification: $GUEST_MEMORY"
else
echo "VirtualMachine uses instancetype for resources (no direct memory spec)"
fi

echo "All validations passed"
exit 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

@lyarwood do you think it would be feasible/better in your case to extract some of this bash logic into go code in https://github.com/mcpchecker/kubernetes-extension so that it can be reused elsewhere?

I'm not really an expert on your eval scenarios, so not sure if it would be better or not long term...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, likely into a kubevirt specific extension. Definitely something I'd like to look into in the near future.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That would be nice, having those extensions for kubevirt @lyarwood

@lyarwood
Copy link
Contributor Author

/run-mcpchecker kubevirt

@lyarwood
Copy link
Contributor Author

/run-mcpchecker kubevirt

https://github.com/containers/kubernetes-mcp-server/actions/runs/22416757076/job/64904289157

User lyarwood does not have permission to trigger evaluations

Ah and automatically running them against the PR also doesn't seem to work?

https://github.com/containers/kubernetes-mcp-server/actions/runs/22416184942/job/64902337108?pr=814

Error: eval failed: failed to load agent spec: failed to get defaults for builtin type 'openai-agent': environment variables MODEL_BASE_URL and MODEL_KEY must be set

@Cali0707
Copy link
Collaborator

@lyarwood i think you need write access to the repo for the action to run. Maybe @manusa can help with this? Also, probably worth looking into how we want to manage this in general for the different toolsets (IMO you are maintaining the toolset, not @manusa @matzew @nader-ziada or myself)

@Ruclo
Copy link
Contributor

Ruclo commented Feb 26, 2026

@lyarwood looks good. is the helper function for future use ? as don't see it used in the task itself.

@lyarwood
Copy link
Contributor Author

@lyarwood looks good. is the helper function for future use ? as don't see it used in the task itself.

Nope good catch forgot to remove it, I'll do that now.

Add a new kubevirt eval that tests doubling VM memory by changing
instance types. Includes a verify_instancetype_changed helper function.

Assisted-By: Claude <[email protected]>
Signed-off-by: Lee Yarwood <[email protected]>
@lyarwood lyarwood force-pushed the kubevirt-instancetype-double-eval branch from 4e3b3b8 to ed48943 Compare February 26, 2026 11:08
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.

4 participants