controllers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENV_BMC_CLIENT_ID     = `BMC_CLIENT_ID`
	ENV_BMC_CLIENT_SECRET = `BMC_CLIENT_SECRET`
	ENV_BMC_TOKEN_URL     = `BMC_TOKEN_URL`
	ENV_BMC_ENDPOINT_URL  = `BMC_ENDPOINT_URL`
)
View Source
const (
	ANNOTATION_NAME_BMC_SERVER_ID                = `bmc.api.phoenixnap.com/server_id`
	ANNOTATION_NAME_BMC_CLUSTER_IP_ALLOCATION_ID = `bmc.api.phoenixnap.com/cluster_ip_allocation_id`
	ANNOTATION_NAME_BMC_CLUSTER_IP               = `bmc.api.phoenixnap.com/cluster_ip`
)

Variables

View Source
var (
	EventTypeNormal  = `Normal`
	EventTypeWarning = `Warning`

	// UpperCamelCase
	EventReasonCleanupError   = `CleanupError`
	EventReasonCleanupSuccess = `CleanupSuccess`

	EventReasonCreated              = `Created`
	EventReasonCreateError          = `CreateError`
	EventReasonCreateErrorPermanent = `CreateErrorPermanent`
	EventReasonCreateErrorInventory = `CreateErrorInventory`
	EventReasonCreateFailure        = `CreateServerFailure`

	EventReasonResourceOrphaned = `ResourceOrphaned`
	EventReasonPollFailure      = `PollingFailure`
	EventReasonStatusChange     = `StatusChange`

	StatusIrreconcilable = `irreconcilable`
	StatusOrphaned       = `orphaned`
	StatusStale          = `stale`
	StatusPoweredOn      = `powered-on`
	StatusError          = `error`
)

Functions

This section is empty.

Types

type BMCClusterReconciler

type BMCClusterReconciler struct {
	client.Client
	Recorder         record.EventRecorder
	ReconcileTimeout time.Duration
	BMCClientConfig  clientcredentials.Config
	BMCEndpointURL   string
	Scheme           *runtime.Scheme
}

BMCClusterReconciler reconciles a BMCCluster object

func (*BMCClusterReconciler) Reconcile

