nodes

package
v0.0.0-...-0e97e64 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BMC

type BMC struct {
	ID uuid.UUID `json:"id,omitempty" format:"uuid"`
	// XName       xnames.BMCXname `json:"xname,omitempty"`
	Username       string `json:"username" jsonschema:"required"`
	Password       string `json:"password" jsonschema:"required"`
	IPv4Address    string `json:"ipv4_address,omitempty" format:"ipv4"`
	IPv6Address    string `json:"ipv6_address,omitempty" format:"ipv6"`
	MACAddress     string `json:"mac_address" format:"mac-address" binding:"required"`
	Description    string `json:"description,omitempty"`
	LocationString string `json:"location_string,omitempty"`
}

type BootConfiguration

type BootConfiguration struct {
	BootData    BootData  `json:"boot_data,omitempty" db:"boot_data"`
	LastUpdated time.Time `json:"last_updated" db:"last_updated"`
}

type BootData

type BootData struct {
	ID                uuid.UUID `json:"id,omitempty" db:"id"`
	KernelURL         string    `json:"kernel_url,omitempty" db:"kernel_url"`
	KernelCommandLine string    `json:"kernel_command_line,omitempty" db:"kernel_command_line"`
	ImageURL          string    `json:"image_url,omitempty" db:"image_url"`
}

type CloudInitData

type CloudInitData struct {
	ID         uuid.UUID              `json:"id,omitempty" db:"id"`
	UserData   map[string]interface{} `json:"userdata,omitempty" db:"userdata"`
	MetaData   map[string]interface{} `json:"metadata,omitempty" db:"metadata"`
	VendorData map[string]interface{} `json:"vendordata,omitempty" db:"vendordata"`
}

type CollectionConstraint

type CollectionConstraint interface {
	Validate(nodes []xnames.NodeXname) error
}

CollectionConstraint defines methods to enforce constraints on collections.

type CollectionManager

type CollectionManager struct {
	CollectionsByID   map[uuid.UUID]*NodeCollection
	CollectionsByName map[string]*NodeCollection
	Constraints       map[NodeCollectionType][]CollectionConstraint
}

CollectionManager manages collections with constraints.

func NewCollectionManager

func NewCollectionManager() *CollectionManager

func (*CollectionManager) AddConstraint

func (m *CollectionManager) AddConstraint(collectionType NodeCollectionType, constraint CollectionConstraint)

func (*CollectionManager) CreateCollection

func (m *CollectionManager) CreateCollection(collection *NodeCollection) error

func (*CollectionManager) DeleteCollection

func (m *CollectionManager) DeleteCollection(collectionID uuid.UUID) error

func (*CollectionManager) GetCollection

func (m *CollectionManager) GetCollection(identifier string) (*NodeCollection, bool)

func (*CollectionManager) UpdateCollection

func (m *CollectionManager) UpdateCollection(collection *NodeCollection) error

type ComputeNode

type ComputeNode struct {
	ID       uuid.UUID `json:"id,omitempty" db:"id"`
	Hostname string    `json:"hostname" binding:"required" db:"hostname"`
	//XName             xnames.NodeXname   `json:"xname,omitempty" db:"xname"`
	Architecture      string             `json:"architecture" binding:"required" db:"architecture"`
	BootMac           string             `json:"boot_mac,omitempty" format:"mac-address" db:"boot_mac"`
	BootIPv4Address   string             `json:"boot_ipv4_address,omitempty" format:"ipv4" db:"boot_ipv4_address"`
	BootIPv6Address   string             `json:"boot_ipv6_address,omitempty" format:"ipv6" db:"boot_ipv6_address"`
	NetworkInterfaces []NetworkInterface `json:"network_interfaces,omitempty" db:"network_interfaces"`
	BMC               *BMC               `json:"bmc,omitempty" db:"bmc"`
	Description       string             `json:"description,omitempty" db:"description"`
	BootData          *BootData          `json:"boot_data,omitempty" db:"boot_data"`
	LocationString    string             `json:"location_string,omitempty" db:"location_string"`
	Spec              ComputeNodeSpec    `json:"spec,omitempty" db:"spec"`
	Status            ComputeNodeStatus  `json:"status,omitempty" db:"status"`
}

type ComputeNodeSpec

