scope

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBootstrapDataNotReady = errors.New("error retrieving bootstrap data: linked Machine's bootstrap.dataSecretName is nil")
View Source
var ErrFailureDomainNotFound = errors.New("error no failure domain available")

Functions

func IsControlPlaneReady

func IsControlPlaneReady(ctx context.Context, c clientcmd.ClientConfig) error

Types

type BareMetalMachineScope

type BareMetalMachineScope struct {
	ClusterScope
	Machine          *clusterv1.Machine
	BareMetalMachine *infrav1.BareMetalMachine
}

BareMetalMachineScope defines the basic context for an actuator to operate upon.

func NewBareMetalMachineScope

func NewBareMetalMachineScope(params BareMetalMachineScopeParams) (*BareMetalMachineScope, error)

NewClusterScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*BareMetalMachineScope) Close

func (s *BareMetalMachineScope) Close() error

Close closes the current scope persisting the cluster configuration and status.

func (*BareMetalMachineScope) GetRawBootstrapData

func (m *BareMetalMachineScope) GetRawBootstrapData(ctx context.Context) ([]byte, error)

GetRawBootstrapData returns the bootstrap data from the secret in the BareMetalMachine's bootstrap.dataSecretName.

func (*BareMetalMachineScope) IsBootstrapDataReady

func (m *BareMetalMachineScope) IsBootstrapDataReady(ctx context.Context) bool

func (*BareMetalMachineScope) Name

func (m *BareMetalMachineScope) Name() string

Name returns the BareMetalMachine name.

func (*BareMetalMachineScope) Namespace

func (m *BareMetalMachineScope) Namespace() string

Namespace returns the namespace name.

func (*BareMetalMachineScope) PatchObject

func (m *BareMetalMachineScope) PatchObject(ctx context.Context) error

PatchObject persists the machine spec and status.

func (*BareMetalMachineScope) SetFailureMessage

func (m *BareMetalMachineScope) SetFailureMessage(err error)

func (*BareMetalMachineScope) SetFailureReason

func (m *BareMetalMachineScope) SetFailureReason(reason capierrors.MachineStatusError)

type BareMetalMachineScopeParams

type BareMetalMachineScopeParams struct {
	ClusterScopeParams
	Machine          *clusterv1.Machine
	BareMetalMachine *infrav1.BareMetalMachine
}

ClusterScopeParams defines the input parameters used to create a new Scope.

type ClusterScope

type ClusterScope struct {
	Ctx context.Context
	logr.Logger
	Recorder record.EventRecorder
	Client   client.Client

	Cluster       *clusterv1.Cluster
	HcloudCluster *infrav1.HcloudCluster
	// contains filtered or unexported fields
}

ClusterScope defines the basic context for an actuator to operate upon.

func NewClusterScope

func NewClusterScope(params ClusterScopeParams) (*ClusterScope, error)

NewClusterScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*ClusterScope) ApplyManifestsWithClientConfig

func (s *ClusterScope) ApplyManifestsWithClientConfig(ctx context.Context, c clientcmd.ClientConfig) error

func (*ClusterScope) ClientConfig

func (s *ClusterScope) ClientConfig() (clientcmd.ClientConfig, error)

ClientConfig return a kubernetes client config for the cluster context

func (*ClusterScope) ClientConfigWithAPIEndpoint

func (s *ClusterScope) ClientConfigWithAPIEndpoint(endpoint clusterv1.APIEndpoint) (clientcmd.ClientConfig, error)

func (*ClusterScope) Close

func (s *ClusterScope) Close() error

Close closes the current scope persisting the cluster configuration and status.

func (*ClusterScope) ControlPlaneAPIEndpointPort

func (s *ClusterScope) ControlPlaneAPIEndpointPort() int32

func (*ClusterScope) GetSpecLocations

func (s *ClusterScope) GetSpecLocations() []infrav1.HcloudLocation

func (*ClusterScope) HcloudClient

func (s *ClusterScope) HcloudClient() HcloudClient

func (*ClusterScope) HrobotClient

func (s *ClusterScope) HrobotClient() HrobotClient

