Documentation ¶
Index ¶
- Constants
- func Has(host *Host, exists bool) bool
- func HostState(state string) (hostState, error)
- func HostStateMap() map[hostState]string
- type Cluster
- func (c *Cluster) Commit(msg string) error
- func (c *Cluster) CreateNewHost(serial string) (*Host, error)
- func (c *Cluster) FetchEtcdDiscoveryToken(etcdDiscoveryUrl string, size int) (string, error)
- func (c *Cluster) GenerateEtcdDiscoveryToken() (string, error)
- func (c *Cluster) GetAllHosts() []*Host
- func (c *Cluster) GetProfileCount() map[string]int
- func (c *Cluster) HostWithSerial(serial string) (*Host, bool)
- func (c *Cluster) StoreEtcdDiscoveryToken(etcdEndpoint, etcdCAFile, token string, size int) error
- func (c *Cluster) Update() error
- type ClusterConfig
- type Host
- type IPMac
Constants ¶
const ( Unknown hostState = iota Configured Installing Running )
Variables ¶
This section is empty.
Functions ¶
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) CreateNewHost ¶
CreateNewHost creates a new host with the given serial.
func (*Cluster) FetchEtcdDiscoveryToken ¶
func (*Cluster) GenerateEtcdDiscoveryToken ¶
func (*Cluster) GetAllHosts ¶
GetAllHosts returns a list of all hosts based on the internal cache.
func (*Cluster) GetProfileCount ¶
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 ¶
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 ¶
type ClusterConfig ¶
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 ¶
HostFromDir takes a path to a host directory within the cluster directory and loads the found configuration. Then the corresponding Host is returned.