vsphere

package
v0.90.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 35 Imported by: 35

Documentation

Overview

Package vsphere collects vSphere-specific configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClusterNetworks

func GetClusterNetworks(ctx context.Context, finder Finder, datacenter, cluster string) ([]types.ManagedObjectReference, error)

GetClusterNetworks returns a slice of Managed Object references for vSphere networks in the given Datacenter and Cluster.

func GetNetworkMo

func GetNetworkMo(ctx context.Context, client *vim25.Client, finder Finder, datacenter, cluster, network string) (*types.ManagedObjectReference, error)

GetNetworkMo returns the unique Managed Object for given network name inside of the given Datacenter and Cluster.

func GetNetworkMoID

func GetNetworkMoID(ctx context.Context, client *vim25.Client, finder Finder, datacenter, cluster, network string) (string, error)

GetNetworkMoID returns the unique Managed Object ID for given network name inside of the given Datacenter and Cluster.

func GetNetworkName

func GetNetworkName(ctx context.Context, client *vim25.Client, ref types.ManagedObjectReference) (string, error)

GetNetworkName returns the name of a vSphere network given its Managed Object reference.

func Platform

func Platform() (*vsphere.Platform, error)

Platform collects vSphere-specific configuration.

func Validate

func Validate(ic *types.InstallConfig) error

Validate executes platform-specific validation.

func ValidateForProvisioning

func ValidateForProvisioning(ic *types.InstallConfig) error

ValidateForProvisioning performs platform validation specifically for multi-zone installer-provisioned infrastructure. In this case, self-hosted networking is a requirement when the installer creates infrastructure for vSphere clusters.

Types

type AuthManager

type AuthManager interface {
	FetchUserPrivilegeOnEntities(ctx context.Context, entities []vim25types.ManagedObjectReference, userName string) ([]vim25types.UserPrivilegeResult, error)
	Properties(ctx context.Context, r vim25types.ManagedObjectReference, ps []string, dst interface{}) error
	Reference() vim25types.ManagedObjectReference
}

AuthManager defines an interface to an implementation of the AuthorizationManager to facilitate mocking

type ClientLogout

type ClientLogout func()

ClientLogout is empty function that logs out of vSphere clients

func CreateVSphereClients

func CreateVSphereClients(ctx context.Context, vcenter, username, password string) (*vim25.Client, *rest.Client, ClientLogout, error)

CreateVSphereClients creates the SOAP and REST client to access different portions of the vSphere API e.g. tags are only available in REST

type Finder

type Finder interface {
	Datacenter(ctx context.Context, path string) (*object.Datacenter, error)
	DatacenterList(ctx context.Context, path string) ([]*object.Datacenter, error)
	DatastoreList(ctx context.Context, path string) ([]*object.Datastore, error)
	ClusterComputeResource(ctx context.Context, path string) (*object.ClusterComputeResource, error)
	ClusterComputeResourceList(ctx context.Context, path string) ([]*object.ClusterComputeResource, error)
	Folder(ctx context.Context, path string) (*object.Folder, error)
	NetworkList(ctx context.Context, path string) ([]object.NetworkReference, error)
	Network(ctx context.Context, path string) (object.NetworkReference, error)
	ResourcePool(ctx context.Context, path string) (*object.ResourcePool, error)
	VirtualMachine(ctx context.Context, path string) (*object.VirtualMachine, error)
	VirtualMachineList(ctx context.Context, path string) ([]*object.VirtualMachine, error)
	HostSystemList(ctx context.Context, path string) ([]*object.HostSystem, error)
	ObjectReference(ctx context.Context, ref types.ManagedObjectReference) (object.Reference, error)
}

Finder interface represents the client that is used to connect to VSphere to get specific information from the resources in the VCenter. This interface just describes all the useful functions used by the installer from the finder function in vmware govmomi package and is mostly used to create a mock client that can be used for testing.

func NewFinder

func NewFinder(client *vim25.Client, all ...bool) Finder

NewFinder creates a new client that conforms with the Finder interface and returns a vmware govmomi finder object that can be used to search for resources in vsphere.

type Metadata added in v0.90.0

type Metadata struct {
	VCenterContexts map[string]VCenterContext

	VCenterCredentials map[string]VCenterCredential
	// contains filtered or unexported fields
}

Metadata holds vcenter stuff.

func NewMetadata added in v0.90.0

func NewMetadata() *Metadata

NewMetadata initializes a new Metadata object.

func (*Metadata) AddCredentials added in v0.90.0

func (m *Metadata) AddCredentials(server, username, password string) *session.Params

AddCredentials creates a session param from the vCenter server, username and password to the Credentials Map.

func (*Metadata) Networks added in v0.90.0

func (m *Metadata) Networks(ctx context.Context, vcenter vsphere.VCenter, failureDomains []vsphere.FailureDomain) error

Networks populates VCenterContext and the ClusterNetworkMap based on the vCenter server url and the FailureDomains.

func (*Metadata) Session added in v0.90.0

func (m *Metadata) Session(ctx context.Context, server string) (*session.Session, error)

Session returns a session from unlockedSession based on the server (vCenter URL).

type NetworkNameMap added in v0.90.0

type NetworkNameMap struct {
	Cluster       string
	ResourcePools map[string]*object.ResourcePool
	NetworkNames  map[string]string
}

NetworkNameMap contains the vCenter cluster name, resource pools and network names.

type PermissionGroupDefinition

type PermissionGroupDefinition struct {
	/* Permissions array of privileges which correlate with the privileges listed in docs */
	Permissions []string
	/* Description friendly description of privilege group */
	Description string
}

PermissionGroupDefinition defines a group of permissions and a related human friendly description

type PrivilegeRelevanceFunc

type PrivilegeRelevanceFunc func(*vspheretypes.Platform) bool

PrivilegeRelevanceFunc returns true if the associated privilege group privileges should be verified

type SessionManager

type SessionManager interface {
	UserSession(ctx context.Context) (*vim25types.UserSession, error)
}

SessionManager defines an interface to an implementation of the SessionManager to facilitate mocking.

type TagManager

type TagManager interface {
	ListCategories(ctx context.Context) ([]string, error)
	GetCategories(ctx context.Context) ([]vapitags.Category, error)
	GetCategory(ctx context.Context, id string) (*vapitags.Category, error)
	GetTagsForCategory(ctx context.Context, id string) ([]vapitags.Tag, error)
	GetAttachedTags(ctx context.Context, ref mo.Reference) ([]vapitags.Tag, error)
	GetAttachedTagsOnObjects(ctx context.Context, objectID []mo.Reference) ([]vapitags.AttachedTags, error)
}

TagManager defines an interface to an implementation of the AuthorizationManager to facilitate mocking.

type VCenterContext added in v0.90.0

type VCenterContext struct {
	VCenter           string
	Datacenters       []string
	ClusterNetworkMap map[string]NetworkNameMap
}

VCenterContext maintains context of known vCenters to be used in CAPI manifest reconciliation.

type VCenterCredential added in v0.90.0

type VCenterCredential struct {
	Username string
	Password string
}

VCenterCredential contains the vCenter username and password.

Directories

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

Jump to

Keyboard shortcuts

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