func (*ClusterScope) ListMachines

func (s *ClusterScope) ListMachines(ctx context.Context) ([]*clusterv1.Machine, []*infrav1.HcloudMachine, error)

func (*ClusterScope) ManifestsHash

func (s *ClusterScope) ManifestsHash() (string, error)

func (*ClusterScope) Name

func (m *ClusterScope) Name() string

Name returns the HcloudCluster name.

func (*ClusterScope) Namespace

func (m *ClusterScope) Namespace() string

Namespace returns the namespace name.

func (*ClusterScope) SetStatusLocations

func (s *ClusterScope) SetStatusLocations(locations []infrav1.HcloudLocation, networkZone infrav1.HcloudNetworkZone)

type ClusterScopeParams

type ClusterScopeParams struct {
	HcloudClient
	HrobotClient
	Ctx                 context.Context
	HcloudClientFactory HcloudClientFactory
	HrobotClientFactory HrobotClientFactory
	Client              client.Client
	Logger              logr.Logger
	Recorder            record.EventRecorder
	Cluster             *clusterv1.Cluster
	HcloudCluster       *infrav1.HcloudCluster
	Packer              Packer
	Manifests           Manifests
}

ClusterScopeParams defines the input parameters used to create a new Scope.

type HcloudClient

type HcloudClient interface {
	Token() string
	ListLocation(context.Context) ([]*hcloud.Location, error)
	CreateLoadBalancer(context.Context, hcloud.LoadBalancerCreateOpts) (hcloud.LoadBalancerCreateResult, *hcloud.Response, error)
	DeleteLoadBalancer(context.Context, *hcloud.LoadBalancer) (*hcloud.Response, error)
	ListLoadBalancers(context.Context, hcloud.LoadBalancerListOpts) ([]*hcloud.LoadBalancer, error)
	AttachLoadBalancerToNetwork(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerAttachToNetworkOpts) (*hcloud.Action, *hcloud.Response, error)
	GetLoadBalancerTypeByName(context.Context, string) (*hcloud.LoadBalancerType, *hcloud.Response, error)
	AddTargetServerToLoadBalancer(context.Context, hcloud.LoadBalancerAddServerTargetOpts, *hcloud.LoadBalancer) (*hcloud.Action, *hcloud.Response, error)
	DeleteTargetServerOfLoadBalancer(context.Context, *hcloud.LoadBalancer, *hcloud.Server) (*hcloud.Action, *hcloud.Response, error)
	AddServiceToLoadBalancer(context.Context, *hcloud.LoadBalancer, hcloud.LoadBalancerAddServiceOpts) (*hcloud.Action, *hcloud.Response, error)
	ListImages(context.Context, hcloud.ImageListOpts) ([]*hcloud.Image, error)
	CreateServer(context.Context, hcloud.ServerCreateOpts) (hcloud.ServerCreateResult, *hcloud.Response, error)
	ListServers(context.Context, hcloud.ServerListOpts) ([]*hcloud.Server, error)
	GetServerByID(context.Context, int) (*hcloud.Server, *hcloud.Response, error)
	DeleteServer(context.Context, *hcloud.Server) (*hcloud.Response, error)
	ShutdownServer(context.Context, *hcloud.Server) (*hcloud.Action, *hcloud.Response, error)
	CreateVolume(context.Context, hcloud.VolumeCreateOpts) (hcloud.VolumeCreateResult, *hcloud.Response, error)
	ListVolumes(context.Context, hcloud.VolumeListOpts) ([]*hcloud.Volume, error)
	DeleteVolume(context.Context, *hcloud.Volume) (*hcloud.Response, error)
	CreateNetwork(context.Context, hcloud.NetworkCreateOpts) (*hcloud.Network, *hcloud.Response, error)
	ListNetworks(context.Context, hcloud.NetworkListOpts) ([]*hcloud.Network, error)
	DeleteNetwork(context.Context, *hcloud.Network) (*hcloud.Response, error)
	ListSSHKeys(ctx context.Context, opts hcloud.SSHKeyListOpts) ([]*hcloud.SSHKey, *hcloud.Response, error)
}

