JavaScript SDK for KubeVirt API - A comprehensive client library for interacting with KubeVirt API
npm install kubevirt-js-sdkA comprehensive JavaScript SDK for interacting with the KubeVirt API. This library provides a simple and intuitive interface for managing virtual machines and related resources in a Kubernetes cluster.
- Full support for KubeVirt API operations
- TypeScript support with type definitions
- Modern ES6+ JavaScript
- Promise-based API
- Comprehensive documentation
- Built-in error handling
- Support for all KubeVirt resources:
- Virtual Machines
- Virtual Machine Instances
- Virtual Machine Instance Migrations
- Virtual Machine Instance Presets
- Virtual Machine Instance ReplicaSets
``bash`
npm install kubevirt-js-sdk
`javascript
import { KubeVirtClient } from 'kubevirt-js-sdk';
// Create a new client
const client = new KubeVirtClient({
baseURL: 'https://your-kubevirt-api-server',
headers: {
'Authorization': 'Bearer your-token'
}
});
// List all virtual machines
const vms = await client.virtualMachine.listAllNamespaces();
// Create a new virtual machine
const newVM = await client.virtualMachine.create('default', {
apiVersion: 'kubevirt.io/v1',
kind: 'VirtualMachine',
metadata: {
name: 'test-vm'
},
spec: {
// VM specification
}
});
// Start a virtual machine
await client.virtualMachine.start('default', 'test-vm');
`
For detailed API documentation, please refer to the API Reference.
- Node.js >= 14.0.0
- npm >= 6.0.0
1. Clone the repository
2. Install dependencies:
`bash`
npm install
`bash`
npm run build
`bash`
npm test
`bash`
npm run lint
This package is automatically published to npm using GitHub Actions:
- Pushes to the main branch are published with the latest tagv1.0.0
- Tagged releases (e.g., ) are published with the corresponding version tag
To create a new release:
1. Update the version in package.json`
2. Create a new tag:
bash``
git tag v1.0.0
git push origin v1.0.0
The GitHub Actions workflow will automatically publish the package to npm.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions, please open an issue in the GitHub repository.