Documentation ¶
Index ¶
- func CleanupNetworks(r *Runtime, c *Cluster)
- func CleanupNodes(r *Runtime, nodes []*Node)
- func CleanupPods(r *Runtime, pods []*Pod)
- type Cluster
- func (c *Cluster) Append(other *Cluster) *Cluster
- func (c *Cluster) Cleanup(r *Runtime) error
- func (c *Cluster) GetDataFolder(name string) (*DataFolder, error)
- func (c *Cluster) GetImage(name string) (*Image, error)
- func (c *Cluster) GetNetwork(name string) (*Network, error)
- func (c *Cluster) GetNode(name string) (*Node, error)
- func (c *Cluster) GetPod(name string) (*Pod, error)
- func (c *Cluster) Resolve() error
- func (c *Cluster) Start(ctx context.Context, r *Runtime) error
- type DataFolder
- type DataFolderFileSpec
- type DataFolderSpec
- type Decompressor
- type Image
- type ImageSpec
- type Network
- type NetworkSpec
- type NetworkType
- type Node
- type NodeSpec
- type NodeVM
- func (n *NodeVM) IsRunning() bool
- func (n *NodeVM) ListSnapshots(ctx context.Context, node *Node) (string, error)
- func (n *NodeVM) LoadVM(ctx context.Context, node *Node, tag string) error
- func (n *NodeVM) PowerOff() error
- func (n *NodeVM) PowerOn() error
- func (n *NodeVM) ResumeVM(ctx context.Context) error
- func (n *NodeVM) SaveVM(ctx context.Context, node *Node, tag string) error
- type NodeVolume
- func NewImageVolume(name string, cache string, imageName string, cow bool) NodeVolume
- func NewLVVolume(name string, cache string, size, vg string) NodeVolume
- func NewLocalDSVolume(name, cache string, u, n string) NodeVolume
- func NewRawVolume(name string, cache string, size, format string) NodeVolume
- func NewVVFATVolume(name string, folderName string) NodeVolume
- type NodeVolumeSpec
- type Pod
- type PodAppMountSpec
- type PodAppSpec
- type PodInterfaceSpec
- type PodSpec
- type PodVolume
- type PodVolumeSpec
- type Runtime
- type SMBIOSConfig
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupNetworks ¶
CleanupNetworks removes all remaining network resources.
func CleanupNodes ¶
CleanupNodes cleans files created at runtime for QEMU.
func CleanupPods ¶ added in v1.1.0
CleanupPods cleans file created at runtime for rkt.
Types ¶
type Cluster ¶
type Cluster struct { Networks []*Network Images []*Image DataFolders []*DataFolder Nodes []*Node Pods []*Pod // contains filtered or unexported fields }
Cluster is a set of resources in a virtual data center.
func (*Cluster) GetDataFolder ¶
func (c *Cluster) GetDataFolder(name string) (*DataFolder, error)
GetDataFolder looks up the data folder by name. It returns non-nil error if the named folder is not found.
func (*Cluster) GetImage ¶
GetImage looks up the image by name. It returns non-nil error if the named image is not found.
func (*Cluster) GetNetwork ¶
GetNetwork looks up the network by name. It returns non-nil error if the named network is not found.
func (*Cluster) GetNode ¶
GetNode looks up the node by name. It returns non-nil error if the named node is not found.
func (*Cluster) GetPod ¶
GetPod looks up the pod by name. It returns non-nil error if the named pod is not found.
type DataFolder ¶
type DataFolder struct { *DataFolderSpec // contains filtered or unexported fields }
DataFolder represents a data folder configuration
func NewDataFolder ¶
func NewDataFolder(spec *DataFolderSpec) (*DataFolder, error)
NewDataFolder creates DataFolder from DataFolderSpec.
func (*DataFolder) Path ¶
func (d *DataFolder) Path() string
Path returns the filesystem path to the directory having folder contents.
type DataFolderFileSpec ¶
type DataFolderFileSpec struct { Name string `json:"name"` URL string `json:"url,omitempty"` File string `json:"file,omitempty"` }
DataFolderFileSpec represents a DataFolder's File definition in YAML
type DataFolderSpec ¶
type DataFolderSpec struct { Kind string `json:"kind"` Name string `json:"name"` Dir string `json:"dir,omitempty"` Files []DataFolderFileSpec `json:"files,omitempty"` }
DataFolderSpec represents a DataFolder definition in YAML
type Decompressor ¶
Decompressor defines an interface to decompress data from io.Reader.
func NewDecompressor ¶
func NewDecompressor(format string) (Decompressor, error)
NewDecompressor returns a Decompressor for "format". If format is not supported, this returns a non-nil error.
type Image ¶
type Image struct { *ImageSpec // contains filtered or unexported fields }
Image represents an image configuration
type ImageSpec ¶
type ImageSpec struct { Kind string `json:"kind"` Name string `json:"name"` URL string `json:"url,omitempty"` File string `json:"file,omitempty"` CompressionMethod string `json:"compression,omitempty"` }
ImageSpec represents an Image specification in YAML.
type Network ¶
type Network struct { *NetworkSpec // contains filtered or unexported fields }
Network represents a network configuration
func NewNetwork ¶
func NewNetwork(spec *NetworkSpec) (*Network, error)
NewNetwork creates *Network from spec.
func (*Network) CreateTap ¶
CreateTap add a tap device to the bridge and return the tap device name.
func (*Network) CreateVeth ¶
CreateVeth creates a veth pair and add one of the pair to the bridge. It returns both names of the pair.
type NetworkSpec ¶
type NetworkSpec struct { Kind string `json:"kind"` Name string `json:"name"` Type string `json:"type"` UseNAT bool `json:"use-nat"` Address string `json:"address,omitempty"` }
NetworkSpec represents a Network specification in YAML
type NetworkType ¶
type NetworkType int
NetworkType represents a network type.
const ( NetworkInternal NetworkType = iota NetworkExternal NetworkBMC )
Network types.
type Node ¶
type Node struct { *NodeSpec // contains filtered or unexported fields }
Node represents a virtual machine.
type NodeSpec ¶
type NodeSpec struct { Kind string `json:"kind"` Name string `json:"name"` Interfaces []string `json:"interfaces,omitempty"` Volumes []NodeVolumeSpec `json:"volumes,omitempty"` IgnitionFile string `json:"ignition,omitempty"` CPU int `json:"cpu,omitempty"` Memory string `json:"memory,omitempty"` UEFI bool `json:"uefi,omitempty"` TPM bool `json:"tpm,omitempty"` SMBIOS SMBIOSConfig `json:"smbios,omitempty"` }
NodeSpec represents a Node specification in YAML
type NodeVM ¶
type NodeVM struct {
// contains filtered or unexported fields
}
NodeVM holds resources to manage and monitor a QEMU process.
func (*NodeVM) ListSnapshots ¶ added in v1.3.1
ListSnapshots returns all available snapshots of VM
func (*NodeVM) LoadVM ¶ added in v1.3.0
LoadVM loads a snapshot of the VM. To load a snapshot, localds and vvfat devices have to be detached. NOTE: virtio block device does not support hot add. After loading snapshot, you will no longer access mounted block device other than rootfs.
https://github.com/ceph/qemu-kvm/blob/de4eb6c5347e40b02dbe72cda18b58654ad11242/hw/pci-hotplug.c#L143
func (*NodeVM) SaveVM ¶ added in v1.3.0
SaveVM saves a snapshot of the VM. To save a snapshot, localds and vvfat devices have to be detached. NOTE: virtio block device does not support hot add. After saving snapshot, you will no longer access mounted block device other than rootfs.
https://github.com/ceph/qemu-kvm/blob/de4eb6c5347e40b02dbe72cda18b58654ad11242/hw/pci-hotplug.c#L143
type NodeVolume ¶
type NodeVolume interface { Kind() string Name() string Resolve(*Cluster) error Create(context.Context, string) ([]string, error) }
NodeVolume defines the interface for Node volumes.
func NewImageVolume ¶
func NewImageVolume(name string, cache string, imageName string, cow bool) NodeVolume
NewImageVolume creates a volume for type "image".
func NewLVVolume ¶ added in v1.5.0
func NewLVVolume(name string, cache string, size, vg string) NodeVolume
NewLVVolume creates a volume for type "lv".
func NewLocalDSVolume ¶
func NewLocalDSVolume(name, cache string, u, n string) NodeVolume
NewLocalDSVolume creates a volume for type "localds".
func NewRawVolume ¶
func NewRawVolume(name string, cache string, size, format string) NodeVolume
NewRawVolume creates a volume for type "raw".
func NewVVFATVolume ¶
func NewVVFATVolume(name string, folderName string) NodeVolume
NewVVFATVolume creates a volume for type "vvfat".
type NodeVolumeSpec ¶
type NodeVolumeSpec struct { Kind string `json:"kind"` Name string `json:"name"` Image string `json:"image,omitempty"` UserData string `json:"user-data,omitempty"` NetworkConfig string `json:"network-config,omitempty"` Size string `json:"size,omitempty"` Folder string `json:"folder,omitempty"` CopyOnWrite bool `json:"copy-on-write,omitempty"` Cache string `json:"cache,omitempty"` Format string `json:"format,omitempty"` VG string `json:"vg,omitempty"` }
NodeVolumeSpec represents a Node's Volume specification in YAML
type Pod ¶
type Pod struct { *PodSpec // contains filtered or unexported fields }
Pod represents a pod resource.
type PodAppMountSpec ¶
PodAppMountSpec represents a App's Mount definition in YAML
type PodAppSpec ¶
type PodAppSpec struct { Name string `json:"name"` Image string `json:"image"` ReadOnlyRootfs bool `json:"readonly-rootfs"` User string `json:"user,omitempty"` Group string `json:"group,omitempty"` Exec string `json:"exec,omitempty"` Args []string `json:"args,omitempty"` Env map[string]string `json:"env,omitempty"` CapsRetain []string `json:"caps-retain,omitempty"` Mount []PodAppMountSpec `json:"mount,omitempty"` }
PodAppSpec represents a Pod's App definition in YAML
type PodInterfaceSpec ¶
type PodInterfaceSpec struct { Network string `json:"network"` Addresses []string `json:"addresses,omitempty"` }
PodInterfaceSpec represents a Pod's Interface definition in YAML
type PodSpec ¶
type PodSpec struct { Kind string `json:"kind"` Name string `json:"name"` InitScripts []string `json:"init-scripts,omitempty"` Interfaces []PodInterfaceSpec `json:"interfaces,omitempty"` Volumes []*PodVolumeSpec `json:"volumes,omitempty"` Apps []*PodAppSpec `json:"apps"` }
PodSpec represents a Pod specification in YAML
type PodVolume ¶
type PodVolume interface { // Name returns the volume name. Name() string // Resolve resolves references in the volume definition. Resolve(*Cluster) error // Spec returns a command-line argument for the volume. Spec() string }
PodVolume is an interface of a volume for Pod.
func NewPodVolume ¶
func NewPodVolume(spec *PodVolumeSpec) (PodVolume, error)
NewPodVolume makes a PodVolume, or returns an error.
type PodVolumeSpec ¶
type PodVolumeSpec struct { Name string `json:"name"` Kind string `json:"kind"` Folder string `json:"folder,omitempty"` ReadOnly bool `json:"readonly"` Mode string `json:"mode,omitempty"` UID string `json:"uid,omitempty"` GID string `json:"gid,omitempty"` }
PodVolumeSpec represents a Pod's Volume definition in YAML
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime contains the runtime information to run Cluster.
type SMBIOSConfig ¶
type SMBIOSConfig struct { Manufacturer string `json:"manufacturer,omitempty"` Product string `json:"product,omitempty"` Serial string `json:"serial,omitempty"` }
SMBIOSConfig represents a Node's SMBIOS definition in YAML