tools

package
v1.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2018 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Code generated by go-bindata. DO NOT EDIT. sources: deploy/data/virtlet-ds.yaml

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

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

func AssetDir(name string) ([]string, error)

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

func AssetInfo(name string) (os.FileInfo, error)

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 AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

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 LoadYaml

func LoadYaml(data []byte) ([]runtime.Object, error)

LoadYaml loads a k8s YAML data and returns a slice of k8s objects

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func NewDiagCommand added in v1.1.2

func NewDiagCommand(client KubeClient, in io.Reader, out io.Writer) *cobra.Command

NewDiagCommand returns a new cobra.Command that handles Virtlet diagnostics.

func NewDiagDumpCommand added in v1.1.2

func NewDiagDumpCommand(client KubeClient, out io.Writer) *cobra.Command

NewDiagDumpCommand returns a new cobra.Command that dumps diagnostic information

func NewDiagSonobuoyCommand added in v1.1.2

func NewDiagSonobuoyCommand(in io.Reader, out io.Writer) *cobra.Command

NewDiagSonobuoyCommand returns a new cobra.Command that adds Virtlet plugin to sonobuoy-generated yaml

func NewDiagUnpackCommand added in v1.1.2

func NewDiagUnpackCommand(in io.Reader) *cobra.Command

NewDiagUnpackCommand returns a new cobra.Command that unpacks diagnostic information

func NewGenCmd

func NewGenCmd(out io.Writer) *cobra.Command

NewGenCmd returns a cobra.Command that generates Kubernetes YAML for Virtlet deployment.

func NewGenDocCmd

func NewGenDocCmd(rootCmd *cobra.Command, out io.Writer) *cobra.Command

NewGenDocCmd returns a cobra.Command that generates markdown documentation for virtletctl commands.

func NewInstallCmd

func NewInstallCmd(rootCmd *cobra.Command, executablePath, homeDir string) *cobra.Command

NewInstallCmd returns a cobra.Command that installs virtletctl as a kubectl plugin.

func NewSSHCmd

func NewSSHCmd(client KubeClient, out io.Writer, sshExecutable string) *cobra.Command

NewSSHCmd returns a cobra.Command that performs ssh into a VM pod.

func NewVNCCmd

func NewVNCCmd(client KubeClient, output io.Writer, waitForInterrupt bool) *cobra.Command

NewVNCCmd returns a cobra.Command that provides access to the VNC console of a VM pod.

func NewVersionCommand added in v1.0.1

func NewVersionCommand(client KubeClient, out io.Writer, info *version.Info) *cobra.Command

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

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func SetLocalPluginFlags

func SetLocalPluginFlags(cmd *cobra.Command) error

SetLocalPluginFlags sets command flags from kubectl plugin environment variables in case if virtletctl is running as a kubectl plugin.

func ToYaml

func ToYaml(objs []runtime.Object) ([]byte, error)

ToYaml converts a slice of k8s objects to YAML

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)
	// Retrieves the logs for the specified pod. If tailLines is
	// non-zero, it limits the numer of lines to be retrieved.
	PodLogs(podName, containerName, namespace string, tailLines int64) ([]byte, 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.

func (*RealKubeClient) PodLogs added in v1.1.2

func (c *RealKubeClient) PodLogs(podName, containerName, namespace string, tailLines int64) ([]byte, error)

PodLogs retrieves the logs of the specified container in the pod. limitBytes of zero specifies no size limit for the logs. limitSeconds of zero specifies no time limit for the logs.

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

func (podInfo VMPodInfo) LibvirtDomainName() string

LibvirtDomainName returns the name of the libvirt domain for the VMPodInfo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL