Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose BIOS configuration in Server type #89

Merged
merged 10 commits into from
Aug 5, 2024
17 changes: 17 additions & 0 deletions api/v1alpha1/server_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ type BMCAccess struct {
BMCSecretRef v1.LocalObjectReference `json:"bmcSecretRef"`
}

type BootOrder struct {
Name string `json:"name"`
Priority int `json:"priority"`
Device string `json:"device"`
}

type BIOSSettings struct {
Version string `json:"version"`
//maybe use map[string]intstr.IntOrString?!; interface not possible
afritzler marked this conversation as resolved.
Show resolved Hide resolved
Settings map[string]string `json:"settings"`
}

// ServerSpec defines the desired state of a Server.
type ServerSpec struct {
// UUID is the unique identifier for the server.
Expand Down Expand Up @@ -82,6 +94,9 @@ type ServerSpec struct {
// the boot configuration for this server. This field is optional and can be omitted
// if no boot configuration is specified.
BootConfigurationRef *v1.ObjectReference `json:"bootConfigurationRef,omitempty"`

BootOrder []BootOrder `json:"bootOrder,omitempty"`
afritzler marked this conversation as resolved.
Show resolved Hide resolved
BIOS []BIOSSettings `json:"BIOS,omitempty"`
}

// ServerState defines the possible states of a server.
Expand Down Expand Up @@ -139,6 +154,8 @@ type ServerStatus struct {
// NetworkInterfaces is a list of network interfaces associated with the server.
NetworkInterfaces []NetworkInterface `json:"networkInterfaces,omitempty"`

BIOS BIOSSettings `json:"BIOS,omitempty"`
afritzler marked this conversation as resolved.
Show resolved Hide resolved

// Conditions represents the latest available observations of the server's current state.
// +patchStrategy=merge
// +patchMergeKey=type
Expand Down
52 changes: 51 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 55 additions & 2 deletions bmc/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ type BMC interface {
Reset() error

// SetPXEBootOnce sets the boot device for the next system boot.
SetPXEBootOnce(systemID string) error
SetPXEBootOnce(systemUUID string) error

// GetSystemInfo retrieves information about the system.
GetSystemInfo(systemID string) (SystemInfo, error)
GetSystemInfo(systemUUID string) (SystemInfo, error)

// Logout closes the BMC client connection by logging out
Logout()
Expand All @@ -33,6 +33,59 @@ type BMC interface {

// GetManager returns the manager
GetManager() (*Manager, error)

GetBootOrder(systemUUID string) ([]string, error)

GetBiosSettings(systemUUID string, attributes map[string]string) (Bios, error)

SetBiosSettings(systemUUID string, attributes map[string]string) error

GetBiosVersion(systemUUID string) (string, error)

SetBootOrder(systemUUID string, order []string) error
}

type Bios struct {
Version string
Settings map[string]string
}

type RegistryEntryAttributes struct {
AttributeName string
CurrentValue interface{}
DisplayName string
DisplayOrder int
HelpText string
Hidden bool
Immutable bool
MaxLength int
MenuPath string
MinLength int
ReadOnly bool
ResetRequired bool
Type string
WriteOnly bool
}

type RegistryEntry struct {
Attributes []RegistryEntryAttributes
}

// BiosRegistry describes the Message Registry file locator Resource.
type BiosRegistry struct {
common.Entity
// ODataContext is the odata context.
ODataContext string `json:"@odata.context"`
// ODataType is the odata type.
ODataType string `json:"@odata.type"`
// Description provides a description of this resource.
Description string
// Languages is the RFC5646-conformant language codes for the
// available Message Registries.
Languages []string
// Registry shall contain the Message Registry name and it major and
// minor versions, as defined by the Redfish Specification.
RegistryEntries RegistryEntry
}

type NetworkInterface struct {
Expand Down
Loading