cluster

package
v0.0.0-...-6295505 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitData

func InitData()

InitData reset package objects data, it can be used for tests.

Types

type BlkStats

type BlkStats struct {
	Read      uint64 `json:"r"`
	ReadByte  uint64 `json:"rb"`
	Write     uint64 `json:"w"`
	WriteByte uint64 `json:"wb"`
}

BlkStats holds block devices resource usage metrics.

type CPUStats

type CPUStats struct {
	Time uint64 `json:"time"`
}

CPUStats holds CPU resource usage metrics.

type Cluster

type Cluster struct {
	Config Config                   `json:"config"`
	Status Status                   `json:"status"`
	Object map[string]object.Status `json:"object"`

	Node map[string]node.Node `json:"node"`
}

type Config

type Config struct {
	ID         string         `json:"id"`
	Name       string         `json:"name"`
	Nodes      Nodes          `json:"nodes"`
	DNS        []string       `json:"dns"`
	CASecPaths []string       `json:"ca_sec_paths"`
	Listener   ConfigListener `json:"listener"`
	Quorum     bool           `json:"quorum"`
	Vip        Vip            `json:"vip"`
	// contains filtered or unexported fields
}

Config describes the cluster id, name and nodes The cluster name is used as the right most part of cluster dns names.

func (*Config) DeepCopy

func (t *Config) DeepCopy() *Config

func (Config) Secret

func (t Config) Secret() string

func (*Config) SetSecret

func (t *Config) SetSecret(s string)

type ConfigListener

type ConfigListener struct {
	CRL             string `json:"crl"`
	Addr            string `json:"addr"`
	Port            int    `json:"port"`
	OpenIDWellKnown string `json:"openid_well_known"`
	DNSSockGID      string `json:"dns_sock_gid"`
	DNSSockUID      string `json:"dns_sock_uid"`
}

type DaemonCollector

type DaemonCollector struct {
	DaemonSubsystemStatus
}

DaemonCollector describes the OpenSVC daemon collector thread, which is responsible for communicating with the collector on behalf of the cluster. Only one node runs a collector thread.

type DaemonDNS

type DaemonDNS struct {
	DaemonSubsystemStatus
}

DaemonDNS describes the OpenSVC daemon dns thread, which is responsible for janitoring and serving the cluster DNS zone. This zone is dynamically populated by ip address allocated for the services (frontend and backend).

type DaemonHb

type DaemonHb struct {
	Streams      []HeartbeatStream `json:"streams"`
	LastMessages []HbLastMessage   `json:"last_messages"`
}

type DaemonListener

type DaemonListener struct {
	DaemonSubsystemStatus
	Config ListenerThreadStatusConfig `json:"config"`
	Stats  ListenerThreadStats        `json:"stats"`
}

DaemonListener describes the OpenSVC daemon listener thread, which is responsible for serving the API.

type DaemonMonitor

type DaemonMonitor struct {
	DaemonSubsystemStatus
}

DaemonMonitor describes the OpenSVC daemon monitor thread state, which is responsible for the node DataSets aggregation and decision-making.

type DaemonScheduler

type DaemonScheduler struct {
	DaemonSubsystemStatus
	Delayed []SchedulerThreadEntry `json:"delayed"`
}

DaemonScheduler describes the OpenSVC daemon scheduler thread state, which is responsible for executing node and objects scheduled jobs.

type DaemonSubsystemStatus

type DaemonSubsystemStatus struct {
	ID           string        `json:"id"`
	ConfiguredAt time.Time     `json:"configured_at"`
	CreatedAt    time.Time     `json:"created_at"`
	State        string        `json:"state"`
	Alerts       []ThreadAlert `json:"alerts,omitempty"`
}

DaemonSubsystemStatus describes a OpenSVC daemon subsystem: when it was last configured, when it was created, its current state and its id.

type Data

type Data struct {
	Cluster Cluster `json:"cluster"`
	Daemon  Deamon  `json:"daemon"`
}

Data describes the full Cluster state.

func (*Data) DeepCopy

func (s *Data) DeepCopy() *Data

func (*Data) GetNodeData

func (s *Data) GetNodeData(nodename string) *node.Node

