metal3

package
v0.0.0-...-48543c3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	NodePoolFSMCreate = iota
	NodePoolFSMProcessing
	NodePoolFSMSpecChanged
	NodePoolFSMNoop
)
View Source
const (
	BmhDay2ConfigAnnotation        = "bmac.agent-install.openshift.io/day2-configuration-status"
	BmhDetachedAnnotation          = "baremetalhost.metal3.io/detached"
	BmhPausedAnnotation            = "baremetalhost.metal3.io/paused"
	BmhRebootAnnotation            = "reboot.metal3.io"
	BiosUpdateNeededAnnotation     = "hwmgr-plugin.oran.openshift.io/bios-update-needed"
	FirmwareUpdateNeededAnnotation = "hwmgr-plugin.oran.openshift.io/firmware-update-needed"
	BmhNamespaceLabel              = "baremetalhost.metal3.io/namespace"
	BmhAllocatedLabel              = "hwmgr-plugin.oran.openshift.io/allocated"
	Metal3Finalizer                = "preprovisioningimage.metal3.io"
	UpdateReasonBIOSSettings       = "bios-settings-update"
	UpdateReasonFirmware           = "firmware-update"
	ValueTrue                      = "true"
	MetaTypeLabel                  = "label"
	MetaTypeAnnotation             = "annotation"
	OpAdd                          = "add"
	OpRemove                       = "remove"
)
View Source
const (
	LabelPrefixResources = "resources.oran.openshift.io/"
	LabelResourcePoolID  = LabelPrefixResources + "resourcePoolId"
	LabelSiteID          = LabelPrefixResources + "siteId"

	LabelPrefixResourceSelector = "resourceselector.oran.openshift.io/"

	LabelPrefixInterfaces = "interfacelabel.oran.openshift.io/"
)

Variables

View Source
var REPatternInterfaceLabel = regexp.MustCompile(`^` + LabelPrefixInterfaces + `(.*)`)

The following regex pattern is used to find interface labels

View Source
var REPatternResourceSelectorLabel = regexp.MustCompile(`^` + LabelPrefixResourceSelector)

The following regex pattern is used to check resourceselector label pattern

Functions

This section is empty.

Types

type Adaptor

type Adaptor struct {
	client.Client
	NoncachedClient client.Reader
	Scheme          *runtime.Scheme
	Logger          *slog.Logger
	Namespace       string
	AdaptorID       pluginv1alpha1.HardwareManagerAdaptorID
}

func NewAdaptor

func NewAdaptor(client client.Client, noncachedClient client.Reader, scheme *runtime.Scheme, logger *slog.Logger, namespace string) *Adaptor

func (*Adaptor) ApplyPostConfigUpdates

func (a *Adaptor) ApplyPostConfigUpdates(ctx context.Context, bmhName types.NamespacedName, node *hwmgmtv1alpha1.Node) error

func (*Adaptor) CheckNodePoolProgress

