nodes

package
v0.0.1-dev-a64490c Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RoleControl          = "control"
	RoleCompute          = "compute"
	RoleStorage          = "storage"
	RoleControlConverged = "control-converged"
	RoleModerator        = "moderator"
	RoleEdgeCore         = "edge-core"
)
View Source
const (
	Module = "nodes"
)

Variables

View Source
var (
	Control          = newControlRole()
	Compute          = newComputeRole()
	Storage          = newStorageRole()
	ControlConverged = newControlConvergedRole()
	Moderator        = newModeratorRole()
	EdgeCore         = newEdgeCoreRole()

	AllRoles = []*Role{
		Control,
		Compute,
		Storage,
		ControlConverged,
		Moderator,
		EdgeCore,
	}

	AllGeneralRoles = []*Role{
		Control,
		Compute,
		Storage,
		ControlConverged,
	}

	ControlRoles = []*Role{
		Control,
		ControlConverged,
	}

	ComputeRoles = []*Role{
		Compute,
		ControlConverged,
		EdgeCore,
	}
)

Functions

func GenToken

func GenToken(hostname string) string

func GenerateNodeHashByMacAddr

func GenerateNodeHashByMacAddr() (string, error)

func GetCloudRoles

func GetCloudRoles() []string

func GetDiscoveredServices

func GetDiscoveredServices() ([]*registry.Service, error)

func GetEdgeRoles

func GetEdgeRoles() []string

func GetMap

func GetMap() map[string]Node

func GetSecretHeaders

func GetSecretHeaders() map[string]string

func HostnameMap

func HostnameMap() (map[string]Node, error)

func IsCloudRole

func IsCloudRole(role string) bool

func IsEdgeRole

func IsEdgeRole(role string) bool

func IsLocal

func IsLocal(hostname string) bool

func IsLocalAddress

func IsLocalAddress(address string) bool

func SetList

func SetList(nodes []Node)

func Sync

func Sync()

Types

type BlockDevice

type BlockDevice struct {
	Serial       string             `json:"serial"`
	Name         string             `json:"device" yaml:"device" bson:"device"`
	Type         string             `json:"type" yaml:"type" bson:"type"`
	SizeMiB      float64            `json:"sizeMiB" yaml:"sizeMiB" bson:"sizeMiB"`
	Availability string             `json:"availability" yaml:"availability" bson:"availability"`
	Status       status.BlockDevice `json:"status" yaml:"status" bson:"status"`
}

type Host

type Host struct {
	Role string `json:"role,omitzero"`
	Name string `json:"name"`
	Ip   string `json:"ip,omitzero"`
}

func (*Host) GetNode

func (h *Host) GetNode() *Node

type NetworkInterface

type NetworkInterface struct {
	Label       string `json:"label" yaml:"label" bson:"label"`
	BusIdSlaves string `json:"busIdSlaves" yaml:"busIdSlaves" bson:"busIdSlaves"`
	Driver      string `json:"driver" yaml:"driver" bson:"driver"`
	State       string `json:"state" yaml:"state" bson:"state"`
	Speed       string `json:"speed" yaml:"speed" bson:"speed"`
}

type Node

type Node struct {
	Id                string             `json:"id" yaml:"id"`
	SerialNumber      string             `json:"serialNumber" yaml:"serialNumber"`
	DataCenter        string             `json:"dataCenter" yaml:"dataCenter"`
	Hostname          string             `json:"hostname" yaml:"hostname"`
	Role              string             `json:"role" yaml:"role"`
	Protocol          string             `json:"protocol,omitempty" yaml:"protocol,omitempty" bson:"protocol,omitempty"`
	Address           string             `json:"address" yaml:"address"`
	Ip                string             `json:"ip" yaml:"ip"`
	ManagementIP      string             `json:"managementIP" yaml:"managementIP"`
	StorageIP         string             `json:"storageIP" yaml:"storageIP"`
	License           license.Options    `json:"license" yaml:"license,omitempty" bson:"license,omitempty"`
	Status            string             `json:"status" yaml:"status"`
	CpuSpec           string             `json:"cpuSpec" yaml:"cpuSpec" bson:"cpuSpec"`
	NetworkInterfaces []NetworkInterface `json:"networkInterfaces" yaml:"networkInterfaces" bson:"networkInterfaces"`
	BlockDevices      []BlockDevice      `json:"blockDevices" yaml:"blockDevices" bson:"blockDevices"`
	Vcpu              metric.Compute     `json:"vcpu" yaml:"vcpu" bson:"vcpu"`
	Memory            metric.Space       `json:"memory" yaml:"memory" bson:"memory"`
	Storage           metric.Space       `json:"storage" yaml:"storage" bson:"storage"`
	UptimeSeconds     float64            `json:"uptimeSeconds" yaml:"uptimeSeconds" bson:"uptimeSeconds"`
	Labels            map[string]string  `json:"labels,omitempty" yaml:"labels,omitempty" bson:"labels,omitempty"`
}

