Documentation ¶
Index ¶
- Constants
- Variables
- func AddConnection(uri fmt.Stringer, name, identity string, isDefault bool) error
- func AnyConnectionDefault(name ...string) (bool, error)
- func BoolToPtr(b bool) *bool
- func ChangeDefault(name string) error
- func CommonSSH(username, identityPath, name string, sshPort int, inputArgs []string) error
- func ConfDirPrefix() (string, error)
- func CreateSSHKeys(writeLocation string) (string, error)
- func CreateSSHKeysPrefix(identityPath string, passThru bool, skipExisting bool, prefix ...string) (string, error)
- func DataDirPrefix() (string, error)
- func Decompress(localPath, uncompressedPath string) error
- func DetermineMachineArch() string
- func DownloadImage(d DistributionDownload) error
- func DownloadVMImage(downloadURL *url2.URL, imageName string, localImagePath string) error
- func EncodeDataURLPtr(contents string) *string
- func GetCacheDir(vmType VMType) (string, error)
- func GetConfDir(vmType VMType) (string, error)
- func GetDataDir(vmType VMType) (string, error)
- func GetFcosArch() string
- func GetPodmanDockerTmpConfig(uid int, rootful bool, newline bool) string
- func GetProxyVariables() map[string]string
- func GuardedRemoveAll(path string) error
- func IntToPtr(i int) *int
- func RemoveConnections(names ...string) error
- func RemoveImageAfterExpire(dir string, expire time.Duration) error
- func StrToPtr(s string) *string
- func UpdatePodmanDockerSockService(vm VM, name string, uid int, rootful bool) error
- type APIForwardingState
- type Artifact
- type Clevis
- type Config
- type ConnectionConfig
- type Custom
- type Device
- type Directory
- type DirectoryEmbedded1
- type Disk
- type DistributionDownload
- type Download
- type Dropin
- type DynamicIgnition
- type FCOSStream
- type FcosDownload
- type FcosDownloadInfo
- type File
- type FileEmbedded1
- type Filesystem
- type FilesystemOption
- type GenericDownload
- type Group
- type HTTPHeader
- type HTTPHeaders
- type HostUser
- type Ignition
- type IgnitionConfig
- type ImageCompression
- type ImageConfig
- type ImageFormat
- type InitOptions
- type InspectInfo
- type InspectOptions
- type Link
- type LinkEmbedded1
- type ListOptions
- type ListResponse
- type Luks
- type LuksOption
- type Mount
- type MountOption
- type NoProxyItem
- type Node
- type NodeGroup
- type NodeUser
- type Partition
- type Passwd
- type PasswdGroup
- type PasswdUser
- type Proxy
- type Raid
- type RaidOption
- type RemoteConnectionType
- type RemoveOptions
- type Resource
- type ResourceConfig
- type SSHAuthorizedKey
- type SSHConfig
- type SSHOptions
- type Security
- type SetOptions
- type StartOptions
- type Status
- type StopOptions
- type Storage
- type Systemd
- type TLS
- type Tang
- type Timeouts
- type Unit
- type VM
- type VMFile
- type VMType
- type Verification
- type VirtProvider
Constants ¶
const ( // Running indicates the qemu vm is running. Running Status = "running" // Stopped indicates the vm has stopped. Stopped Status = "stopped" // Starting indicated the vm is in the process of starting Starting Status = "starting" DefaultMachineName string = "podman-machine-default" )
const ( PodmanTestingHost = "fedorapeople.org" PodmanTestingURL = "groups/podman/testing" Xz ImageCompression = iota Zip Gz Bz2 Qemu Artifact = iota HyperV Metal None Qcow ImageFormat = iota Vhdx Tar Raw )
const ( UserCertsTargetPath = "/etc/containers/certs.d" PodmanDockerTmpConfPath = "/etc/tmpfiles.d/podman-docker.conf" )
const LocalhostIP = "127.0.0.1"
Variables ¶
var ( SSHRemoteConnection RemoteConnectionType = "ssh" DefaultIgnitionUserName = "core" ForwarderBinaryName = "gvproxy" )
var ( ErrNoSuchVM = errors.New("VM does not exist") ErrWrongState = errors.New("VM in wrong state to perform action") ErrVMAlreadyExists = errors.New("VM already exists") ErrVMAlreadyRunning = errors.New("VM already running or starting") ErrMultipleActiveVM = errors.New("only one VM can be active at a time") ErrNotImplemented = errors.New("functionality not implemented") )
Functions ¶
func AddConnection ¶
func AnyConnectionDefault ¶
func ChangeDefault ¶
func CommonSSH ¶ added in v4.6.0
CommonSSH is a common function for ssh'ing to a podman machine using system-connections and a port
func ConfDirPrefix ¶ added in v4.1.0
ConfDirPrefix returns the path prefix for all machine config files
func CreateSSHKeys ¶
CreateSSHKeys makes a priv and pub ssh key for interacting the a VM.
func CreateSSHKeysPrefix ¶
func DataDirPrefix ¶ added in v4.1.0
DataDirPrefix returns the path prefix for all machine data files
func Decompress ¶
func DetermineMachineArch ¶ added in v4.5.0
func DetermineMachineArch() string
func DownloadImage ¶
func DownloadImage(d DistributionDownload) error
func DownloadVMImage ¶
DownloadVMImage downloads a VM image from url to given path with download status
func EncodeDataURLPtr ¶ added in v4.6.0
func GetCacheDir ¶ added in v4.2.0
GetCacheDir returns the dir where VM images are downloaded into when pulled
func GetConfDir ¶
GetConfigDir returns the filepath to where configuration files for podman-machine should live
func GetDataDir ¶
GetDataDir returns the filepath where vm images should live for podman-machine.
func GetFcosArch ¶ added in v4.5.0
func GetFcosArch() string
func GetPodmanDockerTmpConfig ¶ added in v4.6.0
func GetProxyVariables ¶
func GuardedRemoveAll ¶ added in v4.4.0
GuardedRemoveAll functions much like os.RemoveAll but will not delete certain catastrophic paths.
func RemoveConnections ¶ added in v4.6.0
func RemoveImageAfterExpire ¶ added in v4.5.0
Types ¶
type APIForwardingState ¶ added in v4.6.0
type APIForwardingState int
const ( NoForwarding APIForwardingState = iota ClaimUnsupported NotInstalled MachineLocal DockerGlobal )
type ConnectionConfig ¶ added in v4.2.0
type ConnectionConfig struct { // PodmanSocket is the exported podman service socket PodmanSocket *VMFile `json:"PodmanSocket"` // PodmanPipe is the exported podman service named pipe (Windows hosts only) PodmanPipe *VMFile `json:"PodmanPipe"` }
ConnectionConfig contains connections like sockets, etc.
type Directory ¶
type Directory struct { Node DirectoryEmbedded1 }
type DirectoryEmbedded1 ¶
type DirectoryEmbedded1 struct {
Mode *int `json:"mode,omitempty"`
}
type DistributionDownload ¶
type DistributionDownload interface { HasUsableCache() (bool, error) Get() *Download CleanCache() error }
func NewFcosDownloader ¶
func NewFcosDownloader(vmType VMType, vmName string, imageStream FCOSStream, vp VirtProvider) (DistributionDownload, error)
func NewGenericDownloader ¶
func NewGenericDownloader(vmType VMType, vmName, pullPath string) (DistributionDownload, error)
NewGenericDownloader is used when the disk image is provided by the user
type Download ¶
type Download struct { Arch string Artifact Artifact CompressionType string CacheDir string Format ImageFormat ImageName string LocalPath string LocalUncompressedFile string Sha256sum string URL *url.URL VMName string Size int64 }
func (Download) GetLocalUncompressedFile ¶ added in v4.5.0
type DynamicIgnition ¶
type DynamicIgnition struct { Name string Key string TimeZone string UID int VMName string VMType VMType WritePath string Cfg Config Rootful bool }
func (*DynamicIgnition) GenerateIgnitionConfig ¶ added in v4.6.0
func (ign *DynamicIgnition) GenerateIgnitionConfig() error
GenerateIgnitionConfig
func (*DynamicIgnition) Write ¶ added in v4.6.0
func (ign *DynamicIgnition) Write() error
type FCOSStream ¶ added in v4.5.0
type FCOSStream int64
const ( // FCOS streams // Testing FCOS stream Testing FCOSStream = iota // Next FCOS stream Next // Stable FCOS stream Stable // Podman-Testing PodmanTesting )
func FCOSStreamFromString ¶ added in v4.5.0
func FCOSStreamFromString(s string) FCOSStream
func (FCOSStream) String ¶ added in v4.5.0
func (st FCOSStream) String() string
String is a helper func for fcos streams
type FcosDownload ¶
type FcosDownload struct {
Download
}
func (FcosDownload) CleanCache ¶ added in v4.2.0
func (f FcosDownload) CleanCache() error
func (FcosDownload) Get ¶
func (f FcosDownload) Get() *Download
func (FcosDownload) HasUsableCache ¶
func (f FcosDownload) HasUsableCache() (bool, error)
type FcosDownloadInfo ¶ added in v4.1.0
type FcosDownloadInfo struct { CompressionType string Location string Release string Sha256Sum string }
func GetFCOSDownload ¶ added in v4.1.0
func GetFCOSDownload(vp VirtProvider, imageStream FCOSStream) (*FcosDownloadInfo, error)
This should get Exported and stay put as it will apply to all fcos downloads getFCOS parses fedoraCoreOS's stream and returns the image download URL and the release version
type File ¶
type File struct { Node FileEmbedded1 }
type FileEmbedded1 ¶
type Filesystem ¶
type Filesystem struct { Device string `json:"device"` Format *string `json:"format,omitempty"` Label *string `json:"label,omitempty"` MountOptions []MountOption `json:"mountOptions,omitempty"` Options []FilesystemOption `json:"options,omitempty"` Path *string `json:"path,omitempty"` UUID *string `json:"uuid,omitempty"` WipeFilesystem *bool `json:"wipeFilesystem,omitempty"` }
type FilesystemOption ¶
type FilesystemOption string
type GenericDownload ¶
type GenericDownload struct {
Download
}
GenericDownload is used when a user provides a URL or path for an image
func (GenericDownload) CleanCache ¶ added in v4.2.0
func (g GenericDownload) CleanCache() error
CleanCache cleans out downloaded uncompressed image files
func (GenericDownload) Get ¶
func (g GenericDownload) Get() *Download
func (GenericDownload) HasUsableCache ¶
func (g GenericDownload) HasUsableCache() (bool, error)
type HTTPHeader ¶
type HTTPHeaders ¶
type HTTPHeaders []HTTPHeader
type HostUser ¶ added in v4.1.0
type HostUser struct { // Whether this machine should run in a rootful or rootless manner Rootful bool // UID is the numerical id of the user that called machine UID int // Whether one of these fields has changed and actions should be taken Modified bool `json:"HostUserModified"` }
HostUser describes the host user
type Ignition ¶
type Ignition struct { Config IgnitionConfig `json:"config,omitempty"` Proxy Proxy `json:"proxy,omitempty"` Security Security `json:"security,omitempty"` Timeouts Timeouts `json:"timeouts,omitempty"` Version string `json:"version,omitempty"` }
type IgnitionConfig ¶
type ImageCompression ¶ added in v4.5.0
type ImageCompression int64
func (ImageCompression) String ¶ added in v4.5.0
func (c ImageCompression) String() string
type ImageConfig ¶ added in v4.1.0
type ImageConfig struct { // IgnitionFile is the path to the filesystem where the // ignition file was written (if needs one) IgnitionFile VMFile `json:"IgnitionFilePath"` // ImageStream is the update stream for the image ImageStream string // ImageFile is the fq path to ImagePath VMFile `json:"ImagePath"` }
ImageConfig describes the bootable image for the VM
type ImageFormat ¶ added in v4.5.0
type ImageFormat int64
func (ImageFormat) String ¶ added in v4.5.0
func (imf ImageFormat) String() string
type InitOptions ¶
type InitOptions struct { CPUS uint64 DiskSize uint64 IgnitionPath string ImagePath string Volumes []string VolumeDriver string IsDefault bool Memory uint64 Name string TimeZone string URI url.URL Username string ReExec bool Rootful bool UID string // uid of the user that called machine UserModeNetworking *bool // nil = use backend/system default, false = disable, true = enable }
type InspectInfo ¶ added in v4.1.0
type InspectInfo struct { ConfigPath VMFile ConnectionInfo ConnectionConfig Created time.Time Image ImageConfig LastUp time.Time Name string Resources ResourceConfig SSHConfig SSHConfig State Status UserModeNetworking bool }
type InspectOptions ¶ added in v4.1.0
type InspectOptions struct{}
type Link ¶
type Link struct { Node LinkEmbedded1 }
type LinkEmbedded1 ¶
type ListOptions ¶
type ListOptions struct{}
type ListResponse ¶
type Luks ¶
type Luks struct { Clevis *Clevis `json:"clevis,omitempty"` Device *string `json:"device,omitempty"` KeyFile Resource `json:"keyFile,omitempty"` Label *string `json:"label,omitempty"` Name string `json:"name"` Options []LuksOption `json:"options,omitempty"` UUID *string `json:"uuid,omitempty"` WipeVolume *bool `json:"wipeVolume,omitempty"` }
type LuksOption ¶
type LuksOption string
type MountOption ¶
type MountOption string
type NoProxyItem ¶
type NoProxyItem string
type NodeGroup ¶
func GetNodeGrp ¶ added in v4.6.0
type NodeUser ¶
func GetNodeUsr ¶ added in v4.6.0
type Partition ¶
type Partition struct { GUID *string `json:"guid,omitempty"` Label *string `json:"label,omitempty"` Number int `json:"number,omitempty"` Resize *bool `json:"resize,omitempty"` ShouldExist *bool `json:"shouldExist,omitempty"` SizeMiB *int `json:"sizeMiB,omitempty"` StartMiB *int `json:"startMiB,omitempty"` TypeGUID *string `json:"typeGuid,omitempty"` WipePartitionEntry *bool `json:"wipePartitionEntry,omitempty"` }
type Passwd ¶
type Passwd struct { Groups []PasswdGroup `json:"groups,omitempty"` Users []PasswdUser `json:"users,omitempty"` }
type PasswdGroup ¶
type PasswdUser ¶
type PasswdUser struct { Gecos *string `json:"gecos,omitempty"` Groups []Group `json:"groups,omitempty"` HomeDir *string `json:"homeDir,omitempty"` Name string `json:"name"` NoCreateHome *bool `json:"noCreateHome,omitempty"` NoLogInit *bool `json:"noLogInit,omitempty"` NoUserGroup *bool `json:"noUserGroup,omitempty"` PasswordHash *string `json:"passwordHash,omitempty"` PrimaryGroup *string `json:"primaryGroup,omitempty"` SSHAuthorizedKeys []SSHAuthorizedKey `json:"sshAuthorizedKeys,omitempty"` Shell *string `json:"shell,omitempty"` ShouldExist *bool `json:"shouldExist,omitempty"` System *bool `json:"system,omitempty"` UID *int `json:"uid,omitempty"` }
type Proxy ¶
type Proxy struct { HTTPProxy *string `json:"httpProxy,omitempty"` HTTPSProxy *string `json:"httpsProxy,omitempty"` NoProxy []NoProxyItem `json:"noProxy,omitempty"` }
type Raid ¶
type Raid struct { Devices []Device `json:"devices"` Level string `json:"level"` Name string `json:"name"` Options []RaidOption `json:"options,omitempty"` Spares *int `json:"spares,omitempty"` }
type RaidOption ¶
type RaidOption string
type RemoteConnectionType ¶
type RemoteConnectionType string
func (RemoteConnectionType) MakeSSHURL ¶
func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url.URL
type RemoveOptions ¶
type Resource ¶
type Resource struct { Compression *string `json:"compression,omitempty"` HTTPHeaders HTTPHeaders `json:"httpHeaders,omitempty"` Source *string `json:"source,omitempty"` Verification Verification `json:"verification,omitempty"` }
type ResourceConfig ¶ added in v4.1.0
type ResourceConfig struct { // CPUs to be assigned to the VM CPUs uint64 // Disk size in gigabytes assigned to the vm DiskSize uint64 // Memory in megabytes assigned to the vm Memory uint64 }
ResourceConfig describes physical attributes of the machine
type SSHAuthorizedKey ¶
type SSHAuthorizedKey string
type SSHConfig ¶ added in v4.1.0
type SSHConfig struct { // IdentityPath is the fq path to the ssh priv key IdentityPath string // SSH port for user networking Port int // RemoteUsername of the vm user RemoteUsername string }
SSHConfig contains remote access information for SSH
type SSHOptions ¶
type SetOptions ¶
type StartOptions ¶
type StopOptions ¶
type StopOptions struct{}
type Storage ¶
type Storage struct { Directories []Directory `json:"directories,omitempty"` Disks []Disk `json:"disks,omitempty"` Files []File `json:"files,omitempty"` Filesystems []Filesystem `json:"filesystems,omitempty"` Links []Link `json:"links,omitempty"` Luks []Luks `json:"luks,omitempty"` Raid []Raid `json:"raid,omitempty"` }
type TLS ¶
type TLS struct {
CertificateAuthorities []Resource `json:"certificateAuthorities,omitempty"`
}
type VM ¶
type VM interface { Init(opts InitOptions) (bool, error) Inspect() (*InspectInfo, error) Remove(name string, opts RemoveOptions) (string, func() error, error) Set(name string, opts SetOptions) ([]error, error) SSH(name string, opts SSHOptions) error Start(name string, opts StartOptions) error State(bypass bool) (Status, error) Stop(name string, opts StopOptions) error }
type VMFile ¶ added in v4.1.0
type VMFile struct { // Path is the fully qualified path to a file Path string // Symlink is a shortened version of Path by using // a symlink Symlink *string `json:"symlink,omitempty"` }
func NewMachineFile ¶ added in v4.1.0
NewMachineFile is a constructor for VMFile
func (*VMFile) Delete ¶ added in v4.1.0
Delete removes the machinefile symlink (if it exists) and the actual path
type Verification ¶
type Verification struct {
Hash *string `json:"hash,omitempty"`
}
type VirtProvider ¶ added in v4.5.0
type VirtProvider interface { Artifact() Artifact CheckExclusiveActiveVM() (bool, string, error) Compression() ImageCompression Format() ImageFormat IsValidVMName(name string) (bool, error) List(opts ListOptions) ([]*ListResponse, error) LoadVMByName(name string) (VM, error) NewMachine(opts InitOptions) (VM, error) RemoveAndCleanMachines() error VMType() VMType }