fish

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package fish is the core module of the Aquarium-Fish system

Index

Constants

View Source
const (
	DefaultDBCleanupInterval = 10 * time.Minute
	DefaultDBCompactInterval = time.Hour
	DefaultLabelRemoveAtMin  = 30 * time.Second
	DefaultLabelRemoveAtMax  = 3 * 24 * time.Hour
)
View Source
const ElectionRoundTime = 30

ElectionRoundTime defines how long the voting round will take in seconds - so cluster nodes will be able to interchange their responses

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterInterface added in v0.8.0

type ClusterInterface interface {
	// Requesting send of Vote to cluster, since it's not a part of DB
	SendVote(vote *typesv2.Vote) error
}

ClusterInterface defines required functions for Fish to run on the cluster

type Config

type Config struct {
	Directory string `json:"directory"` // Where to store database and other useful data (if relative - to CWD)

	APIAddress  string         `json:"api_address"`  // Where to serve Web UI, API & Meta API
	NodeAddress string         `json:"node_address"` // What is the external address of the node
	CPULimit    uint16         `json:"cpu_limit"`    // How many CPU threads Node allowed to use (serve API, ...)
	MemTarget   util.HumanSize `json:"mem_target"`   // What's the target memory utilization by the Node (GC target where it becomes more aggressive)
	ClusterJoin []string       `json:"cluster_join"` // The node addresses to join the cluster

	TLSKey   string `json:"tls_key"`    // TLS PEM private key (if relative - to directory)
	TLSCrt   string `json:"tls_crt"`    // TLS PEM public certificate (if relative - to directory)
	TLSCaCrt string `json:"tls_ca_crt"` // TLS PEM certificate authority certificate (if relative - to directory)

	NodeName        string   `json:"node_name"`        // Last resort in case you need to override the default host node name
	NodeLocation    string   `json:"node_location"`    // Specify cluster node location for multi-dc configurations
	NodeIdentifiers []string `json:"node_identifiers"` // The list of node identifiers which could be used to find the right Node for Resource
	NodeSlotsLimit  uint     `json:"node_slots_limit"` // Limits the amount of Applications to be executed simultaneously on the node

	DefaultResourceLifetime util.Duration `json:"default_resource_lifetime"` // Sets the lifetime of the resource which will be used if label definition one is not set

	LabelRemoveAtMin util.Duration `json:"label_remove_at_min"` // Minimum duration for temporary labels
	LabelRemoveAtMax util.Duration `json:"label_remove_at_max"` // Maximum duration for temporary labels

	AllocationRetry     uint  `json:"allocation_retry"`       // How many times to retry the allocation in case error happened, default: 3
	ElectedRoundsToWait uint8 `json:"elected_rounds_to_wait"` // Preventive measure for Node failure on ELECTED state, recovers election after this amount of rounds, default: 10

	DBCleanupInterval util.Duration `json:"db_cleanup_interval"` // Defines the database item cleanup interval when Application reached the end of life (by error or deallocated)
	DBCompactInterval util.Duration `json:"db_compact_interval"` // Defines the database compaction interval to get rid of old data on disk periodically

	DisableAuth bool `json:"disable_auth"` // WARNING! For performance testing only, do not use in prod!

	// Configuration for the node drivers, if defined - only the listed ones will be available.
	// Each configuration could instantinate the same driver multiple times by adding instance name
	// separated from driver by slash symbol (like "<driver>/prod" - will create "prod" instance).
	Drivers drivers.ConfigDrivers `json:"drivers"`

	// Monitoring configuration for OpenTelemetry observability
	Monitoring MonitoringConfig `json:"monitoring"`
}

Config defines Fish node configuration

func (*Config) ReadConfigFile

func (c *Config) ReadConfigFile(cfgPath string) error

ReadConfigFile needed to read the config file

type Fish

type Fish struct {

	// Signal to stop the fish
	Quit chan os.Signal
	// contains filtered or unexported fields
}

Fish structure is used to store the node internal state

func New

func New(db *database.Database, cfg *Config) (*Fish, error)

New creates new Fish node

func (*Fish) CleanupDB added in v0.8.0

func (f *Fish) CleanupDB(ctx context.Context)

CleanupDB removing stale Applications and data from database to keep it slim

func (*Fish) Close

func (f *Fish) Close(ctx context.Context)

Close tells the node that the Fish execution need to be stopped

func (*Fish) DB added in v0.8.2

func (f *Fish) DB() *database.Database

GetNode returns current Fish node spec

func (*Fish) GetCfg added in v0.8.0

func (f *Fish) GetCfg() Config

GetCfg returns fish configuration

func (*Fish) GetMonitor added in v0.9.0

func (f *Fish) GetMonitor() *monitoring.Monitor

GetMonitor returns the monitoring instance for instrumentation

func (*Fish) Init

func (f *Fish) Init() error

Init initializes the Fish node

func (*Fish) MaintenanceSet added in v0.7.0

func (f *Fish) MaintenanceSet(value bool)

MaintenanceSet sets/unsets the maintenance mode which will not allow to accept the additional Applications

func (*Fish) SetMonitor added in v0.9.0

func (f *Fish) SetMonitor(monitor *monitoring.Monitor)

SetMonitor sets the monitoring instance for the Fish node

func (*Fish) ShutdownDelaySet added in v0.7.0

func (f *Fish) ShutdownDelaySet(delay time.Duration)

ShutdownDelaySet set of how much time to wait before executing the node shutdown operation

func (*Fish) ShutdownSet added in v0.7.0

func (f *Fish) ShutdownSet(value bool)

ShutdownSet tells node it need to execute graceful shutdown operation

func (*Fish) StorageVotesAdd added in v0.8.0

func (f *Fish) StorageVotesAdd(votes []typesv2.Vote)

StorageVotesAdd puts received votes from the cluster to the list

func (*Fish) VoteActiveList added in v0.8.0

func (f *Fish) VoteActiveList() (votes []typesv2.Vote)

VoteAll returns active and related storage votes

type MonitoringConfig added in v0.9.0

type MonitoringConfig = monitoring.Config

MonitoringConfig is an alias for monitoring.Config

Jump to

Keyboard shortcuts

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