proxmox

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// The tag that will be added to VMs in Proxmox cluster
	VirtualMachineRunningState = "running"
	VirtualMachineStoppedState = "stopped"

	// The timeout for qemu-agent to start in seconds
	AgentTimeoutSeconds = 10
)

Variables

View Source
var (
	// Create Proxmox client
	Client = CreateProxmoxClient()
)
View Source
var (
	ManagedVirtualMachineTag string
)
View Source
var (
	ObserveInterval = 20 * time.Second
)

Functions

func AgentIsRunning

func AgentIsRunning(vmName, nodeName string) bool

func CheckContainerDelta added in v0.1.1

func CheckContainerDelta(container *proxmoxv1alpha1.Container) (bool, error)

func CheckManagedVMDelta added in v0.1.1

func CheckManagedVMDelta(managedVM *proxmoxv1alpha1.ManagedVirtualMachine) (
	bool, error)

func CheckManagedVMExists

func CheckManagedVMExists(managedVM string) bool

func CheckVM

func CheckVM(vmName, nodeName string) bool

func CheckVMType

func CheckVMType(vm *proxmoxv1alpha1.VirtualMachine) string

func CheckVirtualMachineDelta added in v0.1.1

func CheckVirtualMachineDelta(vm *proxmoxv1alpha1.VirtualMachine) (bool, error)

func CloneContainer

func CloneContainer(container *proxmoxv1alpha1.Container) error

func ConfigureVirtualMachine

func ConfigureVirtualMachine(vm *proxmoxv1alpha1.VirtualMachine) error

func ContainerExists

func ContainerExists(containerName, nodeName string) bool

func CreateCustomCertificate

func CreateCustomCertificate(nodeName string, proxmoxCertSpec *proxmoxv1alpha1.ProxmoxCertSpec) error

CreateCustomCertificate creates a custom certificate object in proxmox node

func CreateManagedVM

func CreateManagedVM(managedVM string) *proxmoxv1alpha1.ManagedVirtualMachine

func CreateProxmoxClient

func CreateProxmoxClient() *proxmox.Client

func CreateVMFromScratch

func CreateVMFromScratch(vm *proxmoxv1alpha1.VirtualMachine)

func CreateVMFromTemplate

func CreateVMFromTemplate(vm *proxmoxv1alpha1.VirtualMachine)

func CreateVMSnapshot

func CreateVMSnapshot(vmName, snapshotName string) (statusCode int)

func DeleteContainer

func DeleteContainer(containerName, nodeName string)

func DeleteCustomCertificate

func DeleteCustomCertificate(nodeName string)

Delete certificate object from proxmox node

func DeleteStorageContent

func DeleteStorageContent(storageName string, spec *proxmoxv1alpha1.StorageDownloadURLSpec) error

func DeleteVM

func DeleteVM(vmName, nodeName string)

func GetContainer

func GetContainer(containerName, nodeName string) *proxmox.Container

func GetContainerID

func GetContainerID(containerName, nodeName string) int

func GetContainerState

func GetContainerState(containerName, nodeName string) string

func GetDiskConfiguration

func GetDiskConfiguration(vm *proxmoxv1alpha1.VirtualMachine) (map[string]string, error)

func GetManagedVMSpec

func GetManagedVMSpec(managedVMName, nodeName string) (cores, memory, disk int)

func GetManagedVMs

func GetManagedVMs() []string

func GetNetworkConfiguration

func GetNetworkConfiguration(vmName, nodeName string) (map[string]string, error)

func GetNodeOfVM

func GetNodeOfVM(vmName string) string

func GetNodes

func GetNodes() ([]string, error)

func GetOSInfo

func GetOSInfo(vmName, nodeName string) string

func GetOnlineNodes

func GetOnlineNodes() []string

func GetProxmoxVersion

func GetProxmoxVersion() (*proxmox.Version, error)

func GetStorageContent

func GetStorageContent(node, storageName string) ([]*proxmox.StorageContent, error)

func GetTask

func GetTask(taskUPID string) *proxmox.Task

func GetVMID

func GetVMID(vmName, nodeName string) int

func GetVMIPAddress

func GetVMIPAddress(vmName, nodeName string) string

func GetVMSnapshots

func GetVMSnapshots(vmName string) ([]string, error)

func GetVMState

