hostmgr

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0, Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown hostState = iota
	Configured
	Installing
	Running
)

Variables

This section is empty.

Functions

func Has

func Has(host *Host, exists bool) bool

func HostState

func HostState(state string) (hostState, error)

func HostStateMap

func HostStateMap() map[hostState]string

Types

type Cluster

type Cluster struct {
	Config ClusterConfig
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster(baseDir string, logger micrologger.Logger) (*Cluster, error)

NewCluster creates a new cluster based on the cluster directory.

func OpenCluster

func OpenCluster(baseDir string, logger micrologger.Logger) (*Cluster, error)

func (*Cluster) Commit

func (c *Cluster) Commit(msg string) error

func (*Cluster) CreateNewHost

func (c *Cluster) CreateNewHost(serial string) (*Host, error)

CreateNewHost creates a new host with the given serial.

func (*Cluster) FetchEtcdDiscoveryToken

func (c *Cluster) FetchEtcdDiscoveryToken(etcdDiscoveryUrl string, size int) (string, error)

func (*Cluster) GenerateEtcdDiscoveryToken

func (c *Cluster) GenerateEtcdDiscoveryToken() (string, error)

func (*Cluster) GetAllHosts

func (c *Cluster) GetAllHosts() []*Host

GetAllHosts returns a list of all hosts based on the internal cache.

func (*Cluster) GetProfileCount

func (c *Cluster) GetProfileCount() map[string]int

GetProfileCount returns a matching of profiles and how many of them are known to the cluster. Imagine there is a provile name core. If there are 2 core nodes known to the cluster, the map would look like this.

map[string]int{
  "core": 2,
}

func (*Cluster) HostWithSerial

func (c *Cluster) HostWithSerial(serial string) (*Host, bool)

HostWithSerial returns the host object given by serial based on the internal cache. In case the host could not be found, host is nil and false is returned as second return value.

func (*Cluster) StoreEtcdDiscoveryToken

func (c *Cluster) StoreEtcdDiscoveryToken(etcdEndpoint, etcdCAFile, token string, size int) error

func (*Cluster) Update

func (c *Cluster) Update() error

Update refreshs the internal host cache based on information within the cluster directory.

type ClusterConfig

type ClusterConfig struct {
	DefaultEtcdClusterToken string

	// Deprecated
	EtcdDiscoveryURL string `json:"EtcdDiscoveryURL,omitempty"`
}

type Host

type Host struct {
	Id               int               `json:",omitempty"`
	ProviderId       string            `json:",omitempty"`
	Enabled          bool              `json:",omitempty"`
	Name             string            `json:",omitempty"`
	Serial           string            `json:",omitempty"`
	MacAddresses     []string          `json:",omitempty"`
	InternalAddr     net.IP            `json:",omitempty"`
	AdditionalAddrs  map[string]net.IP `json:",omitempty"`
	IPMIAddr         net.IP            `json:",omitempty"`
	Hostname         string            `json:",omitempty"`
	MachineID        string            `json:",omitempty"`
	LastBoot         time.Time         `json:",omitempty"`
	Profile          string            `json:",omitempty"`
	EtcdClusterToken string            `json:",omitempty"`

	Overrides map[string]interface{} `json:",omitempty"`

	State hostState

	FlatcarVersion string `json:",omitempty"`
	// contains filtered or unexported fields
}

Host represents a node within the mayu cluster.

func HostFromDir

func HostFromDir(hostdir string) (*Host, error)

HostFromDir takes a path to a host directory within the cluster directory and loads the found configuration. Then the corresponding Host is returned.

func (*Host) Save

func (h *Host) Save() error

type IPMac

type IPMac struct {
	IP      net.IP
	MacAddr string
}

Jump to

Keyboard shortcuts

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