vsphere

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-3-Clause Imports: 30 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GuestCredential added in v0.53.0

type GuestCredential struct {
	ModelPath string `mapstructure:"modelPath" default:"my/model" commented:"true" toml:"modelPath" json:"-"`
	Username  string `mapstructure:"username" commented:"true" toml:"username" json:"-"`
	Password  string `mapstructure:"password" commented:"true" toml:"password" json:"-"`
}

type HatcheryConfiguration

type HatcheryConfiguration struct {
	service.HatcheryCommonConfiguration `mapstructure:"commonConfiguration" toml:"commonConfiguration" json:"commonConfiguration"`
	VSphereUser                         string                     `mapstructure:"user" toml:"user" default:"" commented:"false" comment:"VSphere User" json:"user"`
	VSphereEndpoint                     string                     `` /* 147-byte string literal not displayed */
	VSpherePassword                     string                     `mapstructure:"password" toml:"password" default:"" commented:"false" comment:"VShpere Password" json:"-"`
	VSphereDatacenterString             string                     `` /* 137-byte string literal not displayed */
	VSphereDatastoreString              string                     `` /* 133-byte string literal not displayed */
	VSphereNetworkString                string                     `mapstructure:"networkString" toml:"networkString" default:"" commented:"false" comment:"VShpere Network" json:"networkString"`
	VSphereCardName                     string                     `` /* 133-byte string literal not displayed */
	IPRange                             string                     `` /* 325-byte string literal not displayed */
	Gateway                             string                     `` /* 143-byte string literal not displayed */
	DNS                                 string                     `mapstructure:"dns" toml:"dns" default:"" commented:"false" comment:"Optional. DNS IP" json:"dns,omitempty"`
	SubnetMask                          string                     `mapstructure:"subnetMask" toml:"subnetMask" default:"255.255.255.0" commented:"false" comment:"Subnet Mask" json:"subnetMask"`
	WorkerTTL                           int                        `mapstructure:"workerTTL" toml:"workerTTL" default:"120" commented:"false" comment:"Worker TTL (minutes)" json:"workerTTL"`
	WorkerRegistrationTTL               int                        `` /* 156-byte string literal not displayed */
	WorkerProvisioningInterval          int                        `` /* 175-byte string literal not displayed */
	WorkerProvisioningPoolSize          int                        `` /* 166-byte string literal not displayed */
	WorkerProvisioning                  []WorkerProvisioningConfig `` /* 147-byte string literal not displayed */
	GuestCredentials                    []GuestCredential          `mapstructure:"guestCredentials" toml:"guestCredentials" commented:"true" comment:"List of Guest credentials" json:"-"`
}

HatcheryConfiguration is the configuration for hatchery

type HatcheryVSphere

type HatcheryVSphere struct {
	hatcheryCommon.Common
	Config HatcheryConfiguration

	IpAddressesMutex sync.Mutex
	// contains filtered or unexported fields
}

HatcheryVSphere spawns vm

func New

func New() *HatcheryVSphere

New instanciates a new Hatchery vsphere

func (*HatcheryVSphere) ApplyConfiguration

func (h *HatcheryVSphere) ApplyConfiguration(cfg interface{}) error

ApplyConfiguration apply an object of type HatcheryConfiguration after checking it

func (*HatcheryVSphere) CanSpawn

func (h *HatcheryVSphere) CanSpawn(ctx context.Context, model sdk.WorkerStarterWorkerModel, jobID string, requirements []sdk.Requirement) bool

CanSpawn return wether or not hatchery can spawn model requirements are not supported

func (*HatcheryVSphere) CheckConfiguration

func (h *HatcheryVSphere) CheckConfiguration(cfg interface{}) error

CheckConfiguration checks the validity of the configuration object

func (*HatcheryVSphere) Configuration

Configuration returns Hatchery CommonConfiguration

func (*HatcheryVSphere) FindProvisionnedWorker

func (h *HatcheryVSphere) FindProvisionnedWorker(ctx context.Context, m sdk.WorkerStarterWorkerModel) (*object.VirtualMachine, error)

func (*HatcheryVSphere) Init

func (h *HatcheryVSphere) Init(config interface{}) (cdsclient.ServiceConfig, error)

Init cdsclient config.

func (*HatcheryVSphere) InitHatchery

func (h *HatcheryVSphere) InitHatchery(ctx context.Context) error

InitHatchery create new client for vsphere

func (*HatcheryVSphere) ModelType

func (*HatcheryVSphere) ModelType() string

ModelType returns type of hatchery

func (*HatcheryVSphere) NeedRegistration

func (h *HatcheryVSphere) NeedRegistration(ctx context.Context, m *sdk.Model) bool

