Documentation
¶
Overview ¶
Code generated by go-bindata. DO NOT EDIT. sources: deploy/data/virtlet-ds.yaml
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func BindFlags(flags *pflag.FlagSet) clientcmd.ClientConfig
- func InPlugin() bool
- func LoadYaml(data []byte) ([]runtime.Object, error)
- func MustAsset(name string) []byte
- func NewDumpMetadataCmd(client KubeClient) *cobra.Command
- func NewGenCmd(out io.Writer) *cobra.Command
- func NewGenDocCmd(rootCmd *cobra.Command) *cobra.Command
- func NewInstallCmd(rootCmd *cobra.Command, executablePath, homeDir string) *cobra.Command
- func NewSSHCmd(client KubeClient, out io.Writer, sshExecutable string) *cobra.Command
- func NewVNCCmd(client KubeClient, output io.Writer, waitForInterrupt bool) *cobra.Command
- func NewVersionCommand(client KubeClient, out io.Writer, info *version.Info) *cobra.Command
- func NewVirshCmd(client KubeClient, out io.Writer) *cobra.Command
- func ParsePortForwardOutput(out string, ports []*ForwardedPort) error
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func SetLocalPluginFlags(cmd *cobra.Command) error
- func ToYaml(objs []runtime.Object) ([]byte, error)
- type ForwardedPort
- type KubeClient
- type Plugin
- type PluginFlag
- type RealKubeClient
- func (c *RealKubeClient) ExecInContainer(podName, containerName, namespace string, stdin io.Reader, ...) (int, error)
- func (c *RealKubeClient) ForwardPorts(podName, namespace string, ports []*ForwardedPort) (stopCh chan struct{}, err error)
- func (c *RealKubeClient) GetVMPodInfo(podName string) (*VMPodInfo, error)
- func (c *RealKubeClient) GetVirtletPodAndNodeNames() (podNames []string, nodeNames []string, err error)
- func (c *RealKubeClient) GetVirtletPodNameForNode(nodeName string) (string, error)
- type VMPodInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func BindFlags ¶
func BindFlags(flags *pflag.FlagSet) clientcmd.ClientConfig
BindFlags applies go flags to the specified FlagSet and sets global flag values from kubectl plugin environment variables in case if virtletctl is running as a kubectl plugin.
func InPlugin ¶
func InPlugin() bool
InPlugin returns true if virtletctl is running as a kubectl plugin.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NewDumpMetadataCmd ¶
func NewDumpMetadataCmd(client KubeClient) *cobra.Command
NewDumpMetadataCmd returns a cobra.Command that dumps Virtlet metadata
func NewGenCmd ¶
NewGenCmd returns a cobra.Command that generates Kubernetes YAML for Virtlet deployment.
func NewGenDocCmd ¶
NewGenDocCmd returns a cobra.Command that generates markdown documentation for virtletctl commands.
func NewInstallCmd ¶
NewInstallCmd returns a cobra.Command that installs virtletctl as a kubectl plugin.
func NewVNCCmd ¶
NewVNCCmd returns a cobra.Command that provides access to the VNC console of a VM pod.
func NewVersionCommand ¶ added in v1.0.1
NewVersionCommand returns a cobra.Command that prints Virtlet version info
func NewVirshCmd ¶
func NewVirshCmd(client KubeClient, out io.Writer) *cobra.Command
NewVirshCmd returns a cobra.Command that executes virsh for a VM pod.
func ParsePortForwardOutput ¶
func ParsePortForwardOutput(out string, ports []*ForwardedPort) error
ParsePortForwardOutput extracts from returned by api "out" data information about local ports in each of ForwardedPort
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func SetLocalPluginFlags ¶
SetLocalPluginFlags sets command flags from kubectl plugin environment variables in case if virtletctl is running as a kubectl plugin.
Types ¶
type ForwardedPort ¶
type ForwardedPort struct {
// LocalPort specifies the local port to use. 0 means selecting
// a random local port.
LocalPort uint16
// RemotePort specifies the remote (pod-side) port to use.
RemotePort uint16
}
ForwardedPort specifies an entry for the PortForward request
func (ForwardedPort) String ¶
func (fp ForwardedPort) String() string
type KubeClient ¶
type KubeClient interface {
// GetVirtletPodAndNodeNames returns a list of names of the
// virtlet pods present in the cluster and a list of
// corresponding node names that contain these pods.
GetVirtletPodAndNodeNames() (podNames []string, nodeNames []string, err error)
// GetVirtletPodNameForNode returns a name of the virtlet pod on
// the specified k8s node.
GetVirtletPodNameForNode(nodeName string) (string, error)
// GetVMPodInfo returns then name of the virtlet pod and the vm container name for
// the specified VM pod.
GetVMPodInfo(podName string) (*VMPodInfo, error)
// ExecInContainer given a pod, a container, a namespace and a command
// executes that command inside the pod's container returning stdout and stderr output
// as strings and an error if it has occurred.
// The specified stdin, stdout and stderr are used as the
// standard input / output / error streams of the remote command.
// No TTY is allocated by this function stdin.
ExecInContainer(podName, containerName, namespace string, stdin io.Reader, stdout, stderr io.Writer, command []string) (int, error)
// ForwardPorts starts forwarding the specified ports to the specified pod in background.
// If a port entry has LocalPort = 0, it's updated with the real port number that was
// selected by the forwarder.
// The function returns when the ports are ready for use or if/when an error occurs.
// Close stopCh to stop the port forwarder.
ForwardPorts(podName, namespace string, ports []*ForwardedPort) (stopCh chan struct{}, err error)
}
KubeClient contains methods for interfacing with Kubernetes clusters.
type Plugin ¶
type Plugin struct {
// Name is the name of the plugin.
Name string `json:"name"`
// ShortDesc is the short description of the plugin.
ShortDesc string `json:"shortDesc"`
// LongDesc is the detailed description of the plugin.
LongDesc string `json:"longDesc,omitempty"`
// Example is an example of plugin usage.
Example string `json:"example,omitempty"`
// Command is the command that needs to be run by kubectl
// to execute the plugin.
Command string `json:"command,omitempty"`
// Flags describes the flags for this plugin.
Flags []PluginFlag `json:"flags,omitempty"`
// Tree lists the subcommands of this plugin.
Tree []*Plugin `json:"tree,omitempty"`
}
Plugin holds everything needed to register a plugin as a command. Usually comes from a descriptor file.
type PluginFlag ¶
type PluginFlag struct {
// Name is the name of the flag
Name string `json:"name"`
// Shorthand is the shorthand for the flag, e.g. -o
Shorthand string `json:"shorthand,omitempty"`
// Desc is the description of the flag
Desc string `json:"desc"`
// DefValue is the default value of the flag.
DefValue string `json:"defValue,omitempty"`
}
PluginFlag describes a single flag supported by a given plugin.
type RealKubeClient ¶
type RealKubeClient struct {
// contains filtered or unexported fields
}
RealKubeClient is used to access a Kubernetes cluster.
func NewRealKubeClient ¶
func NewRealKubeClient(clientCfg clientcmd.ClientConfig) *RealKubeClient
NewRealKubeClient creates a RealKubeClient for the specified ClientConfig.
func (*RealKubeClient) ExecInContainer ¶
func (c *RealKubeClient) ExecInContainer(podName, containerName, namespace string, stdin io.Reader, stdout, stderr io.Writer, command []string) (int, error)
ExecInContainer implements ExecInContainer method of KubeClient interface
func (*RealKubeClient) ForwardPorts ¶
func (c *RealKubeClient) ForwardPorts(podName, namespace string, ports []*ForwardedPort) (stopCh chan struct{}, err error)
ForwardPorts implements ForwardPorts method of KubeClient interface.
func (*RealKubeClient) GetVMPodInfo ¶
func (c *RealKubeClient) GetVMPodInfo(podName string) (*VMPodInfo, error)
GetVMPodInfo implements GetVMPodInfo method of KubeClient interface.
func (*RealKubeClient) GetVirtletPodAndNodeNames ¶
func (c *RealKubeClient) GetVirtletPodAndNodeNames() (podNames []string, nodeNames []string, err error)
GetVirtletPodAndNodeNames implements GetVirtletPodAndNodeNames method of KubeClient interface.
func (*RealKubeClient) GetVirtletPodNameForNode ¶
func (c *RealKubeClient) GetVirtletPodNameForNode(nodeName string) (string, error)
GetVirtletPodNameForNode implements GetVirtletPodNameForNode method of KubeClient interface.
type VMPodInfo ¶
type VMPodInfo struct {
// NodeName is the name of the node where the VM pod runs
NodeName string
// VirtletPodName is the name of the virtlet pod that manages this VM pod
VirtletPodName string
// ContainerID is the id of the container in the VM pod
ContainerID string
// ContainerName is the name of the container in the VM pod
ContainerName string
}
VMPodInfo describes a VM pod in a way that's necessary for virtletctl to handle it
func (VMPodInfo) LibvirtDomainName ¶
LibvirtDomainName returns the name of the libvirt domain for the VMPodInfo.