func (r *BMCClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.12.1/pkg/reconcile

func (*BMCClusterReconciler) SetupWithManager

func (r *BMCClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type BMCCreateServerRequest

type BMCCreateServerRequest struct {
	Hostname              string               `json:"hostname,omitempty"`
	Description           string               `json:"description,omitempty"`
	OS                    bmcv1.ServerOS       `json:"os,omitempty"`
	Type                  bmcv1.ServerType     `json:"type,omitempty"`
	Location              bmcv1.LocationID     `json:"location,omitempty"`
	InstallDefaultSSHKeys *bool                `json:"installDefaultSshKeys"`
	SSHKeyIDs             []string             `json:"sshKeyIds,omitempty"`
	NetworkType           bmcv1.NetworkType    `json:"networkType,omitempty"`
	OSConfiguration       OSConfiguration      `json:"osConfiguration,omitempty"`
	NetworkConfiguration  NetworkConfiguration `json:"networkConfiguration"`
}

BMCCreateServerRequest creates a BMC server

type BMCMachineReconciler

type BMCMachineReconciler struct {
	client.Client
	Recorder         record.EventRecorder
	ReconcileTimeout time.Duration
	BMCClientConfig  clientcredentials.Config
	BMCEndpointURL   string
}

BMCMachineReconciler reconciles a BMCMachine object

func (*BMCMachineReconciler) BMCClusterToBMCMachines

func (r *BMCMachineReconciler) BMCClusterToBMCMachines(ctx context.Context) handler.MapFunc

BMCClusterToBMCMachines adds cluster to machine

func (*BMCMachineReconciler) Reconcile

func (r *BMCMachineReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. Reconcile function to compare the state specified by the BMCMachine object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.12.1/pkg/reconcile

func (*BMCMachineReconciler) SetupWithManager

func (r *BMCMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type CloudInit

type CloudInit struct {
	UserData string `json:"userData,omitempty"`
}

CloudInit configurations of server

type ClusterContext

type ClusterContext struct {
	BMCClient *http.Client
	K8sClient client.Client

	Cluster    *clusterv1.Cluster
	BMCCluster *bmcv1.BMCCluster

	Recorder    record.EventRecorder
	PatchHelper *patch.Helper
}

func (*ClusterContext) AddFini

func (cc *ClusterContext) AddFini()

func (ClusterContext) Event

func (cc ClusterContext) Event(eventtype, reason, message string)

func (ClusterContext) Eventf

func (cc ClusterContext) Eventf(eventtype, reason, messageFmt string, args ...interface{})

func (*ClusterContext) GetBMCStatus

func (cc *ClusterContext) GetBMCStatus() string

func (ClusterContext) GetIPAllocationID

func (cc ClusterContext) GetIPAllocationID() string

func (ClusterContext) HasFini

func (cc ClusterContext) HasFini() bool

func (ClusterContext) IsMarkedDeleted

func (cc ClusterContext) IsMarkedDeleted() bool

func (*ClusterContext) IsReady

func (cc *ClusterContext) IsReady() bool

func (ClusterContext) IsStatusEqual

func (cc ClusterContext) IsStatusEqual(s string) bool

func (*ClusterContext) RemoveFini

func (cc *ClusterContext) RemoveFini()

func (*ClusterContext) SetBMCStatus

func (cc *ClusterContext) SetBMCStatus(s string)

func (*ClusterContext) SetControlPlaneEndpoint

func (cc *ClusterContext) SetControlPlaneEndpoint(host string, port int)

func (*ClusterContext) SetIP

func (cc *ClusterContext) SetIP(ip string)

func (*ClusterContext) SetIPAllocationID

func (cc *ClusterContext) SetIPAllocationID(id string)

func (*ClusterContext) SetReady

func (cc *ClusterContext) SetReady()

func (*ClusterContext) SetStatus

func (cc *ClusterContext) SetStatus(s bmcv1.BMCClusterStatus)

type IPBlock

type IPBlock struct {
	ID string `json:"id,omitempty"`
}

IPBlock configurations of server

type IPBlockRequest

type IPBlockRequest struct {
	CIDRBlockSize string `json:"cidrBlockSize,omitempty"`
	Location      string `json:"location,omitempty"`
	Description   string `json:"description,omitempty"`
}

IPBlockRequest IPBlock configuration

type IPBlocksConfiguration

type IPBlocksConfiguration struct {
	ConfigurationType string    `json:"configurationType,omitempty"`
	IPBlocks          []IPBlock `json:"ipBlocks"`
}

IPBlocksConfiguration configurations of server

type MachineContext

type MachineContext struct {
	BMCClient *http.Client
	K8sClient client.Client

	Recorder record.EventRecorder

	Cluster *clusterv1.Cluster
	Machine *clusterv1.Machine

	BMCCluster *bmcv1.BMCCluster
	BMCMachine *bmcv1.BMCMachine

	PatchHelper *patch.Helper
}

func (*MachineContext) AddFini

func (mc *MachineContext) AddFini()

func (MachineContext) Event

func (mc MachineContext) Event(eventtype, reason, message string)

func (MachineContext) Eventf

func (mc MachineContext) Eventf(eventtype, reason, messageFmt string, args ...interface{})

func (*MachineContext) GetBMCStatus

func (mc *MachineContext) GetBMCStatus() string

func (MachineContext) GetClusterIPAllocationID

func (mc MachineContext) GetClusterIPAllocationID() string

func (MachineContext) GetDataSecretValue

func (mc MachineContext) GetDataSecretValue(ctx context.Context) (string, error)

func (*MachineContext) GetHostname

func (mc *MachineContext) GetHostname() string

func (MachineContext) GetMachineID

func (mc MachineContext) GetMachineID() string

func (MachineContext) HasFini

func (mc MachineContext) HasFini() bool

func (MachineContext) IsControlPlaneMachine

func (mc MachineContext) IsControlPlaneMachine() bool

func (MachineContext) IsDataSecretReady

func (mc MachineContext) IsDataSecretReady() bool

func (MachineContext) IsInfrastructureReady

func (mc MachineContext) IsInfrastructureReady() bool

func (MachineContext) IsMarkedDeleted

func (mc MachineContext) IsMarkedDeleted() bool

func (*MachineContext) IsReady

func (mc *MachineContext) IsReady() bool

func (MachineContext) IsStatusEqual

func (mc MachineContext) IsStatusEqual(s string) bool

func (*MachineContext) MergeBMCStatusProperties

func (mc *MachineContext) MergeBMCStatusProperties(s bmcv1.BMCMachineStatus)

func (*MachineContext) RemoveFini

func (mc *MachineContext) RemoveFini()

func (*MachineContext) SetBMCStatus

func (mc *MachineContext) SetBMCStatus(s string)

func (*MachineContext) SetIrreconcilable

func (mc *MachineContext) SetIrreconcilable(err apierrors.MachineStatusError, msg string)

func (*MachineContext) SetMachineID

func (mc *MachineContext) SetMachineID(id string)

func (*MachineContext) SetReady

func (mc *MachineContext) SetReady()

func (*MachineContext) SetStatus

func (mc *MachineContext) SetStatus(s bmcv1.BMCMachineStatus)

type NetworkConfiguration

type NetworkConfiguration struct {
	IPBlocksConfiguration IPBlocksConfiguration `json:"ipBlocksConfiguration,omitempty"`
}

NetworkConfiguration configurations of server

type OSConfiguration

type OSConfiguration struct {
	CloudInit CloudInit `json:"cloudInit,omitempty"`
}

OSConfiguration configurations of server

type Status

type Status string

Jump to

Keyboard shortcuts

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