func (a *Adaptor) CheckNodePoolProgress(
	ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (full bool, err error)

CheckNodePoolProgress checks to see if a NodePool is fully allocated, allocating additional resources as needed

func (*Adaptor) CreateNode

func (a *Adaptor) CreateNode(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool, cloudID, nodename, nodeId, nodeNs, groupname, hwprofile string) error

CreateNode creates a Node CR with specified attributes

func (*Adaptor) FetchBMHList

func (a *Adaptor) FetchBMHList(
	ctx context.Context,
	site string,
	nodePoolData hwmgmtv1alpha1.NodePoolData,
	allocationStatus BMHAllocationStatus,
	namespace string) (metal3v1alpha1.BareMetalHostList, error)

FetchBMHList retrieves BareMetalHosts filtered by site ID, allocation status, and optional namespace.

func (*Adaptor) GetNodeList

func (a *Adaptor) GetNodeList(ctx context.Context) (*hwmgmtv1alpha1.NodeList, error)

GetNodeList retrieves the node list

func (*Adaptor) GetResourcePools

func (a *Adaptor) GetResourcePools(ctx context.Context, hwmgr *pluginv1alpha1.HardwareManager) ([]invserver.ResourcePoolInfo, int, error)

func (*Adaptor) GetResources

func (*Adaptor) GroupBMHsByResourcePool

func (a *Adaptor) GroupBMHsByResourcePool(unallocatedBMHs metal3v1alpha1.BareMetalHostList) map[string][]metal3v1alpha1.BareMetalHost

GroupBMHsByResourcePool groups unallocated BMHs by resource pool ID.

func (*Adaptor) HandleNodePool

func (a *Adaptor) HandleNodePool(ctx context.Context, hwmgr *pluginv1alpha1.HardwareManager, nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

func (*Adaptor) HandleNodePoolCreate

func (a *Adaptor) HandleNodePoolCreate(
	ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

func (*Adaptor) HandleNodePoolDeletion

func (a *Adaptor) HandleNodePoolDeletion(ctx context.Context, hwmgr *pluginv1alpha1.HardwareManager, nodepool *hwmgmtv1alpha1.NodePool) (bool, error)

func (*Adaptor) HandleNodePoolProcessing

func (a *Adaptor) HandleNodePoolProcessing(
	ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

func (*Adaptor) HandleNodePoolSpecChanged

func (a *Adaptor) HandleNodePoolSpecChanged(
	ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (ctrl.Result, error)

func (*Adaptor) IsBiosUpdateRequired

func (a *Adaptor) IsBiosUpdateRequired(ctx context.Context, bmh *metal3v1alpha1.BareMetalHost, biosSettings pluginv1alpha1.Bios) (bool, error)

func (*Adaptor) IsFirmwareUpdateRequired

func (a *Adaptor) IsFirmwareUpdateRequired(ctx context.Context, bmh *metal3v1alpha1.BareMetalHost, spec pluginv1alpha1.HardwareProfileSpec) (bool, error)

func (*Adaptor) IsNodePoolFullyAllocated

func (a *Adaptor) IsNodePoolFullyAllocated(ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) (bool, error)

IsNodePoolFullyAllocated checks to see if a NodePool CR has been fully allocated

func (*Adaptor) ProcessNewNodePool

func (a *Adaptor) ProcessNewNodePool(ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) error

ProcessNewNodePool processes a new NodePool CR, verifying that there are enough free resources to satisfy the request

func (*Adaptor) ProcessNodePoolAllocation

func (a *Adaptor) ProcessNodePoolAllocation(ctx context.Context, nodepool *hwmgmtv1alpha1.NodePool) error

ProcessNodePoolAllocation allocates BareMetalHosts to a NodePool while ensuring all BMHs are in the same namespace.

func (*Adaptor) ReleaseNodePool

func (a *Adaptor) ReleaseNodePool(ctx context.Context,
	hwmgr *pluginv1alpha1.HardwareManager,
	nodepool *hwmgmtv1alpha1.NodePool) error

ReleaseNodePool frees resources allocated to a NodePool

func (*Adaptor) SetupAdaptor

func (a *Adaptor) SetupAdaptor(mgr ctrl.Manager) error

SetupAdaptor sets up the metal3 adaptor

func (*Adaptor) UpdateNodeStatus

func (a *Adaptor) UpdateNodeStatus(ctx context.Context, info bmhNodeInfo, nodename, hwprofile string, updating bool) error

UpdateNodeStatus updates a Node CR status field with additional node information

type BMHAllocationStatus

type BMHAllocationStatus string

BMHAllocationStatus defines filtering options for FetchBMHList

const (
	AllBMHs         BMHAllocationStatus = "all"
	UnallocatedBMHs BMHAllocationStatus = "unallocated"
	AllocatedBMHs   BMHAllocationStatus = "allocated"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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