node

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package node contains the controller logic for the Nodes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Setup

func Setup(mgr ctrl.Manager, server *Server, log logging.Logger) error

Setup sets up the controller with the Manager.

Types

type Node

type Node struct {
	Name  string    `json:"name"`
	State NodeState `json:"state"`
}

Node is the state of a node.

type NodeState

type NodeState string
var (
	NodeStateUnknown      NodeState = "unknown"
	NodeStateShuttingDown NodeState = "shutting-down"
)

Node states.

type NodeStateWriter

type NodeStateWriter interface {
	SetNodeState(name string, state NodeState)
	DeleteNodeState(name string)
}

type NopNodeStateWriter

type NopNodeStateWriter struct{}

func (NopNodeStateWriter) DeleteNodeState

func (NopNodeStateWriter) DeleteNodeState(name string)

func (NopNodeStateWriter) SetNodeState

func (NopNodeStateWriter) SetNodeState(name string, state NodeState)

type Reconciler

type Reconciler struct {
	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

Reconciler reconciles a Node object to detect shutdown events and notify Playground pods running on that Node.

func NewReconciler

func NewReconciler(c client.Client, s *runtime.Scheme, opts ...ReconcilerOption) *Reconciler

NewReconciler returns a new Reconciler.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile gets triggered by every event on Node resources.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

ReconcilerOption is a function that sets some option on the Reconciler.

func WithEventRecorder

func WithEventRecorder(e event.Recorder) ReconcilerOption

WithEventRecorder sets the EventRecorder for the Reconciler.

func WithLogger

func WithLogger(l logging.Logger) ReconcilerOption

WithLogger sets the Logger for the Reconciler.

func WithNodeStateWriter

func WithNodeStateWriter(s NodeStateWriter) ReconcilerOption

WithNodeStateWriter sets the NodeStateWriter for the Reconciler.

type Server

type Server struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) DeleteNodeState

func (s *Server) DeleteNodeState(name string)

DeleteNodeState deletes the state of a node from the map.

func (*Server) GetNodeState

func (s *Server) GetNodeState(name string) NodeState

GetNodeState gets the state of a node.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) SetNodeState

func (s *Server) SetNodeState(name string, state NodeState)

SetNodeState sets the state of a node.

Jump to

Keyboard shortcuts

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