sabakan

package
v1.28.4 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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.

View Source
const GraphQLQuery = `` /* 499-byte string literal not displayed */

GraphQLQuery is GraphQL query to retrieve machine information from sabakan.

View Source
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

View Source
var (

	// DefaultWaitRetiredSeconds before removing retired nodes from the cluster.
	DefaultWaitRetiredSeconds = 300.0
)

Functions

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, constraints *cke.Constraints, now time.Time) []*cke.RepairQueueEntry

func ValidateTemplate added in v1.14.12

func ValidateTemplate(tmpl *cke.Cluster) error

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) Generate

func (g *Generator) Generate() (*cke.Cluster, error)

Generate generates a new *Cluster that satisfies constraints.

func (*Generator) Regenerate

func (g *Generator) Regenerate(current *cke.Cluster) (*cke.Cluster, error)

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

func (g *Generator) SetWaitSeconds(secs float64)

SetWaitSeconds set seconds before removing retired nodes from the cluster.

func (*Generator) Update

func (g *Generator) Update(current *cke.Cluster) (*cke.Cluster, error)

Update updates the current configuration when necessary. If the generator decides no updates are necessary, it returns (nil, nil).

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

func QueryAvailable(ctx context.Context, storage cke.Storage) ([]Machine, error)

QueryAvailable sends a GraphQL query to sabakan to retrieve available machines information. If sabakan URL is not set, this returns (nil, cke.ErrNotFound).

func QueryNonHealthy added in v1.27.11

func QueryNonHealthy(ctx context.Context, storage cke.Storage) ([]Machine, error)

QueryNonHealthy sends a GraphQL query to sabakan to retrieve non-healthy 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

type MachineStatus struct {
	State    State   `json:"state"`
	Duration float64 `json:"duration"`
}

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.

type State

type State string

State is the enum type for sabakan states.

func (State) IsValid

func (s State) IsValid() bool

IsValid returns true if s is vaild.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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