Documentation ¶
Index ¶
- Constants
- Variables
- func MachineToNode(m *Machine, tmpl *cke.Node) *cke.Node
- func NewIntegrator(etcd *clientv3.Client) server.Integrator
- func Repairer(machines []Machine, repairEntries []*cke.RepairQueueEntry, ...) []*cke.RepairQueueEntry
- func ValidateTemplate(tmpl *cke.Cluster) error
- type BMC
- type Generator
- type Machine
- type MachineParams
- type MachineSpec
- type MachineStatus
- type QueryVariables
- type State
Constants ¶
const ( // CKELabelRole is the label name to specify node's role CKELabelRole = "cke.cybozu.com/role" // CKELabelWeight is the label name to specify node's weight CKELabelWeight = "cke.cybozu.com/weight" )
const ( StateUninitialized = State("UNINITIALIZED") StateHealthy = State("HEALTHY") StateUnhealthy = State("UNHEALTHY") StateUnreachable = State("UNREACHABLE") StateUpdating = State("UPDATING") StateRetiring = State("RETIRING") StateRetired = State("RETIRED") )
SabakanState list defined in GraphQL schema.
const GraphQLQuery = `` /* 499-byte string literal not displayed */
GraphQLQuery is GraphQL query to retrieve machine information from sabakan.
const ( // WaitSecs is a context key to pass to change the wait seconds // before removing retired nodes from the cluster. WaitSecs = sabakanContextKey("wait secs") )
Variables ¶
var (
// DefaultWaitRetiredSeconds before removing retired nodes from the cluster.
DefaultWaitRetiredSeconds = 300.0
)
Functions ¶
func MachineToNode ¶
MachineToNode converts sabakan.Machine to cke.Node. Add taints, labels, and annotations according to the rules:
func NewIntegrator ¶
func NewIntegrator(etcd *clientv3.Client) server.Integrator
NewIntegrator returns server.Integrator to add sabakan integration feature to CKE.
func Repairer ¶ added in v1.27.11
func Repairer(machines []Machine, repairEntries []*cke.RepairQueueEntry, rebootEntries []*cke.RebootQueueEntry, nodeStatuses map[string]*cke.NodeStatus, constraints *cke.Constraints) []*cke.RepairQueueEntry
func ValidateTemplate ¶ added in v1.14.12
ValidateTemplate validates cluster template.
Types ¶
type BMC ¶ added in v1.27.11
type BMC struct {
Type string `json:"bmcType"`
}
BMC represents the BMC of a machine registered with sabakan.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates cluster configuration.
func NewGenerator ¶
func NewGenerator(template *cke.Cluster, cstr *cke.Constraints, machines []Machine, clusterStatus *cke.ClusterStatus, currentTime time.Time) *Generator
NewGenerator creates a new Generator. template must have been validated with ValidateTemplate().
func (*Generator) Regenerate ¶
Regenerate regenerates *Cluster using the same set of nodes in the current configuration. This method should be used only when the template is updated and no other changes happen.
func (*Generator) SetWaitSeconds ¶
SetWaitSeconds set seconds before removing retired nodes from the cluster.
type Machine ¶
type Machine struct { Spec MachineSpec `json:"spec"` Status MachineStatus `json:"status"` }
Machine represents a machine registered with sabakan.
func QueryAvailable ¶ added in v1.27.11
QueryAvailable sends a GraphQL query to sabakan to retrieve available machines information. If sabakan URL is not set, this returns (nil, cke.ErrNotFound).
type MachineParams ¶
type MachineParams struct { Labels []struct { Name string `json:"name"` Value string `json:"value"` } `json:"labels"` Racks []int `json:"racks"` Roles []string `json:"roles"` States []State `json:"states"` MinDaysBeforeRetire *int `json:"minDaysBeforeRetire,omitempty"` }
MachineParams is the query parameter type.
func (MachineParams) IsValid ¶
func (mp MachineParams) IsValid() error
IsValid returns non-nil error if mp is not valid.
type MachineSpec ¶ added in v1.27.11
type MachineSpec struct { Serial string `json:"serial"` Labels []struct { Name string `json:"name"` Value string `json:"value"` } `json:"labels"` Rack int `json:"rack"` IndexInRack int `json:"indexInRack"` Role string `json:"role"` IPv4 []string `json:"ipv4"` RegisterDate time.Time `json:"registerDate"` RetireDate time.Time `json:"retireDate"` BMC BMC `json:"bmc"` }
MachineSpec represents the spec of a machine registered with sabakan.
type MachineStatus ¶ added in v1.27.11
MachineStatus represents the status of a machine registered with sabakan.
type QueryVariables ¶
type QueryVariables struct { Having *MachineParams `json:"having"` NotHaving *MachineParams `json:"notHaving"` }
QueryVariables represents the JSON object of the query variables.
func (QueryVariables) IsValid ¶
func (v QueryVariables) IsValid() error
IsValid returns non-nil error if v is not valid.