sabakan

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 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 = `` /* 463-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 ValidateTemplate added in v1.14.12

func ValidateTemplate(tmpl *cke.Cluster) error

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

func Query

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

Query send a GraphQL query to sabakan. 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"`
}

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.

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