mirror of
https://github.com/lingble/talos.git
synced 2025-11-01 21:17:54 +00:00
feat: extend node definition used in health checks
Introduce `cluster.NodeInfo` to represent the basic info about a node which can be used in the health checks. This information, where possible, will be populated by the discovery service in following PRs. Part of siderolabs#5554. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
@@ -8,31 +8,22 @@
|
||||
package base
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/talos-systems/talos/pkg/cluster"
|
||||
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
|
||||
)
|
||||
|
||||
type infoWrapper struct {
|
||||
masterNodes []string
|
||||
workerNodes []string
|
||||
|
||||
nodeInfos []cluster.NodeInfo
|
||||
nodeInfosByType map[machine.Type][]cluster.NodeInfo
|
||||
}
|
||||
|
||||
func (wrapper *infoWrapper) Nodes() []string {
|
||||
return append([]string(nil), append(wrapper.masterNodes, wrapper.workerNodes...)...)
|
||||
func (wrapper *infoWrapper) Nodes() []cluster.NodeInfo {
|
||||
return wrapper.nodeInfos
|
||||
}
|
||||
|
||||
func (wrapper *infoWrapper) NodesByType(t machine.Type) []string {
|
||||
switch t {
|
||||
case machine.TypeInit:
|
||||
return nil
|
||||
case machine.TypeControlPlane:
|
||||
return append([]string(nil), wrapper.masterNodes...)
|
||||
case machine.TypeWorker:
|
||||
return append([]string(nil), wrapper.workerNodes...)
|
||||
case machine.TypeUnknown:
|
||||
fallthrough
|
||||
default:
|
||||
panic(fmt.Sprintf("unexpected machine type %v", t))
|
||||
}
|
||||
func (wrapper *infoWrapper) NodesByType(t machine.Type) []cluster.NodeInfo {
|
||||
return wrapper.nodeInfosByType[t]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user