context

package
v0.3.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2019 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterContext

type ClusterContext struct {
	context.Context
	Cluster       *clusterv1.Cluster
	ClusterCopy   *clusterv1.Cluster
	ClusterClient client.ClusterInterface
	ClusterConfig *v1alpha1.VsphereClusterProviderConfig
	ClusterStatus *v1alpha1.VsphereClusterProviderStatus
	Logger        logr.Logger
	// contains filtered or unexported fields
}

ClusterContext is a Go context used with a CAPI cluster.

func NewClusterContext

func NewClusterContext(params *ClusterContextParams) (*ClusterContext, error)

NewClusterContext returns a new ClusterContext.

func NewClusterLoggerContext

func NewClusterLoggerContext(parentContext *ClusterContext, loggerContext string) *ClusterContext

NewClusterLoggerContext creates a new ClusterContext with the given logger context.

func (*ClusterContext) CanLogin

func (c *ClusterContext) CanLogin() bool

CanLogin returns a flag indicating whether the cluster config has enough information to login to the vSphere endpoint.

func (*ClusterContext) ClusterName

func (c *ClusterContext) ClusterName() string

ClusterName returns the name of the cluster.

func (*ClusterContext) ClusterProviderConfig

func (c *ClusterContext) ClusterProviderConfig() *v1alpha1.VsphereClusterProviderConfig

ClusterProviderConfig returns the cluster provider config.

func (*ClusterContext) ControlPlaneEndpoint

func (c *ClusterContext) ControlPlaneEndpoint() (string, error)

ControlPlaneEndpoint returns the control plane endpoint for the cluster. If a control plane endpoint was specified in the cluster configuration, then that value will be returned. Otherwise this function will return the endpoint of the first control plane node in the cluster that reports an IP address. If no control plane nodes have reported an IP address then this function returns an error.

func (*ClusterContext) FirstControlPlaneMachine

func (c *ClusterContext) FirstControlPlaneMachine() (*clusterv1.Machine, error)

FirstControlPlaneMachine returns the first control plane machine according to the machines' CreationTimestamp property.

func (*ClusterContext) GetControlPlaneMachines

func (c *ClusterContext) GetControlPlaneMachines() ([]*clusterv1.Machine, error)

GetControlPlaneMachines returns the control plane machines for the cluster.

func (*ClusterContext) GetLogger

func (c *ClusterContext) GetLogger() logr.Logger

GetLogger returns the Logger.

func (*ClusterContext) GetMachineClient

func (c *ClusterContext) GetMachineClient() client.MachineInterface

GetMachineClient returns a new Machine client for this cluster.

func (*ClusterContext) GetMachines

func (c *ClusterContext) GetMachines() ([]*clusterv1.Machine, error)

GetMachines gets the machines in the cluster.

func (*ClusterContext) GetObject

func (c *ClusterContext) GetObject() runtime.Object

GetObject returns the Cluster object.

func (*ClusterContext) Pass

func (c *ClusterContext) Pass() string

Pass returns the password used to access the vSphere endpoint.

func (*ClusterContext) Patch

func (c *ClusterContext) Patch() error

Patch updates the cluster on the API server.

func (*ClusterContext) String

func (c *ClusterContext) String() string

Strings returns ClusterNamespace/ClusterName

func (*ClusterContext) User

func (c *ClusterContext) User() string

User returns the username used to access the vSphere endpoint.

type ClusterContextParams

type ClusterContextParams struct {
	Context    context.Context
	Cluster    *clusterv1.Cluster
	Client     client.ClusterV1alpha1Interface
	CoreClient corev1.CoreV1Interface
	Logger     logr.Logger
}

ClusterContextParams are the parameters needed to create a ClusterContext.

type KubeContext

type KubeContext interface {
	ClusterName() string
	ClusterProviderConfig() *v1alpha1.VsphereClusterProviderConfig
	ControlPlaneEndpoint() (string, error)
}

KubeContext has the information needed to get a connection to a Kubernetes cluster.

type MachineContext

type MachineContext struct {
	*ClusterContext
	Machine       *clusterv1.Machine
	MachineCopy   *clusterv1.Machine
	MachineClient client.MachineInterface
	MachineConfig *v1alpha1.VsphereMachineProviderConfig
	MachineStatus *v1alpha1.VsphereMachineProviderStatus
	Session       *Session
}

MachineContext is a Go context used with a CAPI cluster.

func NewMachineContext

func NewMachineContext(params *MachineContextParams) (*MachineContext, error)

NewMachineContext returns a new MachineContext.

func NewMachineContextFromClusterContext

func NewMachineContextFromClusterContext(
	clusterCtx *ClusterContext, machine *clusterv1.Machine) (*MachineContext, error)

NewMachineContextFromClusterContext creates a new MachineContext using an existing CluserContext.

func NewMachineLoggerContext

func NewMachineLoggerContext(parentContext *MachineContext, loggerContext string) *MachineContext

NewMachineLoggerContext creates a new MachineContext with the given logger context.

func (*MachineContext) BindPort

func (c *MachineContext) BindPort() int32

BindPort returns the machine's API bind port.

func (*MachineContext) ControlPlaneEndpoint

func (c *MachineContext) ControlPlaneEndpoint() (string, error)

ControlPlaneEndpoint returns the control plane endpoint for the cluster. This function first attempts to retrieve the control plane endpoint with ClusterContext.ControlPlaneEndpoint. If no endpoint is returned then this machine's IP address is used as the control plane endpoint if the machine is a control plane node. Otherwise an error is returned.

func (*MachineContext) GetMoRef

GetMoRef returns a managed object reference for the VM associated with the machine. A nil value is returned if the MachineRef is not yet set.

func (*MachineContext) GetObject

func (c *MachineContext) GetObject() runtime.Object

GetObject returns the Machine object.

func (*MachineContext) GetSession

func (c *MachineContext) GetSession() *Session

GetSession returns the login session for this context.

func (*MachineContext) HasControlPlaneRole

func (c *MachineContext) HasControlPlaneRole() bool

HasControlPlaneRole returns a flag indicating whether or not a machine has the control plane role.

func (*MachineContext) IPAddr

func (c *MachineContext) IPAddr() string

IPAddr returns the machine's first IP address.

func (*MachineContext) Patch

func (c *MachineContext) Patch() error

Patch updates the machine on the API server.

func (*MachineContext) String

func (c *MachineContext) String() string

Strings returns ClusterNamespace/ClusterName/MachineName

type MachineContextParams

type MachineContextParams struct {
	ClusterContextParams
	Machine *clusterv1.Machine
}

MachineContextParams are the parameters needed to create a MachineContext.

type Session

type Session struct {
	*govmomi.Client
	Finder *find.Finder
	// contains filtered or unexported fields
}

Session is a vSphere session with a configured Finder.

func (*Session) FindByInstanceUUID

func (s *Session) FindByInstanceUUID(ctx context.Context, uuid string) (object.Reference, error)

FindByInstanceUUID finds an object by its instance UUID.

func (*Session) FindByUUID

func (s *Session) FindByUUID(ctx context.Context, uuid string) (object.Reference, error)

FindByUUID finds an object by its UUID.

Jump to

Keyboard shortcuts

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