fleetlock

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HeaderHandler

func HeaderHandler(key, value string, next http.Handler) http.Handler

HeaderHandler returns a handler that requires a given header key/value.

func NewServer

func NewServer(config *Config) (http.Handler, error)

NewServer returns a new fleetlock Server handler

func POSTHandler

func POSTHandler(next http.Handler) http.Handler

POSTHandler returns a handler that requires the POST method.

func ZincatiID added in v0.3.0

func ZincatiID(machineID string) (string, error)

ZincatiID computes the Zincati node ID for a systemd machine ID.

Types

type Config

type Config struct {
	// logger
	Logger *logrus.Logger
}

Config configures a Fleetlock server.

type Message

type Message struct {
	ClientParmas struct {
		ID    string `json:"id"`
		Group string `json:"group"`
	} `json:"client_params"`
}

Message represents a FleetLock protocol client request.

type RebootLease

type RebootLease struct {
	// name and metadata
	Meta metav1.ObjectMeta
	// wrapped coordination client
	Client coordclient.LeasesGetter
	// contains filtered or unexported fields
}

RebootLease uses a Lease to hold a RebootLock.

func (*RebootLease) Get

func (l *RebootLease) Get(ctx context.Context) (*RebootLock, error)

Get reads the RebootLock from the Lease or initializes a Lease.

func (*RebootLease) Name

func (l *RebootLease) Name() string

Name returns the RebootLease namespace and name.

func (*RebootLease) Update

func (l *RebootLease) Update(ctx context.Context, slot *RebootLock) error

Update tries to store the RebootLock into the the Lease.

type RebootLock

type RebootLock struct {
	Holder           string
	LeaseTransitions int32
}

RebootLock represents a node wishing to reboot.

type Reply

type Reply struct {
	// reply identifier
	Kind ReplyKind `json:"kind"`
	// human-friendly reply message
	Value string `json:"value"`
}

Reply represents a Fleetlock protocol reply.

func NewReply

func NewReply(kind ReplyKind, format string, a ...interface{}) Reply

NewReply creates an Reply with a specific kind and a formatted message.

type ReplyKind

type ReplyKind string

ReplyKind is used as a Zincati metrics label.

const (
	KindMethodNotAllowed ReplyKind = "method_not_allowed"
	KindMissingHeader    ReplyKind = "missing_header"
	KindDecodeError      ReplyKind = "decode_error"
	KindInternalError    ReplyKind = "internal_error"
	KindLockHeld         ReplyKind = "lock_held"
)

List of ReplyKind

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements the FleetLock protocol.

func (*Server) DrainNode added in v0.3.0

func (s *Server) DrainNode(ctx context.Context, id string) error

DrainNode matches a Zincati request to a node, cordons the node, and evicts its pods.

func (*Server) UncordonNode added in v0.3.0

func (s *Server) UncordonNode(ctx context.Context, id string) error

UncordonNode uncordons a Kubernetes Node that matches the Zincati request ID.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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