GetNodeData extracts from the cluster dataset all information relative to node data.

func (*Data) GetNodeStatus

func (s *Data) GetNodeStatus(nodename string) *node.Status

GetNodeStatus extracts from the cluster dataset all information relative to node status.

func (*Data) GetObjectStatus

func (s *Data) GetObjectStatus(p naming.Path) object.Digest

GetObjectStatus extracts from the cluster dataset all information relative to an object.

func (*Data) ObjectPaths

func (s *Data) ObjectPaths() naming.Paths

func (*Data) WithNamespace

func (s *Data) WithNamespace(namespace string) *Data

WithNamespace purges the dataset from objects not matching the namespace

func (*Data) WithSelector

func (s *Data) WithSelector(selector string) *Data

WithSelector purges the dataset from objects not matching the selector expression

type DataT

type DataT[T Dataer] struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DataT defines a shared holder for all objects Dataer

var (
	// ConfigData is the package data holder for local cluster config
	ConfigData *DataT[Config]
)

func NewData

func NewData[T Dataer]() *DataT[T]

func (*DataT[T]) Get

func (c *DataT[T]) Get() *T

func (*DataT[T]) Set

func (c *DataT[T]) Set(v *T)

type Dataer

type Dataer interface {
	Config
}

type Deamon

type Deamon struct {
	Collector DaemonCollector `json:"collector"`
	DNS       DaemonDNS       `json:"dns"`
	Hb        DaemonHb        `json:"hb"`
	Listener  DaemonListener  `json:"listener"`
	Monitor   DaemonMonitor   `json:"monitor"`
	Nodename  string          `json:"nodename"`
	Routines  int             `json:"routines"`
	Scheduler DaemonScheduler `json:"scheduler"`
}

type Frame

type Frame struct {
	Selector string
	Nodes    []string
	Sections []string
	Current  Data
	Previous Data
	Stats    Stats
	// contains filtered or unexported fields
}

Frame exposes daemon status renderer tunables.

func (*Frame) Render

func (f *Frame) Render() string

Render return a string buffer containing a human-friendly representation of Render.

type HbLastMessage

type HbLastMessage struct {
	From string `json:"from"`

	// PatchLength is the type of hb message except when Type is patch where it is the patch queue length
	PatchLength int `json:"patch_length"`

	// Type is the hb message type (unset/ping/full/patch)
	Type string `json:"type"`
}

type HeartbeatPeerStatus

type HeartbeatPeerStatus struct {
	IsBeating bool      `json:"is_beating"`
	LastAt    time.Time `json:"last_at"`
}

HeartbeatPeerStatus describes the status of the communication with a specific peer node.

type HeartbeatStream

type HeartbeatStream struct {
	DaemonSubsystemStatus

	// Type is the heartbeat type example: unicast, ...
	Type string `json:"type"`

	Peers map[string]HeartbeatPeerStatus `json:"peers"`
}

HeartbeatStream describes one OpenSVC daemon heartbeat thread, which is responsible for sending or receiving the node DataSet changes to or from peer nodes.

type ListenerThreadClient

type ListenerThreadClient struct {
	Accepted      uint64 `json:"accepted"`
	AuthValidated uint64 `json:"auth_validated"`
	RX            uint64 `json:"rx"`
	TX            uint64 `json:"tx"`
}

ListenerThreadClient describes the statistics of all session of a single client the api listener.

type ListenerThreadSession

type ListenerThreadSession struct {
	Addr      string    `json:"addr"`
	CreatedAt time.Time `json:"created_at"`
	Encrypted bool      `json:"encrypted"`
	Progress  string    `json:"progress"`
	TID       uint64    `json:"tid"`
}

ListenerThreadSession describes statistics of a session of the api listener.

type ListenerThreadSessions

type ListenerThreadSessions struct {
	Accepted      uint64                           `json:"accepted"`
	AuthValidated uint64                           `json:"auth_validated"`
	RX            uint64                           `json:"rx"`
	TX            uint64                           `json:"tx"`
	Alive         map[string]ListenerThreadSession `json:"alive"`
	Clients       map[string]ListenerThreadClient  `json:"clients"`
}

