An example Python implementation of a kubernetes client that interacts with the CoreWeave VirtualServer resource as well as the kubevirt subresource api.
In this example, Python is used to perform the following actions via the Kubernetes REST API using Bash:
Remove an existing Virtual Server.
Create of a new Virtual Server based on the my_virtualserver example configuration
Wait for a Virtual Server Ready status.
Stop the Virtual Server instance and wait until it is stopped.
Delete the Virtual Server instance.
In order to work around an unresolved issue with resource paths in the native Python client for kubevirt, we introduced the class KubeVirtClient for basic operations on kubevirt VirtualMachine resources.
The vsclient provides an interface in the form of helper functions to interact with the Virtual Server resource, while the kubevirtclient provides an interface to interact with the kubevirt subresource API in order to stop and start a Virtual Server.
Both clients can be edited and used as drop-in clients for a simple Virtual Server controller built in Python.