HcloudClient collects all methods used by the controller in the hcloud cloud API

type HcloudClientFactory

type HcloudClientFactory func(context.Context) (HcloudClient, error)

type HrobotClient

type HrobotClient interface {
	UserName() string
	Password() string
	ResetBMServer(string, string) (*models.ResetPost, error)
	ListBMServers() ([]models.Server, error)
	ActivateRescue(string, string) (*models.Rescue, error)
	ListBMKeys() ([]models.Key, error)
	SetBMServerName(string, string) (*models.Server, error)
	GetBMServer(string) (*models.Server, error)
}

HrobotClient collects all methods used by the controller in the hrobot cloud API

type HrobotClientFactory

type HrobotClientFactory func(context.Context) (HrobotClient, error)

type MachineScope

type MachineScope struct {
	ClusterScope
	Machine       *clusterv1.Machine
	HcloudMachine *infrav1.HcloudMachine
}

MachineScope defines the basic context for an actuator to operate upon.

func NewMachineScope

func NewMachineScope(params MachineScopeParams) (*MachineScope, error)

NewClusterScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*MachineScope) Close

func (s *MachineScope) Close() error

Close closes the current scope persisting the cluster configuration and status.

func (*MachineScope) EnsureImage

func (s *MachineScope) EnsureImage(ctx context.Context, parameters *packerapi.PackerParameters) (*infrav1.HcloudImageID, error)

func (*MachineScope) GetFailureDomain

func (m *MachineScope) GetFailureDomain() (string, error)

func (*MachineScope) GetRawBootstrapData

func (m *MachineScope) GetRawBootstrapData(ctx context.Context) ([]byte, error)

GetRawBootstrapData returns the bootstrap data from the secret in the Machine's bootstrap.dataSecretName.

func (*MachineScope) IsBootstrapDataReady

func (m *MachineScope) IsBootstrapDataReady(ctx context.Context) bool

func (*MachineScope) IsControlPlane

func (m *MachineScope) IsControlPlane() bool

IsControlPlane returns true if the machine is a control plane.

func (*MachineScope) Name

func (m *MachineScope) Name() string

Name returns the HcloudMachine name.

func (*MachineScope) Namespace

func (m *MachineScope) Namespace() string

Namespace returns the namespace name.

func (*MachineScope) PatchObject

func (m *MachineScope) PatchObject(ctx context.Context) error

PatchObject persists the machine spec and status.

type MachineScopeParams

type MachineScopeParams struct {
	ClusterScopeParams
	Machine       *clusterv1.Machine
	HcloudMachine *infrav1.HcloudMachine
}

ClusterScopeParams defines the input parameters used to create a new Scope.

type Manifests

type Manifests interface {
	Apply(ctx context.Context, client clientcmd.ClientConfig, extVar map[string]string) error
	Hash(extVar map[string]string) (string, error)
}

type Packer

type Packer interface {
	EnsureImage(ctx context.Context, log logr.Logger, hc packerapi.HcloudClient, parameters *packerapi.PackerParameters) (*infrav1.HcloudImageID, error)
}

type VolumeScope

type VolumeScope struct {
	ClusterScope
	HcloudVolume *infrav1.HcloudVolume
}

ClusterScope defines the basic context for an actuator to operate upon.

func NewVolumeScope

func NewVolumeScope(params VolumeScopeParams) (*VolumeScope, error)

NewClusterScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.

func (*VolumeScope) Close

func (s *VolumeScope) Close() error

Close closes the current scope persisting the cluster configuration and status.

func (*VolumeScope) GetSpecLocations

func (s *VolumeScope) GetSpecLocations() []infrav1.HcloudLocation

func (*VolumeScope) SetStatusLocations

func (s *VolumeScope) SetStatusLocations(location []infrav1.HcloudLocation, networkZone infrav1.HcloudNetworkZone)

type VolumeScopeParams

type VolumeScopeParams struct {
	ClusterScopeParams
	HcloudVolume *infrav1.HcloudVolume
}

ClusterScopeParams defines the input parameters used to create a new Scope.

Directories

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

Jump to

Keyboard shortcuts

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