NeedRegistration return true if worker model need regsitration

func (*HatcheryVSphere) ProvisionWorker

func (h *HatcheryVSphere) ProvisionWorker(ctx context.Context, m sdk.Model, workerName string) (err error)

func (*HatcheryVSphere) Serve

func (h *HatcheryVSphere) Serve(ctx context.Context) error

Serve start the hatchery server

func (*HatcheryVSphere) Signin added in v0.53.0

func (h *HatcheryVSphere) Signin(ctx context.Context, clientConfig cdsclient.ServiceConfig, srvConfig interface{}) error

func (*HatcheryVSphere) SpawnWorker

func (h *HatcheryVSphere) SpawnWorker(ctx context.Context, spawnArgs hatchery.SpawnArguments) (err error)

SpawnWorker creates a new vm instance

func (*HatcheryVSphere) Start

func (h *HatcheryVSphere) Start(ctx context.Context) error

Start inits client and routines for hatchery

func (*HatcheryVSphere) Status

Status returns sdk.MonitoringStatus, implements interface service.Service

func (*HatcheryVSphere) WorkerModelSecretList

func (h *HatcheryVSphere) WorkerModelSecretList(m sdk.Model) (sdk.WorkerModelSecrets, error)

WorkerModelSecretList returns secret for given model.

func (*HatcheryVSphere) WorkerModelsEnabled

func (h *HatcheryVSphere) WorkerModelsEnabled() ([]sdk.Model, error)

WorkerModelsEnabled returns Worker model enabled

func (*HatcheryVSphere) WorkersStarted

func (h *HatcheryVSphere) WorkersStarted(ctx context.Context) ([]string, error)

WorkersStarted returns the list of workers started but not necessarily register on CDS yet

type VSphereClient

type VSphereClient interface {
	ListVirtualMachines(ctx context.Context) ([]mo.VirtualMachine, error)
	LoadVirtualMachine(ctx context.Context, name string) (*object.VirtualMachine, error)
	LoadVirtualMachineDevices(ctx context.Context, vm *object.VirtualMachine) (object.VirtualDeviceList, error)
	StartVirtualMachine(ctx context.Context, vm *object.VirtualMachine) error
	ShutdownVirtualMachine(ctx context.Context, vm *object.VirtualMachine) error
	DestroyVirtualMachine(ctx context.Context, vm *object.VirtualMachine) error
	CloneVirtualMachine(ctx context.Context, vm *object.VirtualMachine, folder *object.Folder, name string, config *types.VirtualMachineCloneSpec) (*types.ManagedObjectReference, error)
	GetVirtualMachinePowerState(ctx context.Context, vm *object.VirtualMachine) (types.VirtualMachinePowerState, error)
	NewVirtualMachine(ctx context.Context, cloneSpec *types.VirtualMachineCloneSpec, ref *types.ManagedObjectReference) (*object.VirtualMachine, error)
	RenameVirtualMachine(ctx context.Context, vm *object.VirtualMachine, newName string) error
	MarkVirtualMachineAsTemplate(ctx context.Context, vm *object.VirtualMachine) error
	WaitForVirtualMachineShutdown(ctx context.Context, vm *object.VirtualMachine) error
	WaitForVirtualMachineIP(ctx context.Context, vm *object.VirtualMachine, IPAddress *string) error
	LoadFolder(ctx context.Context) (*object.Folder, error)
	SetupEthernetCard(ctx context.Context, card *types.VirtualEthernetCard, ethernetCardName string, network object.NetworkReference) error
	LoadNetwork(ctx context.Context, name string) (object.NetworkReference, error)
	LoadResourcePool(ctx context.Context) (*object.ResourcePool, error)
	LoadDatastore(ctx context.Context, name string) (*object.Datastore, error)
	ProcessManager(ctx context.Context, vm *object.VirtualMachine) (*guest.ProcessManager, error)
	StartProgramInGuest(ctx context.Context, procman *guest.ProcessManager, req *types.StartProgramInGuest) (*types.StartProgramInGuestResponse, error)
}

func NewVSphereClient

func NewVSphereClient(vclient *govmomi.Client, datacenter string) VSphereClient

type WorkerProvisioningConfig

type WorkerProvisioningConfig struct {
	ModelPath string `mapstructure:"modelPath" default:"my/model" commented:"true" toml:"modelPath" json:"modelPath"`
	Number    int    `mapstructure:"number" commented:"true" toml:"number" json:"number"`
}

Directories

Path Synopsis
Package mock_vsphere is a generated GoMock package.
Package mock_vsphere is a generated GoMock package.

Jump to

Keyboard shortcuts

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