Created
June 27, 2022 09:40
-
-
Save richardcase/23cb3b0b74c5c768de16895844aa8a9f to your computer and use it in GitHub Desktop.
Flintlock Node Client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var PROTO_PATH = [ | |
| '/home/richard/code/ww/flintlock/api/types/microvm.proto', | |
| '/home/richard/code/ww/flintlock/api/services/microvm/v1alpha1/microvms.proto' | |
| ]; | |
| var grpc = require('@grpc/grpc-js'); | |
| var protoLoader = require('@grpc/proto-loader'); | |
| var packageDefinition = protoLoader.loadSync( | |
| PROTO_PATH, | |
| {keepCase: true, | |
| longs: String, | |
| enums: String, | |
| defaults: true, | |
| oneofs: true | |
| }); | |
| var protoDescriptor = grpc.loadPackageDefinition(packageDefinition); | |
| var mvm = protoDescriptor.microvm; | |
| var client = new mvm.services.api.v1alpha1.MicroVM('localhost:9090', grpc.credentials.createInsecure()) | |
| var crearteReq = { | |
| id: "test1", | |
| namespace: "default", | |
| vcpu: 2, | |
| memory_in_mb: 2048, | |
| kernel: { | |
| image: "ghcr.io/weaveworks-liquidmetal/flintlock-kernel:5.10.77", | |
| addNetworkConfig: "true", | |
| filename: "boot/vmlinux" | |
| }, | |
| root_volume: { | |
| id: "root", | |
| is_read_only: "false", | |
| //mount_point: "/", | |
| source: { | |
| container_source: "ghcr.io/weaveworks-liquidmetal/capmvm-kubernetes:1.23.5" | |
| } | |
| }, | |
| interfaces: [ | |
| { | |
| device_id: "eth1", | |
| type: 0 | |
| } | |
| ] | |
| } | |
| client.CreateMicroVM({microvm: crearteReq}, (error, res) => { | |
| console.log(error) | |
| console.log(res) | |
| }) | |
| console.log(mvm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment