* Add Virtual Kubelet provider for VIC Initial virtual kubelet provider for VMware VIC. This provider currently handles creating and starting of a pod VM via the VIC portlayer and persona server. Image store handling via the VIC persona server. This provider currently requires the feature/wolfpack branch of VIC. * Added pod stop and delete. Also added node capacity. Added the ability to stop and delete pod VMs via VIC. Also retrieve node capacity information from the VCH. * Cleanup and readme file Some file clean up and added a Readme.md markdown file for the VIC provider. * Cleaned up errors, added function comments, moved operation code 1. Cleaned up error handling. Set standard for creating errors. 2. Added method prototype comments for all interface functions. 3. Moved PodCreator, PodStarter, PodStopper, and PodDeleter to a new folder. * Add mocking code and unit tests for podcache, podcreator, and podstarter Used the unit test framework used in VIC to handle assertions in the provider's unit test. Mocking code generated using OSS project mockery, which is compatible with the testify assertion framework. * Vendored packages for the VIC provider Requires feature/wolfpack branch of VIC and a few specific commit sha of projects used within VIC. * Implementation of POD Stopper and Deleter unit tests (#4) * Updated files for initial PR
toolbox - VMware guest tools library for Go
Overview
The toolbox library is a lightweight, extensible framework for implementing VMware guest tools functionality. The primary focus of the library is the implementation of VM guest RPC protocols, transport and dispatch. These protocols are undocumented for the most part, but open-vm-tools serves as a reference implementation. The toolbox provides default implementations of the supported RPCs, which can be overridden and/or extended by consumers.
Supported features
Feature list from the perspective of vSphere public API interaction. The properties, objects and methods listed are relative to the VirtualMachine managed object type.
guest.toolsVersionStatus property
The toolbox reports version as guestToolsUnmanaged.
guest.toolsRunningStatus and guest.guestState properties
The VMX determines these values based on the toolbox's response to the ping RPC.
guest.ipAddress property
The VMX requests this value via the Set_Option broadcastIP RPC.
The default value can be overridden by setting the Service.PrimaryIP function.
See vim.vm.GuestInfo
guest.net property
This data is pushed to the VMX using the SendGuestInfo(INFO_IPADDRESS_V3) RPC.
See GuestNicInfo.
ShutdownGuest and RebootGuest methods
The PowerCommandHandler provides power hooks for customized guest shutdown and reboot.
GuestAuthManager object
Not supported, but authentication can be customized.
GuestFileManager object
| Method | Supported | Client Examples |
|---|---|---|
| ChangeFileAttributesInGuest | Yes | chmod |
| chown | ||
| touch | ||
| CreateTemporaryDirectoryInGuest | Yes | mktemp |
| CreateTemporaryFileInGuest | Yes | mktemp |
| DeleteDirectoryInGuest | Yes | rmdir |
| DeleteFileInGuest | Yes | rm |
| InitiateFileTransferFromGuest | Yes | download |
| InitiateFileTransferToGuest | Yes | upload |
| ListFilesInGuest | Yes | ls |
| MakeDirectoryInGuest | Yes | mkdir |
| MoveDirectoryInGuest | Yes | mv |
| MoveFileInGuest | Yes | mv |
GuestProcessManager
Currently, the ListProcessesInGuest and TerminateProcessInGuest methods only apply those processes and goroutines
started by StartProgramInGuest.
| Method | Supported | Client Examples |
|---|---|---|
| ListProcessesInGuest | Yes | ps |
| ReadEnvironmentVariableInGuest | Yes | getenv |
| StartProgramInGuest | Yes | start |
| TerminateProcessInGuest | Yes | kill |
See vim.vm.guest.ProcessManager
Extensions
Authentication
Guest operations can be authenticated using the toolbox.CommandServer.Authenticate hook.
Go functions
The toolbox ProcessManager can manage both OS processes and Go functions running as go routines.
File handlers
The hgfs.FileHandler interface can be used to customize file transfer.
Process I/O
The toolbox provides support for I/O redirection without the use of disk files within the guest.
Access to stdin, stdout and stderr streams is implemented as an hgfs.FileHandler within the ProcessManager.
See toolbox.Client and govc guest.run
http.RoundTripper
Building on top of the process I/O functionality, toolbox.NewProcessRoundTrip can be used to start a Go function to
implement the http.RoundTripper interface over vmx guest RPC. This
makes it possible to use the Go http.Client without network access to the VM
or to a port that is bound to the guest's loopback address. It is intended for use with bootstrap configuration for
example.
Directory archives
The toolbox provides support for transferring directories to and from guests as gzip'd tar streams, without writing the
tar file itself to the guest file system. Archive supports is implemented as an hgfs.FileHandler within the hgfs
package. See hgfs.NewArchiveHandler
Linux /proc file access
With standard vmware-tools, the file size is reported as returned by stat() and hence a Content-Length header of
size 0. The toolbox reports /proc file size as hgfs.LargePacketMax to enable transfer of these files. Note that if
the file data fits within in hgfs.LargePacketMax, the Content-Length header will be correct as it is sent after the
first read by the vmx. However, if the file data exceeds hgfs.LargePacketMax, the Content-Length will be
hgfs.LargePacketMax, and client side will truncate to that size.
Testing
The Go tests cover most of the toolbox code and can be run on any Linux or MacOSX machine, virtual or otherwise.
To test the toolbox with vSphere API interaction, it must be run inside a VM managed by vSphere without the standard vmtoolsd running.
The toolbox-test.sh can be used to run the full suite of toolbox tests with vSphere API interaction.
Use the -s flag to start the standalone version of the toolbox and leave it running, to test vSphere interaction
without running the test suite.
Consumers of the toolbox library
Supported guests
The toolbox guest RPC implementations tend to be simple and portable thanks to the Go standard library, but are only supported on Linux currently. Support for other guests, such as Windows, has been kept in mind but not yet tested.
Supported vSphere Versions
The toolbox is supported with vSphere 6.0 and 6.5, but may function with older versions.