type ComputeNodeSpec struct {
	Hostname          string             `json:"hostname" binding:"required" db:"hostname"`
	BootMac           string             `json:"boot_mac,omitempty" format:"mac-address" db:"boot_mac"`
	BootIPv4Address   string             `json:"boot_ipv4_address,omitempty" format:"ipv4" db:"boot_ipv4_address"`
	BootIPv6Address   string             `json:"boot_ipv6_address,omitempty" format:"ipv6" db:"boot_ipv6_address"`
	BMCEndpoint       string             `json:"bmc_endpoint,omitempty" db:"bmc_endpoint"`
	BMCUsername       string             `json:"bmc_username,omitempty" db:"bmc_username"`
	BMCPassword       string             `json:"bmc_password,omitempty" db:"bmc_password"`
	NetworkInterfaces []NetworkInterface `json:"network_interfaces,omitempty" db:"network_interfaces"`
	BootConfiguration BootData           `json:"boot_configuration,omitempty" db:"boot_configuration"`
}

type ComputeNodeStatus

type ComputeNodeStatus struct {
	PowerState        PowerState             `json:"power_state,omitempty" db:"power_state"`
	BootConfiguration BootConfiguration      `json:"boot_configuration,omitempty" db:"boot_configuration"`
	NetworkInterfaces []NetworkInterface     `json:"network_interfaces,omitempty" db:"network_interfaces"`
	ExtendedData      map[string]interface{} `json:"extended_data,omitempty" db:"extended_data"`
}

type MutualExclusivityConstraint

type MutualExclusivityConstraint struct {
	ExistingNodes map[xnames.NodeXname]uuid.UUID // Map of nodeID to collectionID
}

MutualExclusivityConstraint ensures nodes are only in one collection of this type.

func (*MutualExclusivityConstraint) Validate

func (c *MutualExclusivityConstraint) Validate(nodes []xnames.NodeXname) error

type NetworkInterface

type NetworkInterface struct {
	InterfaceName   string                 `json:"interface_name" binding:"required" db:"interface_name"`
	IPv4Address     string                 `json:"ipv4_address,omitempty" format:"ipv4" db:"ipv4_address"`
	IPv6Address     string                 `json:"ipv6_address,omitempty" format:"ipv6" db:"ipv6_address"`
	MACAddress      string                 `json:"mac_address" format:"mac-address" binding:"required" db:"mac_address"`
	Description     string                 `json:"description,omitempty" db:"description"`
	Serial          string                 `json:"serial,omitempty" db:"serial_number"`
	Model           string                 `json:"model,omitempty" db:"model"`
	Manufacturer    string                 `json:"manufacturer,omitempty" db:"manufacturer"`
	FirmwareVersion string                 `json:"firmware_version,omitempty" db:"firmware_version"`
	ExtendedData    map[string]interface{} `json:"extended_data,omitempty" db:"extended_data"`
}

type NodeCollection

type NodeCollection struct {
	ID             uuid.UUID          `json:"id,omitempty" format:"uuid"`
	CreatorSubject string             `json:"creator_subject,omitempty" format:"email"` // JWT subject of the creator of the collection
	Description    string             `json:"description,omitempty"`
	Name           string             `json:"name"`
	Type           NodeCollectionType `json:"type"`
	Nodes          []xnames.NodeXname `json:"nodes"`                     // List of ComputeNode IDs
	CloudInitData  map[string]string  `json:"cloud_init_data,omitempty"` // Optional cloud-init data for the collection.  It will be available in the payload as `group_{Name}`
}

NodeCollection represents an arbitrary collection of nodes.

func (*NodeCollection) Bind

func (c *NodeCollection) Bind(r *http.Request) error

type NodeCollectionType

type NodeCollectionType string

NodeCollectionType represents the type of a collection.

const (
	DefaultType   NodeCollectionType = "ad-hoc"
	TenantType    NodeCollectionType = "tenant"
	JobType       NodeCollectionType = "job"
	PartitionType NodeCollectionType = "partition"
)

func (NodeCollectionType) JSONSchema

func (NodeCollectionType) JSONSchema() *jsonschema.Schema

JSONSchema for NodeCollectionType to enforce enum and description.

func (NodeCollectionType) String

func (n NodeCollectionType) String() string

String returns the string representation of NodeCollectionType.

type PowerState

type PowerState struct {
	On          bool      `json:"on" db:"on"`
	LastUpdated time.Time `json:"last_updated" db:"last_updated"`
}

Jump to

Keyboard shortcuts

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