Documentation ¶
Overview ¶
Package scope defines cluster and machine scope as well as a repository for the Hetzner API.
Package scope defines cluster and machine scope as well as a repository for the Hetzner API.
Package scope defines cluster and machine scope as well as a repository for the Hetzner API.
Index ¶
- Variables
- func IsControlPlaneReady(ctx context.Context, c clientcmd.ClientConfig) error
- type BareMetalHostScope
- type BareMetalHostScopeParams
- type BareMetalMachineScope
- func (m *BareMetalMachineScope) Close(ctx context.Context) error
- func (m *BareMetalMachineScope) IsBootstrapReady() bool
- func (m *BareMetalMachineScope) IsControlPlane() bool
- func (m *BareMetalMachineScope) Name() string
- func (m *BareMetalMachineScope) Namespace() string
- func (m *BareMetalMachineScope) PatchObject(ctx context.Context) error
- type BareMetalMachineScopeParams
- type BareMetalRemediationScope
- type BareMetalRemediationScopeParams
- type ClusterScope
- func (s *ClusterScope) ClientConfig(ctx context.Context) (clientcmd.ClientConfig, error)
- func (s *ClusterScope) ClientConfigWithAPIEndpoint(ctx context.Context, endpoint clusterv1.APIEndpoint) (clientcmd.ClientConfig, error)
- func (s *ClusterScope) Close(ctx context.Context) error
- func (s *ClusterScope) ControlPlaneAPIEndpointPort() int32
- func (s *ClusterScope) GetSpecRegion() []infrav1.Region
- func (s *ClusterScope) HetznerSecret() *corev1.Secret
- func (s *ClusterScope) ListMachines(ctx context.Context) ([]*clusterv1.Machine, []*infrav1.HCloudMachine, error)
- func (s *ClusterScope) Name() string
- func (s *ClusterScope) Namespace() string
- func (s *ClusterScope) PatchObject(ctx context.Context) error
- func (s *ClusterScope) SetStatusFailureDomain(regions []infrav1.Region)
- type ClusterScopeParams
- type HCloudMachineTemplateScope
- type HCloudMachineTemplateScopeParams
- type HCloudRemediationScope
- func (m *HCloudRemediationScope) Close(ctx context.Context, opts ...patch.Option) error
- func (m *HCloudRemediationScope) Name() string
- func (m *HCloudRemediationScope) Namespace() string
- func (m *HCloudRemediationScope) PatchMachine(ctx context.Context, opts ...patch.Option) error
- func (m *HCloudRemediationScope) PatchObject(ctx context.Context, opts ...patch.Option) error
- func (m *HCloudRemediationScope) ServerIDFromProviderID() (int64, error)
- type HCloudRemediationScopeParams
- type HasRequeueAfterError
- type MachineScope
- func (m *MachineScope) Close(ctx context.Context) error
- func (m *MachineScope) GetFailureDomain() (string, error)
- func (m *MachineScope) GetRawBootstrapData(ctx context.Context) ([]byte, error)
- func (m *MachineScope) HasServerAvailableCondition() bool
- func (m *MachineScope) HasServerTerminatedCondition() bool
- func (m *MachineScope) HasShutdownTimedOut() bool
- func (m *MachineScope) IsBootstrapDataReady() bool
- func (m *MachineScope) IsControlPlane() bool
- func (m *MachineScope) Name() string
- func (m *MachineScope) Namespace() string
- func (m *MachineScope) PatchObject(ctx context.Context) error
- func (m *MachineScope) ServerIDFromProviderID() (int64, error)
- func (m *MachineScope) SetError(message string, reason capierrors.MachineStatusError)
- func (m *MachineScope) SetProviderID(serverID int64)
- func (m *MachineScope) SetReady(ready bool)
- func (m *MachineScope) SetRegion(region string)
- type MachineScopeParams
- type RequeueAfterError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBootstrapDataNotReady return an error if no bootstrap data is ready. ErrBootstrapDataNotReady = errors.New("error retrieving bootstrap data: linked Machine's bootstrap.dataSecretName is nil") // ErrFailureDomainNotFound returns an error if no region is found. ErrFailureDomainNotFound = errors.New("error no failure domain available") // ErrEmptyProviderID indicates an empty providerID. ErrEmptyProviderID = fmt.Errorf("providerID is empty") // ErrInvalidProviderID indicates an invalid providerID. ErrInvalidProviderID = fmt.Errorf("providerID is invalid") // ErrInvalidServerID indicates an invalid serverID. ErrInvalidServerID = fmt.Errorf("serverID is invalid") )
Functions ¶
func IsControlPlaneReady ¶
func IsControlPlaneReady(ctx context.Context, c clientcmd.ClientConfig) error
IsControlPlaneReady returns nil if the control plane is ready.
Types ¶
type BareMetalHostScope ¶
type BareMetalHostScope struct { logr.Logger Client client.Client SecretManager *secretutil.SecretManager RobotClient robotclient.Client SSHClientFactory sshclient.Factory HetznerBareMetalHost *infrav1.HetznerBareMetalHost HetznerCluster *infrav1.HetznerCluster Cluster *clusterv1.Cluster OSSSHSecret *corev1.Secret RescueSSHSecret *corev1.Secret }
BareMetalHostScope defines the basic context for an actuator to operate upon.
func NewBareMetalHostScope ¶
func NewBareMetalHostScope(params BareMetalHostScopeParams) (*BareMetalHostScope, error)
NewBareMetalHostScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.
func (*BareMetalHostScope) GetRawBootstrapData ¶
func (s *BareMetalHostScope) GetRawBootstrapData(ctx context.Context) ([]byte, error)
GetRawBootstrapData returns the bootstrap data from the secret in the Machine's bootstrap.dataSecretName.
func (*BareMetalHostScope) Hostname ¶
func (s *BareMetalHostScope) Hostname() (hostname string)
Hostname returns the desired host name.
func (*BareMetalHostScope) Name ¶
func (s *BareMetalHostScope) Name() string
Name returns the HetznerCluster name.
func (*BareMetalHostScope) Namespace ¶
func (s *BareMetalHostScope) Namespace() string
Namespace returns the namespace name.
type BareMetalHostScopeParams ¶
type BareMetalHostScopeParams struct { Client client.Client Logger logr.Logger HetznerBareMetalHost *infrav1.HetznerBareMetalHost HetznerCluster *infrav1.HetznerCluster Cluster *clusterv1.Cluster RobotClient robotclient.Client SSHClientFactory sshclient.Factory OSSSHSecret *corev1.Secret RescueSSHSecret *corev1.Secret SecretManager *secretutil.SecretManager }
BareMetalHostScopeParams defines the input parameters used to create a new scope.
type BareMetalMachineScope ¶
type BareMetalMachineScope struct { logr.Logger Client client.Client Machine *clusterv1.Machine BareMetalMachine *infrav1.HetznerBareMetalMachine HetznerCluster *infrav1.HetznerCluster HCloudClient hcloudclient.Client // contains filtered or unexported fields }
BareMetalMachineScope defines the basic context for an actuator to operate upon.
func NewBareMetalMachineScope ¶
func NewBareMetalMachineScope(params BareMetalMachineScopeParams) (*BareMetalMachineScope, error)
NewBareMetalMachineScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.
func (*BareMetalMachineScope) Close ¶
func (m *BareMetalMachineScope) Close(ctx context.Context) error
Close closes the current scope persisting the cluster configuration and status.
func (*BareMetalMachineScope) IsBootstrapReady ¶
func (m *BareMetalMachineScope) IsBootstrapReady() bool
IsBootstrapReady checks the readiness of a capi machine's bootstrap data.
func (*BareMetalMachineScope) IsControlPlane ¶
func (m *BareMetalMachineScope) IsControlPlane() bool
IsControlPlane returns true if the machine is a control plane.
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.
type BareMetalMachineScopeParams ¶
type BareMetalMachineScopeParams struct { Logger logr.Logger Client client.Client Machine *clusterv1.Machine BareMetalMachine *infrav1.HetznerBareMetalMachine HetznerCluster *infrav1.HetznerCluster HCloudClient hcloudclient.Client }
BareMetalMachineScopeParams defines the input parameters used to create a new Scope.
type BareMetalRemediationScope ¶
type BareMetalRemediationScope struct { *logr.Logger Client client.Client Machine *clusterv1.Machine BareMetalMachine *infrav1.HetznerBareMetalMachine BareMetalRemediation *infrav1.HetznerBareMetalRemediation // contains filtered or unexported fields }
BareMetalRemediationScope defines the basic context for an actuator to operate upon.
func NewBareMetalRemediationScope ¶
func NewBareMetalRemediationScope(params BareMetalRemediationScopeParams) (*BareMetalRemediationScope, error)
NewBareMetalRemediationScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.
func (*BareMetalRemediationScope) Close ¶
Close closes the current scope persisting the cluster configuration and status.
func (*BareMetalRemediationScope) HasRetriesLeft ¶
func (m *BareMetalRemediationScope) HasRetriesLeft() bool
HasRetriesLeft returns true if the retry limit is greater than retry count.
func (*BareMetalRemediationScope) Name ¶
func (m *BareMetalRemediationScope) Name() string
Name returns the BareMetalMachine name.
func (*BareMetalRemediationScope) Namespace ¶
func (m *BareMetalRemediationScope) Namespace() string
Namespace returns the namespace name.
type BareMetalRemediationScopeParams ¶
type BareMetalRemediationScopeParams struct { Logger *logr.Logger Client client.Client Machine *clusterv1.Machine BareMetalMachine *infrav1.HetznerBareMetalMachine HetznerCluster *infrav1.HetznerCluster BareMetalRemediation *infrav1.HetznerBareMetalRemediation }
BareMetalRemediationScopeParams defines the input parameters used to create a new Scope.
type ClusterScope ¶
type ClusterScope struct { logr.Logger Client client.Client APIReader client.Reader HCloudClient hcloudclient.Client Cluster *clusterv1.Cluster HetznerCluster *infrav1.HetznerCluster // 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) ClientConfig ¶
func (s *ClusterScope) ClientConfig(ctx context.Context) (clientcmd.ClientConfig, error)
ClientConfig return a kubernetes client config for the cluster context.
func (*ClusterScope) ClientConfigWithAPIEndpoint ¶
func (s *ClusterScope) ClientConfigWithAPIEndpoint(ctx context.Context, endpoint clusterv1.APIEndpoint) (clientcmd.ClientConfig, error)
ClientConfigWithAPIEndpoint returns a client config.
func (*ClusterScope) Close ¶
func (s *ClusterScope) Close(ctx context.Context) error
Close closes the current scope persisting the cluster configuration and status.
func (*ClusterScope) ControlPlaneAPIEndpointPort ¶
func (s *ClusterScope) ControlPlaneAPIEndpointPort() int32
ControlPlaneAPIEndpointPort returns the Port of the Kube-api server.
func (*ClusterScope) GetSpecRegion ¶
func (s *ClusterScope) GetSpecRegion() []infrav1.Region
GetSpecRegion returns a region.
func (*ClusterScope) HetznerSecret ¶
func (s *ClusterScope) HetznerSecret() *corev1.Secret
HetznerSecret returns the hetzner secret.
func (*ClusterScope) ListMachines ¶
func (s *ClusterScope) ListMachines(ctx context.Context) ([]*clusterv1.Machine, []*infrav1.HCloudMachine, error)
ListMachines returns HCloudMachines.
func (*ClusterScope) Name ¶
func (s *ClusterScope) Name() string
Name returns the HetznerCluster name.
func (*ClusterScope) Namespace ¶
func (s *ClusterScope) Namespace() string
Namespace returns the namespace name.
func (*ClusterScope) PatchObject ¶
func (s *ClusterScope) PatchObject(ctx context.Context) error
PatchObject persists the machine spec and status.
func (*ClusterScope) SetStatusFailureDomain ¶
func (s *ClusterScope) SetStatusFailureDomain(regions []infrav1.Region)
SetStatusFailureDomain sets the region for the status.
type ClusterScopeParams ¶
type ClusterScopeParams struct { Client client.Client APIReader client.Reader Logger logr.Logger HetznerSecret *corev1.Secret HCloudClient hcloudclient.Client Cluster *clusterv1.Cluster HetznerCluster *infrav1.HetznerCluster }
ClusterScopeParams defines the input parameters used to create a new scope.
type HCloudMachineTemplateScope ¶
type HCloudMachineTemplateScope struct { *logr.Logger Client client.Client HCloudClient hcloudclient.Client HCloudMachineTemplate *infrav1.HCloudMachineTemplate // contains filtered or unexported fields }
HCloudMachineTemplateScope defines the basic context for an actuator to operate upon.
func NewHCloudMachineTemplateScope ¶
func NewHCloudMachineTemplateScope(params HCloudMachineTemplateScopeParams) (*HCloudMachineTemplateScope, error)
NewHCloudMachineTemplateScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.
func (*HCloudMachineTemplateScope) Close ¶
func (s *HCloudMachineTemplateScope) Close(ctx context.Context) error
Close closes the current scope persisting the cluster configuration and status.
func (*HCloudMachineTemplateScope) Name ¶
func (s *HCloudMachineTemplateScope) Name() string
Name returns the HCloudMachineTemplate name.
func (*HCloudMachineTemplateScope) Namespace ¶
func (s *HCloudMachineTemplateScope) Namespace() string
Namespace returns the namespace name.
func (*HCloudMachineTemplateScope) PatchObject ¶
func (s *HCloudMachineTemplateScope) PatchObject(ctx context.Context) error
PatchObject persists the machine spec and status.
type HCloudMachineTemplateScopeParams ¶
type HCloudMachineTemplateScopeParams struct { Client client.Client Logger *logr.Logger HCloudClient hcloudclient.Client HCloudMachineTemplate *infrav1.HCloudMachineTemplate }
HCloudMachineTemplateScopeParams defines the input parameters used to create a new scope.
type HCloudRemediationScope ¶
type HCloudRemediationScope struct { logr.Logger Client client.Client HCloudClient hcloudclient.Client Machine *clusterv1.Machine HCloudMachine *infrav1.HCloudMachine HCloudRemediation *infrav1.HCloudRemediation // contains filtered or unexported fields }
HCloudRemediationScope defines the basic context for an actuator to operate upon.
func NewHCloudRemediationScope ¶
func NewHCloudRemediationScope(params HCloudRemediationScopeParams) (*HCloudRemediationScope, error)
NewHCloudRemediationScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.
func (*HCloudRemediationScope) Close ¶
Close closes the current scope persisting the cluster configuration and status.
func (*HCloudRemediationScope) Name ¶
func (m *HCloudRemediationScope) Name() string
Name returns the HCloudMachine name.
func (*HCloudRemediationScope) Namespace ¶
func (m *HCloudRemediationScope) Namespace() string
Namespace returns the namespace name.
func (*HCloudRemediationScope) PatchMachine ¶
PatchMachine persists the machine spec and status.
func (*HCloudRemediationScope) PatchObject ¶
PatchObject persists the remediation spec and status.
func (*HCloudRemediationScope) ServerIDFromProviderID ¶
func (m *HCloudRemediationScope) ServerIDFromProviderID() (int64, error)
ServerIDFromProviderID returns the namespace name.
type HCloudRemediationScopeParams ¶
type HCloudRemediationScopeParams struct { Logger logr.Logger Client client.Client HCloudClient hcloudclient.Client Machine *clusterv1.Machine HCloudMachine *infrav1.HCloudMachine HetznerCluster *infrav1.HetznerCluster HCloudRemediation *infrav1.HCloudRemediation }
HCloudRemediationScopeParams defines the input parameters used to create a new Scope.
type HasRequeueAfterError ¶
type HasRequeueAfterError interface { // GetRequeueAfter gets the duration to wait until the managed object is // requeued for further processing. GetRequeueAfter() time.Duration }
HasRequeueAfterError represents that an actuator managed object should be requeued for further processing after the given RequeueAfter time has passed.
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)
NewMachineScope creates a new Scope from the supplied parameters. This is meant to be called for each reconcile iteration.
func (*MachineScope) Close ¶
func (m *MachineScope) Close(ctx context.Context) error
Close closes the current scope persisting the cluster configuration and status.
func (*MachineScope) GetFailureDomain ¶
func (m *MachineScope) GetFailureDomain() (string, error)
GetFailureDomain returns the machine's failure domain or a default one based on a hash.
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) HasServerAvailableCondition ¶
func (m *MachineScope) HasServerAvailableCondition() bool
HasServerAvailableCondition checks whether ServerAvailable condition is set on true.
func (*MachineScope) HasServerTerminatedCondition ¶
func (m *MachineScope) HasServerTerminatedCondition() bool
HasServerTerminatedCondition checks the whether ServerAvailable condition is false with reason "terminated".
func (*MachineScope) HasShutdownTimedOut ¶
func (m *MachineScope) HasShutdownTimedOut() bool
HasShutdownTimedOut checks the whether the HCloud server is terminated.
func (*MachineScope) IsBootstrapDataReady ¶
func (m *MachineScope) IsBootstrapDataReady() bool
IsBootstrapDataReady checks the readiness of a capi machine's bootstrap data.
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.
func (*MachineScope) ServerIDFromProviderID ¶
func (m *MachineScope) ServerIDFromProviderID() (int64, error)
ServerIDFromProviderID converts the ProviderID (hcloud://NNNN) to the ServerID.
func (*MachineScope) SetError ¶
func (m *MachineScope) SetError(message string, reason capierrors.MachineStatusError)
SetError sets the ErrorMessage and ErrorReason fields on the machine and logs the message. It assumes the reason is invalid configuration, since that is currently the only relevant MachineStatusError choice.
func (*MachineScope) SetProviderID ¶
func (m *MachineScope) SetProviderID(serverID int64)
SetProviderID sets the providerID field on the machine.
func (*MachineScope) SetReady ¶
func (m *MachineScope) SetReady(ready bool)
SetReady sets the ready field on the machine.
func (*MachineScope) SetRegion ¶
func (m *MachineScope) SetRegion(region string)
SetRegion sets the region field on the machine.
type MachineScopeParams ¶
type MachineScopeParams struct { ClusterScopeParams Machine *clusterv1.Machine HCloudMachine *infrav1.HCloudMachine }
MachineScopeParams defines the input parameters used to create a new Scope.
type RequeueAfterError ¶
RequeueAfterError represents that an actuator managed object should be requeued for further processing after the given RequeueAfter time has passed.
func (*RequeueAfterError) Error ¶
func (e *RequeueAfterError) Error() string
Error implements the error interface.
func (*RequeueAfterError) GetRequeueAfter ¶
func (e *RequeueAfterError) GetRequeueAfter() time.Duration
GetRequeueAfter gets the duration to wait until the managed object is requeued for further processing.
func (*RequeueAfterError) Unwrap ¶
func (e *RequeueAfterError) Unwrap() error
Unwrap implements the error interface.