controllers

package
v0.0.0-...-cc49d4d Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupVAppStatusController

func SetupVAppStatusController(mgr ctrl.Manager, vappRepo VAppStatusRepositoryInterface, vmRepo VMStatusRepositoryInterface, vdcRepo VDCStatusRepositoryInterface) error

SetupVAppStatusController sets up the VApp status controller with the manager

func SetupVMStatusController

func SetupVMStatusController(mgr ctrl.Manager, vmRepo VMRepositoryInterface, vappRepo VAppRepositoryInterface, vdcRepo VDCRepositoryInterface) error

SetupVMStatusController sets up the controller with the Manager

Types

type VAppRepositoryInterface

type VAppRepositoryInterface interface {
	GetByNameInVDC(ctx context.Context, vdcID, name string) (*models.VApp, error)
	CreateVApp(ctx context.Context, vapp *models.VApp) error
}

VAppRepositoryInterface defines the interface for VApp repository operations

type VAppStatusController

type VAppStatusController struct {
	client.Client
	Scheme   *runtime.Scheme
	VAppRepo VAppStatusRepositoryInterface
	VMRepo   VMStatusRepositoryInterface
	VDCRepo  VDCStatusRepositoryInterface
}

VAppStatusController reconciles vApp status based on TemplateInstance and VM states

func (*VAppStatusController) Reconcile

func (r *VAppStatusController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile handles vApp status updates based on TemplateInstance changes

func (*VAppStatusController) SetupWithManager

func (r *VAppStatusController) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager

type VAppStatusEvaluator

type VAppStatusEvaluator struct {
	// contains filtered or unexported fields
}

VAppStatusEvaluator evaluates vApp status based on multiple inputs

func (*VAppStatusEvaluator) EvaluateStatus

func (e *VAppStatusEvaluator) EvaluateStatus() string

EvaluateStatus determines the appropriate vApp status

type VAppStatusRepositoryInterface

type VAppStatusRepositoryInterface interface {
	GetByNameInVDC(ctx context.Context, vdcID, name string) (*models.VApp, error)
	UpdateStatus(ctx context.Context, vappID string, status string) error
}

VAppStatusRepositoryInterface defines the interface for VApp repository operations

type VDCRepositoryInterface

type VDCRepositoryInterface interface {
	GetByNamespace(ctx context.Context, namespaceName string) (*models.VDC, error)
}

VDCRepositoryInterface defines the interface for VDC repository operations

type VDCStatusRepositoryInterface

type VDCStatusRepositoryInterface interface {
	GetByNamespace(ctx context.Context, namespaceName string) (*models.VDC, error)
}

VDCStatusRepositoryInterface defines the interface for VDC repository operations

type VMIData

type VMIData struct {
	CPUCount *int   // From status.currentCPUTopology.cores
	MemoryMB *int   // From status.memory.guestCurrent (converted to MB)
	GuestOS  string // From status.guestOSInfo (formatted string)
}

VMIData represents the data we extract from VirtualMachineInstance

type VMInfo

type VMInfo struct {
	Name      string
	Namespace string
	Status    string
	VAppID    string
	VDCID     string
	UpdatedAt time.Time
}

VMInfo contains extracted information from VirtualMachine resource

type VMRepositoryInterface

type VMRepositoryInterface interface {
	GetByNamespaceAndVMName(ctx context.Context, namespace, vmName string) (*models.VM, error)
	GetByVAppAndVMName(ctx context.Context, vappID, vmName string) (*models.VM, error)
	UpdateStatus(ctx context.Context, vmID string, status string) error
	UpdateVMData(ctx context.Context, vmID string, cpuCount *int, memoryMB *int, guestOS string) error
	CreateVM(ctx context.Context, vm *models.VM) error
}

VMRepositoryInterface defines the interface for VM repository operations

type VMStatusController

type VMStatusController struct {
	client.Client
	Scheme   *runtime.Scheme
	VMRepo   VMRepositoryInterface
	VAppRepo VAppRepositoryInterface
	VDCRepo  VDCRepositoryInterface
	Recorder record.EventRecorder
}

VMStatusController reconciles VirtualMachine resources with database VM records

func (*VMStatusController) Reconcile

func (r *VMStatusController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

type VMStatusRepositoryInterface

type VMStatusRepositoryInterface interface {
	GetByVAppID(vappID string) ([]models.VM, error)
}

VMStatusRepositoryInterface defines the interface for VM repository operations

Jump to

Keyboard shortcuts

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