func Get

func Get(hostname string) (*Node, error)

func GetControlNodes

func GetControlNodes() ([]Node, error)

func GetController

func GetController() (*Node, error)

func GetNodesByRole

func GetNodesByRole(role string) ([]Node, error)

func GetNodesByRoles

func GetNodesByRoles() []Node

func GetPeerControls

func GetPeerControls() ([]Node, error)

func List

func List() []Node

func New

func New(node *registry.Node) Node

func (*Node) CreateSupportFileUrl

func (n *Node) CreateSupportFileUrl(file support.File) string

func (*Node) DeleteModuleRepairingTaskUrl

func (n *Node) DeleteModuleRepairingTaskUrl(module string) string

func (*Node) DeleteRepairingTaskUrl

func (n *Node) DeleteRepairingTaskUrl() string

func (*Node) DownloadSupportFileUrl

func (n *Node) DownloadSupportFileUrl(setname, filename string) string

func (*Node) GenUrl

func (n *Node) GenUrl() string

func (*Node) GetMetricUrl

func (n *Node) GetMetricUrl(metric, view string) string

func (*Node) GetNodeUrl

func (n *Node) GetNodeUrl() string

func (*Node) GetSettingUrl

func (n *Node) GetSettingUrl(path string) string

func (*Node) GetSupportFileUrl

func (n *Node) GetSupportFileUrl() string

func (*Node) GetTuningUrl

func (n *Node) GetTuningUrl() string

func (*Node) IsDown

func (n *Node) IsDown() bool

func (*Node) IsLicenseExpired

func (n *Node) IsLicenseExpired() bool

func (*Node) IsLocal

func (n *Node) IsLocal() bool

func (*Node) IsUnlicensed

func (n *Node) IsUnlicensed() bool

func (*Node) MatchHardwareSerial

func (n *Node) MatchHardwareSerial(hardwareSerials []string) bool

func (*Node) PatchSettingTaskUrl

func (n *Node) PatchSettingTaskUrl(setting settings.Setting) string

func (*Node) PatchSupportFileTaskUrl

func (n *Node) PatchSupportFileTaskUrl(file support.File) string

func (*Node) PatchTriggerTaskUrl

func (n *Node) PatchTriggerTaskUrl(trigger triggers.ApiSchema) string

func (*Node) PatchTuningTaskUrl

func (n *Node) PatchTuningTaskUrl(id string) string

func (*Node) PatchTuningUrl

func (n *Node) PatchTuningUrl(tuning string) string

func (*Node) PostLicenseUrl

func (n *Node) PostLicenseUrl() string

type RawBlockDevice

type RawBlockDevice struct {
	Type        string   `json:"type"`
	Serial      string   `json:"serial"`
	Name        string   `json:"name"`
	Size        string   `json:"size"`
	Rota        bool     `json:"rota"`
	MountPoints []string `json:"mountpoints"`
}

func (*RawBlockDevice) IsBlock

func (r *RawBlockDevice) IsBlock() bool

func (*RawBlockDevice) IsPartition

func (r *RawBlockDevice) IsPartition() bool

func (*RawBlockDevice) NoMountPoints

func (r *RawBlockDevice) NoMountPoints() bool

type RawNetworkInterface

type RawNetworkInterface struct {
	Label       string `json:"label" yaml:"label" bson:"label"`
	BusIdSlaves string `json:"busid" yaml:"busid" bson:"busid"`
	Driver      string `json:"driver" yaml:"driver" bson:"driver"`
	State       string `json:"state" yaml:"state" bson:"state"`
	Speed       string `json:"speed" yaml:"speed" bson:"speed"`
}

type Role

type Role struct {
	Name  string `json:"name" bson:"name"`
	Hosts []Host `json:"hosts" bson:"hosts"`
	Nodes []Node `json:"-"`
}

func GetComputeRole

func GetComputeRole() *Role

func GetControlConvergeRole

func GetControlConvergeRole() *Role

func GetControlRole

func GetControlRole() *Role

func GetControlRoles

func GetControlRoles() []*Role

func GetEdgeCoreRole

func GetEdgeCoreRole() *Role

func GetModeratorRole

func GetModeratorRole() *Role

func GetRole

func GetRole(name string) *Role

func GetStorageRole

func GetStorageRole() *Role

func (*Role) IsNodeEmpty

func (r *Role) IsNodeEmpty() bool

type Selector

type Selector struct {
	Enabled bool              `json:"enabled" yaml:"enabled"`
	Labels  map[string]string `json:"labels" yaml:"labels"`
}

Jump to

Keyboard shortcuts

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