ListenerThreadSessions describes the sessions statistics of the api listener.

type ListenerThreadStats

type ListenerThreadStats struct {
	Sessions ListenerThreadSessions `json:"sessions"`
}

ListenerThreadStats describes the statistics of the api listener.

type ListenerThreadStatusConfig

type ListenerThreadStatusConfig struct {
	Addr net.IP `json:"addr"`
	Port int    `json:"port"`
}

ListenerThreadStatusConfig holds a summary of the listener configuration

type MemStats

type MemStats struct {
	Total uint64 `json:"total"`
}

MemStats holds CPU resource usage metrics.

type NetStats

type NetStats struct {
	Read      uint64 `json:"r"`
	ReadByte  uint64 `json:"rb"`
	Write     uint64 `json:"w"`
	WriteByte uint64 `json:"wb"`
}

NetStats holds network resource usage metrics.

type NodeStatsBundle

type NodeStatsBundle struct {
	Time       time.Time              `json:"time"`
	Collector  ThreadStats            `json:"collector"`
	Daemon     ThreadStats            `json:"daemon"`
	DNS        ThreadStats            `json:"dns"`
	Scheduler  ThreadStats            `json:"scheduler"`
	Listener   ThreadStats            `json:"listener"`
	Monitor    ThreadStats            `json:"monitor"`
	Heartbeats map[string]ThreadStats `json:"-"`
	Objects    map[string]ObjectStats `json:"objects"`
}

NodeStatsBundle embeds all daemon threads and each objet system resource usage metrics.

func (*NodeStatsBundle) UnmarshalJSON

func (t *NodeStatsBundle) UnmarshalJSON(b []byte) error

UnmarshalJSON loads a byte array into a DaemonStatus struct

type Nodes

type Nodes []string

func (Nodes) Contains

func (t Nodes) Contains(s string) bool

type ObjectStats

type ObjectStats struct {
	Blk       BlkStats  `json:"blk"`
	Net       NetStats  `json:"net"`
	Mem       MemStats  `json:"mem"`
	CPU       CPUStats  `json:"cpu"`
	Tasks     uint64    `json:"tasks"`
	CreatedAt time.Time `json:"created_at"`
}

ObjectStats holds an object (ie cgroup) system resource usage metrics

type SchedulerThreadEntry

type SchedulerThreadEntry struct {
	Action   string    `json:"action"`
	Csum     string    `json:"csum"`
	Path     string    `json:"path"`
	ExpireAt time.Time `json:"expire_at"`
	QueuedAt time.Time `json:"queued_at"`
	Rid      string    `json:"rid"`
}

SchedulerThreadEntry describes a task queued for execution by the opensvc scheduler thread.

type Stats

type Stats map[string]NodeStatsBundle

Stats is a map of node statistics.

type Status

type Status struct {
	IsCompat bool `json:"is_compat"`
	IsFrozen bool `json:"is_frozen"`
}

type ThreadAlert

type ThreadAlert struct {
	Message  string `json:"message"`
	Severity string `json:"severity"`
}

ThreadAlert describes a message with a severity. Embedded in DaemonSubsystemStatus

type ThreadStats

type ThreadStats struct {
	CPU     CPUStats `json:"cpu"`
	Mem     MemStats `json:"mem"`
	Procs   uint64   `json:"procs"`
	Threads uint64   `json:"threads"`
}

ThreadStats holds a daemon thread system resource usage metrics

type Vip

type Vip struct {
	// Default is the default vip configuration value, must be not zero to
	// enable cluster vip
	Default string `json:"default"`
	// Addr is the default vip addr
	Addr string `json:"name"`
	// Netmask is the default vip netmask
	Netmask string `json:"netmask"`
	// Dev is the default vip device
	Dev string `json:"dev"`
	// Devs is a map of node names to custom vip device (when
	// the device for node name is not equal to default vip device)
	Devs map[string]string `json:"devs"`
}

Vip struct describes cluster vip settings

func (*Vip) DeepCopy

func (v *Vip) DeepCopy() *Vip

func (*Vip) Equal

func (v *Vip) Equal(o *Vip) bool

Jump to

Keyboard shortcuts

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