redfish

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("not supported by BMC")

ErrUnsupported indicates the BMC does not support the requested operation.

Functions

func CaptureFingerprint

func CaptureFingerprint(ctx context.Context, url string) (string, error)

CaptureFingerprint connects to a BMC without cert pinning and returns the SHA256 fingerprint of its TLS certificate (for TOFU).

Types

type BootConfig

type BootConfig struct {
	Target         BootTarget
	Enabled        BootEnabled
	Mode           BootMode
	UefiHTTPSource string
}

BootConfig holds the current boot source override configuration.

type BootEnabled

type BootEnabled string

BootEnabled represents a Redfish boot source override enabled mode.

const (
	BootContinuous BootEnabled = "Continuous"
	BootOnce       BootEnabled = "Once"
	BootDisabled   BootEnabled = "Disabled"
)

type BootMode added in v0.1.20

type BootMode string

BootMode represents a Redfish boot source override mode.

const (
	BootModeUEFI BootMode = "UEFI"
)

type BootTarget

type BootTarget string

BootTarget represents a Redfish boot source override target.

const (
	BootTargetPxe      BootTarget = "Pxe"
	BootTargetHdd      BootTarget = "Hdd"
	BootTargetUefiHTTP BootTarget = "UefiHttp"
)

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides Redfish operations against a single BMC. Created via Pool.Get or Dial. Must be closed when no longer needed.

func Dial

func Dial(ctx context.Context, url, certSHA256, user, pass, deviceID string) (*Client, error)

Dial connects to a BMC and returns a ready-to-use Client. It creates a Redfish session (falling back to basic auth) and resolves the device ID. The caller must call Close when done.

func (*Client) Close

func (c *Client) Close()

Close releases the client's Redfish session.

func (*Client) DisableBootOverride

func (c *Client) DisableBootOverride(ctx context.Context) error

DisableBootOverride disables the boot source override. If the BMC does not support disabling, it falls back to setting Hdd/Continuous. Returns ErrUnsupported if neither approach works.

func (*Client) GetBootConfig

func (c *Client) GetBootConfig(ctx context.Context) (BootConfig, error)

GetBootConfig returns the current boot source override configuration.

func (*Client) PowerState

func (c *Client) PowerState(ctx context.Context) (PowerState, error)

PowerState returns the current power state of the system.

func (*Client) Reset

func (c *Client) Reset(ctx context.Context, resetType ResetType) error

Reset sends a ComputerSystem.Reset action.

func (*Client) SetBootOverride

func (c *Client) SetBootOverride(ctx context.Context, target BootTarget, enabled BootEnabled) error

SetBootOverride sets the boot source override target and enabled mode. Returns ErrUnsupported if the BMC does not support the PATCH.

func (*Client) SetHTTPBootOverride added in v0.1.20

func (c *Client) SetHTTPBootOverride(ctx context.Context, bootURL string) error

SetHTTPBootOverride sets a one-time Redfish UEFI HTTP boot override. Returns ErrUnsupported if the BMC does not support the PATCH.

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool manages Redfish clients for multiple BMCs. It reuses sessions to avoid creating and destroying a Redfish session on every reconcile. Safe for concurrent use.

func NewPool

func NewPool() *Pool

NewPool returns a new empty client pool.

func (*Pool) Close

func (p *Pool) Close()

Close closes all cached Clients.

func (*Pool) Get

func (p *Pool) Get(ctx context.Context, url, certSHA256, user, pass, deviceID string) (*Client, error)

Get returns a Client for the given BMC. If a cached Client exists with matching credentials, it is returned. If credentials have changed or no cached Client exists, a new one is created (closing the old one).

type PowerState

type PowerState string

PowerState represents the power state of a Redfish system.

const (
	PowerOn  PowerState = "On"
	PowerOff PowerState = "Off"
)

type Reconciler

type Reconciler struct {
	Client       client.Client
	Pool         *Pool
	FileResolver *netboot.FileResolver
}

func (*Reconciler) Reconcile

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

func (*Reconciler) SetupWithManager

func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error

type ResetType

type ResetType string

ResetType represents a Redfish ComputerSystem.Reset action type.

const (
	ResetForceOff ResetType = "ForceOff"
	ResetOn       ResetType = "On"
)

Jump to

Keyboard shortcuts

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