func GetVMState(vmName, nodeName string) string

func GetVMUptime

func GetVMUptime(vmName, nodeName string) string

func HasFile

func HasFile(storageContent []*proxmox.StorageContent, storageDownloadSpec *proxmoxv1alpha1.StorageDownloadURLSpec) bool

func RemoveVirtualMachineTag

func RemoveVirtualMachineTag(vmName, nodeName, tag string) error

func RestartContainer

func RestartContainer(containerName, nodeName string) bool

func RestartVM

func RestartVM(vmName, nodeName string) *proxmox.Task

func StartContainer

func StartContainer(containerName, nodeName string) error

func StartVM

func StartVM(vmName, nodeName string) (string, error)

func StartWatcher added in v0.1.1

func StartWatcher(ctx context.Context, resource Resource,
	stopChan chan struct{}, fetchResource FetchResourceFunc, updateStatus UpdateStatusFunc,
	checkDelta CheckDeltaFunc, handleAutoStart HandleAutoStartFunc, handleReconcile HandleReconcileFunc,
	deleteWatcher DeleteWatcherFunc) (ctrl.Result, error)

func StopContainer

func StopContainer(containerName, nodeName string) error

func StorageDownloadURL

func StorageDownloadURL(node string, storageDownloadURLSpec *proxmoxv1alpha1.StorageDownloadURLSpec) (string, error)

func UpdateContainer

func UpdateContainer(container *proxmoxv1alpha1.Container)

func UpdateContainerStatus

func UpdateContainerStatus(containerName, nodeName string) proxmoxv1alpha1.QEMUStatus

func UpdateManagedVM

func UpdateManagedVM(ctx context.Context, managedVM *proxmoxv1alpha1.ManagedVirtualMachine)

func UpdateVM

func UpdateVM(vm *proxmoxv1alpha1.VirtualMachine) bool

func UpdateVMStatus

func UpdateVMStatus(vmName, nodeName string) (*proxmoxv1alpha1.QEMUStatus, error)

func VMSnapshotExists

func VMSnapshotExists(vmName, snapshotName string) bool

Types

type CheckDeltaFunc added in v0.1.1

type CheckDeltaFunc func(obj Resource) (bool, error)

type DeleteWatcherFunc added in v0.1.1

type DeleteWatcherFunc func(name string)

type ExternalWatchers added in v0.1.1

type ExternalWatchers struct {
	Watchers map[string]chan struct{}
	// contains filtered or unexported fields
}

func NewExternalWatchers added in v0.1.1

func NewExternalWatchers() *ExternalWatchers

func (*ExternalWatchers) DeleteWatcher added in v0.1.1

func (e *ExternalWatchers) DeleteWatcher(name string)

func (*ExternalWatchers) HandleWatcher added in v0.1.1

func (e *ExternalWatchers) HandleWatcher(ctx context.Context, req ctrl.Request,
	startWatcherFunc func(ctx context.Context, stopChan chan struct{}) (ctrl.Result, error))

type FetchResourceFunc added in v0.1.1

type FetchResourceFunc func(ctx context.Context, key client.ObjectKey, obj Resource) error

type HandleAutoStartFunc added in v0.1.1

type HandleAutoStartFunc func(ctx context.Context, obj Resource) (ctrl.Result, error)

type HandleReconcileFunc added in v0.1.1

type HandleReconcileFunc func(ctx context.Context, obj Resource) (ctrl.Result, error)

type ProxmoxConfig

type ProxmoxConfig struct {
	Endpoint              string
	APIEndpoint           string
	InsecureSkipTLSVerify bool
	Username              string
	Password              string
	TokenID               string
	Secret                string
}

type Resource added in v0.1.1

type Resource interface {
	client.Object
}

type UpdateStatusFunc added in v0.1.1

type UpdateStatusFunc func(ctx context.Context, obj Resource) error

type VirtualMachineComparison added in v0.1.1

type VirtualMachineComparison struct {
	Sockets  int `json:"sockets"`
	Cores    int `json:"cores"`
	Memory   int `json:"memory"`
	Networks []proxmoxv1alpha1.VirtualMachineSpecTemplateNetwork
	Disks    []proxmoxv1alpha1.VirtualMachineSpecTemplateDisk
}

Jump to

Keyboard shortcuts

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