Documentation ¶
Index ¶
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 = `` /* 463-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 ValidateTemplate ¶ added in v1.14.12
ValidateTemplate validates cluster template.
Types ¶
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 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"` } `json:"spec"` Status struct { State State `json:"state"` Duration float64 `json:"duration"` } `json:"status"` }
Machine represents a machine registered with sabakan.
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"` }
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 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.