NodeJS
An example implementation in NodeJS of a kubernetes client to interact with a Virtual Server resource on CoreWeave Cloud.
Implementation
The example is broken down into two parts, the client, which is glue code layered on top of the godaddy implementation of a kubernetes-client, and the application; both of which are described below.
Client
The client (client.js
) provides an interface to create a Kubernetes client using your Kubernetes credentials (token). client.js
may be dropped into any application and used to interface with the Virtual Server resource.
A set of functions specific to creating, modifying, and checking the status of a Virtual Server are additionally provided, which operate as follows:
Function name | Description |
---|---|
| Initializes the client |
| Namespace in which the Virtual Server is deployed |
| Name of the Virtual Server |
| Starts a stopped Virtual Server |
| Stops a running Virtual Server |
| Retrieves a Virtual Server |
| Stopping function that waits for the |
| Deletes a Virtual Server |
| A Virtual Server manifest (JSON/Object) - See Examples |
| Lists all Virtual Servers |
| Creates a Virtual Server |
| Update an existing Virtual Server |
Application
The application (main.js
) implements client.js
in order to create, watch, get, and update an example Virtual Server.
The example application serves as an example of how to implement client.js
. Additionally, the example application illustrates how one might retrieve status information from a running Virtual Server, retrieving its run state and network information.
Finally, the example shows how to simply interface with the kubevirt __ subresource
API in order to start and stop a Virtual Server.
Example
Last updated