context

package
v0.4.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeAsRawExtension added in v0.4.0

func EncodeAsRawExtension(in runtime.Object) (*runtime.RawExtension, error)

EncodeAsRawExtension encodes a runtime.Object as a *runtime.RawExtension.

Types

type ClusterContext

type ClusterContext struct {
	context.Context
	Cluster          *clusterv1.Cluster
	ClusterCopy      *clusterv1.Cluster
	ClusterClient    client.ClusterInterface
	ClusterConfig    *v1alpha1.VsphereClusterProviderSpec
	ClusterStatus    *v1alpha1.VsphereClusterProviderStatus
	CoreClient       corev1.CoreV1Interface
	ControllerClient controllerClient.Client
	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) 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) GetCluster added in v0.4.0

func (c *ClusterContext) GetCluster() *clusterv1.Cluster

GetCluster returns the Cluster object.

func (*ClusterContext) GetClusterProviderSpec added in v0.4.0

func (c *ClusterContext) GetClusterProviderSpec() *v1alpha1.VsphereClusterProviderSpec

GetClusterProviderSpec returns the cluster provider spec.

func (*ClusterContext) GetControlPlaneMachines

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

GetControlPlaneMachines returns the control plane machines for the cluster.

func (*ClusterContext) GetControllerClient added in v0.4.0

func (c *ClusterContext) GetControllerClient() controllerClient.Client

GetControllerClient returns the ControllerClient.

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()

Patch updates the object and its status 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
	ControllerClient controllerClient.Client
	Logger           logr.Logger
}

ClusterContextParams are the parameters needed to create a ClusterContext.

type KubeContext

type KubeContext interface {
	ClusterName() string
	GetClusterProviderSpec() *v1alpha1.VsphereClusterProviderSpec
	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.VsphereMachineProviderSpec
	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()

Patch updates the object and its status 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