* 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
2.3 KiB
Container VM output logging in VIC
When a container VM process produces output, that output is sent down through a serial connection into the vSphere backend where it is written to a logfile. When a user wants to see this output, they use the docker logs command, which reads from this logfile and displays the log entries on the command line in order from oldest to newest.
However, in order for users to be able to use the --since option with docker logs, we must also couple timestamps to these log entries so that the user can selectively filter log messages to be displayed based on when those entries occurred.
Requirements
The container VM logging mechanism must:
- Create a header for each log entry containing both the size of that entry, the time at which that entry occurred, and the stream from which that entry originated (stdout, stderr).
- Allow these entries to be read and at a later time, starting with the first entry occurring at or beyond the timestamp supplied by the user with the
--sinceoption todocker logs, or starting with the first entry in the logfile if--sincewas not used.
Implementation
A package for containerVM logging in VIC is added as github.com/vmware/vic/lib/iolog. In this package are two files, log_writer.go and log_reader.go. These files contain an implementation of Go's io.Writer and io.ReadCloser interfaces, respectively.
The responsibilities of the LogWriter are:
- To create a header for the entry, containing the timestamp at which the entry occurred, the size of the entry, and the stream that produced the entry.
- To write these bytes to the serial port associated with the containerVM logfile on the backend.
- To flush the remaining bytes in the supplied buffer upon
Close()
The responsibilities of the LogReader are:
- To read in a header and decode it into the timestamp, size and stream of the entry.
- To then read the following
sizebytes that contain the actual message. - To copy the message bytes into the underlying
Readstream's[]byteslice. - To preserve unwritten bytes in a call to
Readin memory so that they may be written during the next call, in the case where the supplied[]byteslice was smaller than the log message we are trying to write.