Documentation ¶
Index ¶
- Variables
- func InitData()
- func New(id any, opts ...funcopt.O) (any, error)
- func NewCfg(p any, opts ...funcopt.O) (*cfg, error)
- func NewList(paths naming.Paths, opts ...funcopt.O) ([]any, error)
- func NewSec(p any, opts ...funcopt.O) (*sec, error)
- func NewSvc(p naming.Path, opts ...funcopt.O) (*svc, error)
- func NewUsr(p any, opts ...funcopt.O) (*usr, error)
- func NewVol(p any, opts ...funcopt.O) (*vol, error)
- func WithConfigData(b any) funcopt.O
- func WithConfigFile(s string) funcopt.O
- func WithLogger(s *plog.Logger) funcopt.O
- func WithVolatile(s bool) funcopt.O
- type Actor
- type Ccfg
- func (t *Ccfg) App() string
- func (t *Ccfg) Children() []naming.Relation
- func (t *Ccfg) CleanPG(ctx context.Context)
- func (t *Ccfg) Config() *xconfig.T
- func (t *Ccfg) ConfigFile() string
- func (t *Ccfg) DRPNodes() ([]string, error)
- func (t *Ccfg) Delete(ctx context.Context) error
- func (t *Ccfg) DeleteSection(ctx context.Context, rids ...string) error
- func (t *Ccfg) Dereference(ref string) (string, error)
- func (t *Ccfg) DiscardAndEditConfig() error
- func (t *Ccfg) Doc(drvStr, kwStr string) (string, error)
- func (t *Ccfg) DriverDoc(s string) (string, error)
- func (t *Ccfg) EditConfig() error
- func (t *Ccfg) EncapNodes() ([]string, error)
- func (t *Ccfg) Env() string
- func (t *Ccfg) Eval(k key.T) (interface{}, error)
- func (t *Ccfg) EvalAs(k key.T, impersonate string) (interface{}, error)
- func (t *Ccfg) EvalConfig() (rawconfig.T, error)
- func (t *Ccfg) EvalConfigAs(nodename string) (rawconfig.T, error)
- func (t *Ccfg) FQDN() string
- func (t *Ccfg) FlexMax() (int, error)
- func (t *Ccfg) FlexMin() (int, error)
- func (t *Ccfg) FlexTarget() (int, error)
- func (t *Ccfg) FreshStatus(ctx context.Context) (instance.Status, error)
- func (t *Ccfg) Get(k key.T) (interface{}, error)
- func (t *Ccfg) HardAffinity() []string
- func (t *Ccfg) HardAntiAffinity() []string
- func (t *Ccfg) ID() uuid.UUID
- func (t *Ccfg) IsVolatile() bool
- func (t *Ccfg) KeywordDoc(s string) (string, error)
- func (t *Ccfg) KeywordLookup(k key.T, sectionType string) keywords.Keyword
- func (t *Ccfg) List() (string, error)
- func (t *Ccfg) Log() *plog.Logger
- func (t *Ccfg) LogDir() string
- func (t *Ccfg) MonitorStatus(ctx context.Context) (instance.Status, error)
- func (t *Ccfg) Name() string
- func (t *Ccfg) NewCompliance() (*compliance.T, error)
- func (t *Ccfg) Node() (*Node, error)
- func (t *Ccfg) Nodes() ([]string, error)
- func (t *Ccfg) Orchestrate() string
- func (t *Ccfg) Parents() []naming.Relation
- func (t *Ccfg) Path() naming.Path
- func (t *Ccfg) Peers() ([]string, error)
- func (t *Ccfg) Placement() placement.Policy
- func (t *Ccfg) PostCommit() error
- func (t *Ccfg) PrintConfig() (rawconfig.T, error)
- func (t *Ccfg) Priority() priority.T
- func (t *Ccfg) Progress(ctx context.Context, cols ...any)
- func (t *Ccfg) ProgressKey() []string
- func (t *Ccfg) RecoverAndEditConfig() error
- func (t *Ccfg) Set(ctx context.Context, kops ...keyop.T) error
- func (t *Ccfg) SetPostCommit(fn func() error)
- func (t *Ccfg) SetVolatile(v bool)
- func (t *Ccfg) SoftAffinity() []string
- func (t *Ccfg) SoftAntiAffinity() []string
- func (t *Ccfg) Status(ctx context.Context) (instance.Status, error)
- func (t *Ccfg) String() string
- func (t *Ccfg) TmpDir() string
- func (t *Ccfg) Topology() topology.T
- func (t *Ccfg) Unset(ctx context.Context, kws ...key.T) error
- func (t *Ccfg) Update(ctx context.Context, deleteSections []string, unsetKeys []key.T, ...) (err error)
- func (t *Ccfg) ValidateConfig(ctx context.Context) (xconfig.Alerts, error)
- func (t *Ccfg) VarDir() string
- type Cfg
- type Configurer
- type Core
- type Data
- type DataElement
- type Dataer
- type Digest
- type Keystore
- type Node
- func (t Node) App() string
- func (t *Node) Array(name string) array.Driver
- func (t *Node) Arrays() []array.Driver
- func (t *Node) CNIConfig() (string, error)
- func (t *Node) CNIPlugins() (string, error)
- func (t Node) Checks() (check.ResultSet, error)
- func (t *Node) ClusterConfigFile() string
- func (t *Node) Collector3RestAPIURL() (*url.URL, error)
- func (t Node) CollectorComplianceClient() (*collector.Client, error)
- func (t Node) CollectorFeedClient() (*collector.Client, error)
- func (t Node) CollectorInitClient() (*collector.Client, error)
- func (t *Node) CollectorRestAPIClient() *http.Client
- func (t *Node) CollectorRestAPIURL() (*url.URL, error)
- func (t Node) Config() *xconfig.T
- func (t *Node) ConfigFile() string
- func (t *Node) DNSUDSDir() string
- func (t Node) DRPNodes() ([]string, error)
- func (t Node) DeleteSection(s ...string) error
- func (t Node) Dereference(ref string) (string, error)
- func (t Node) DiscardAndEditConfig() error
- func (t *Node) DriverDoc(s string) (string, error)
- func (t Node) Drivers() (interface{}, error)
- func (t Node) EditConfig() error
- func (t Node) EncapNodes() ([]string, error)
- func (t Node) Env() string
- func (t *Node) Eval(ctx context.Context, kw string) (interface{}, error)
- func (t *Node) EvalAs(ctx context.Context, kw string, impersonate string) (interface{}, error)
- func (t *Node) EvalConfig() (rawconfig.T, error)
- func (t *Node) EvalConfigAs(impersonate string) (rawconfig.T, error)
- func (t Node) Exists() bool
- func (t Node) ForceSysreport() error
- func (t *Node) Freeze() error
- func (t *Node) Frozen() time.Time
- func (t *Node) Get(ctx context.Context, kw string) (interface{}, error)
- func (t Node) ID() uuid.UUID
- func (t Node) IsVolatile() bool
- func (t *Node) KeywordDoc(s string) (string, error)
- func (t Node) KeywordLookup(k key.T, sectionType string) keywords.Keyword
- func (t *Node) Labels() map[string]string
- func (t *Node) ListArrays() []string
- func (t *Node) ListPools() []string
- func (t Node) LoadDisks() (disks.Disks, error)
- func (t Node) LoadPatch() ([]patches.Patch, error)
- func (t Node) LoadPkg() ([]packages.Pkg, error)
- func (t Node) LoadSystem() (asset.Data, error)
- func (t Node) Log() *plog.Logger
- func (t *Node) LogDir() string
- func (t Node) MergedConfig() *xconfig.T
- func (t *Node) Nameservers() ([]string, error)
- func (t Node) NewCompliance() (*compliance.T, error)
- func (t Node) Nodes() ([]string, error)
- func (t Node) PRKey() (string, error)
- func (t *Node) Pools() []pool.Pooler
- func (t Node) PostCommit() error
- func (t Node) PrintCapabilities() (capabilities.L, error)
- func (t *Node) PrintConfig() (rawconfig.T, error)
- func (t *Node) PrintSchedule() schedule.Table
- func (t Node) PushAsset() (asset.Data, error)
- func (t Node) PushDisks() (disks.Disks, error)
- func (t Node) PushPatch() ([]patches.Patch, error)
- func (t Node) PushPkg() ([]packages.Pkg, error)
- func (t Node) RecoverAndEditConfig() error
- func (t Node) Register(user, password, app string) error
- func (t Node) ScanCapabilities() (capabilities.L, error)
- func (t *Node) Schedules() schedule.Table
- func (t *Node) Set(ctx context.Context, kops ...keyop.T) error
- func (t *Node) SetVolatile(v bool)
- func (t *Node) ShowPools() pool.StatusList
- func (t *Node) ShowPoolsByName(name string) pool.StatusList
- func (t Node) String() string
- func (t Node) Sysreport() error
- func (t *Node) TmpDir() string
- func (t *Node) Unfreeze() error
- func (t *Node) Unset(ctx context.Context, kws ...key.T) error
- func (t *Node) Update(ctx context.Context, deleteSections []string, unsetKeys []key.T, ...) (err error)
- func (t *Node) ValidateConfig() (xconfig.Alerts, error)
- func (t *Node) VarDir() string
- type Sec
- type SecureKeystore
- type Status
- type Svc
- type Usr
- type UsrDB
- type Vol
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidNode = errors.New("invalid node") ErrDisabled = errors.New("object instance is disabled") )
Functions ¶
func WithConfigData ¶
WithConfigData sets configuration overriding what is installed in the config file Useful for testing volatile services.
func WithConfigFile ¶
WithConfigFile sets a non-standard configuration location.
func WithLogger ¶
WithLogger let the factory user decide what kind of logging he wants
func WithVolatile ¶
WithVolatile makes sure not data is ever written by the object.
Types ¶
type Actor ¶
type Actor interface { Core PG() *pg.Config IsVolatile() bool ResourceSets() resourceset.L ResourceByID(rid string) resource.Driver GetActionResDeps() *actionresdeps.Store ConfigureResources() IsDisabled() bool Boot(context.Context) error Restart(context.Context) error Run(context.Context) error Shutdown(context.Context) error Start(context.Context) error StartStandby(context.Context) error Stop(context.Context) error PRStart(context.Context) error PRStop(context.Context) error Provision(context.Context) error Unprovision(context.Context) error SetProvisioned(context.Context) error SetUnprovisioned(context.Context) error SyncFull(context.Context) error SyncResync(context.Context) error SyncUpdate(context.Context) error Enter(context.Context, string) error PrintSchedule() schedule.Table PushResInfo(context.Context) (resource.Infos, error) // contains filtered or unexported methods }
Actor is implemented by object kinds supporting start, stop, ...
type Ccfg ¶
type Ccfg struct {
// contains filtered or unexported fields
}
Ccfg is the clusterwide configuration store.
The content is the same as node.conf, and is overriden by the definition found in node.conf.
func (*Ccfg) ConfigFile ¶
func (t *Ccfg) ConfigFile() string
ConfigFile returns the absolute path of an opensvc object configuration file.
func (*Ccfg) DRPNodes ¶
DRPNodes implements DRPNodes() ([]string, error) to retrieve cluster drpnodes from config cluster.drpnodes This is required because embedded implementation from core is not valid for ccfg
func (*Ccfg) DeleteSection ¶
DeleteSection deletes a resource section from object.
TODO: Fix/verify following doc If no resource selector is set, remove all etc, var and log file belonging to the object.
If a resource selector is set, only delete the corresponding sections in the configuration file.
func (*Ccfg) Dereference ¶
func (*Ccfg) DiscardAndEditConfig ¶
func (t *Ccfg) DiscardAndEditConfig() error
func (*Ccfg) DriverDoc ¶
DriverDoc returns the documentation of all keywords of the specified driver.
func (*Ccfg) EditConfig ¶
func (t *Ccfg) EditConfig() error
func (*Ccfg) EncapNodes ¶
func (*Ccfg) EvalConfig ¶
func (*Ccfg) FlexTarget ¶
func (*Ccfg) HardAffinity ¶
func (t *Ccfg) HardAffinity() []string
func (*Ccfg) HardAntiAffinity ¶
func (t *Ccfg) HardAntiAffinity() []string
func (*Ccfg) IsVolatile ¶
func (t *Ccfg) IsVolatile() bool
func (*Ccfg) KeywordDoc ¶
KeywordDoc returns the documentation of a single keyword.
func (*Ccfg) KeywordLookup ¶
func (*Ccfg) MonitorStatus ¶
func (*Ccfg) NewCompliance ¶
func (t *Ccfg) NewCompliance() (*compliance.T, error)
func (*Ccfg) Node ¶
Node returns a cache Node struct pointer. If none is already cached, allocate a new Node{} and cache it.
func (*Ccfg) Nodes ¶
Nodes implements Nodes() ([]string, error) to retrieve cluster nodes from config cluster.nodes This is required because embedded implementation from core is not valid for ccfg
func (*Ccfg) Orchestrate ¶
func (t *Ccfg) Orchestrate() string
func (*Ccfg) PostCommit ¶
func (t *Ccfg) PostCommit() error
func (*Ccfg) PrintConfig ¶
PrintConfig gets a keyword value
func (*Ccfg) ProgressKey ¶
func (t *Ccfg) ProgressKey() []string
func (*Ccfg) RecoverAndEditConfig ¶
func (t *Ccfg) RecoverAndEditConfig() error
func (*Ccfg) SetPostCommit ¶
func (t *Ccfg) SetPostCommit(fn func() error)
func (*Ccfg) SetVolatile ¶
func (t *Ccfg) SetVolatile(v bool)
func (*Ccfg) SoftAffinity ¶
func (t *Ccfg) SoftAffinity() []string
func (*Ccfg) SoftAntiAffinity ¶
func (t *Ccfg) SoftAntiAffinity() []string
func (*Ccfg) Update ¶
func (t *Ccfg) Update(ctx context.Context, deleteSections []string, unsetKeys []key.T, keyOps []keyop.T) (err error)
Update updates applies configurations changes in the configuration file.
func (*Ccfg) ValidateConfig ¶
ValidateConfig validates the configuration
type Cfg ¶
type Cfg interface { Keystore }
Cfg is the cfg-kind object.
These objects are unencrypted key-value store. Values can be binary or text.
A Key can be installed as a file in a Vol, then exposed to apps and containers. A Key can be exposed as a environment variable for apps and containers. A Signal can be sent to consumer processes upon exposed key value changes.
type Configurer ¶
type Configurer interface { ConfigFile() string Config() *xconfig.T EditConfig() error RecoverAndEditConfig() error DiscardAndEditConfig() error PrintConfig() (rawconfig.T, error) EvalConfig() (rawconfig.T, error) EvalConfigAs(string) (rawconfig.T, error) Eval(key.T) (interface{}, error) EvalAs(key.T, string) (interface{}, error) Get(key.T) (interface{}, error) ValidateConfig(context.Context) (xconfig.Alerts, error) DeleteSection(context.Context, ...string) error Delete(context.Context) error Set(context.Context, ...keyop.T) error Update(context.Context, []string, []key.T, []keyop.T) error Unset(context.Context, ...key.T) error Doc(string, string) (string, error) DriverDoc(string) (string, error) KeywordDoc(string) (string, error) }
Configurer is implemented by object kinds supporting get, set, unset, eval, edit, ...
func NewConfigurer ¶
func NewConfigurer(p any, opts ...funcopt.O) (Configurer, error)
NewConfigurer returns a Configurer interface from an object path
type Core ¶
type Core interface { Configurer Nodes() ([]string, error) Path() naming.Path FQDN() string FreshStatus(context.Context) (instance.Status, error) MonitorStatus(context.Context) (instance.Status, error) Status(context.Context) (instance.Status, error) // contains filtered or unexported methods }
Core is implemented by all object kinds.
type Data ¶
Data defines a shared holder for all objects Dataer
var ( // StatusData is the package data holder for all objects statuses StatusData *Data[Status] )
func (*Data[T]) GetAll ¶
func (c *Data[T]) GetAll() []DataElement[T]
type DataElement ¶
type Digest ¶
type Digest struct { IsCompat bool `json:"is_compat"` Instances instance.StatesList `json:"instances"` Object Status `json:"object"` Path naming.Path `json:"path"` }
Digest is a composite extract of different parts of the cluster status.
func NewStatus ¶
func NewStatus() *Digest
NewStatus allocates and return a struct to host an objet full state dataset.
func (Digest) LoadTreeNode ¶
LoadTreeNode add the tree nodes representing the type instance into another.
type Keystore ¶
type Keystore interface { Core HasKey(name string) bool AddKey(name string, b []byte) error AddKeyFrom(name string, from string) error ChangeKey(name string, b []byte) error ChangeKeyFrom(name string, from string) error DecodeKey(keyname string) ([]byte, error) AllKeys() ([]string, error) MatchingKeys(string) ([]string, error) RemoveKey(name string) error EditKey(name string) error InstallKey(name string) error InstallKeyTo(string, string, *os.FileMode, *os.FileMode, string, string) error }
Keystore is the base interface of sec, cfg and usr objects
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the node struct.
func (*Node) CNIPlugins ¶
func (Node) Checks ¶
Checks finds and runs the check drivers. Results are aggregated and sent to the collector.
func (*Node) ClusterConfigFile ¶
func (Node) CollectorComplianceClient ¶
func (*Node) CollectorRestAPIClient ¶
func (*Node) ConfigFile ¶
func (Node) DeleteSection ¶
DeleteSection removes sections from node config
func (Node) DiscardAndEditConfig ¶
func (*Node) DriverDoc ¶
DriverDoc returns the documentation of all keywords of the specified driver.
func (Node) EditConfig ¶
func (Node) EncapNodes ¶
func (*Node) EvalAs ¶
EvalAs returns a keyword evaluated value, as if the evaluator was another node
func (Node) ForceSysreport ¶
func (*Node) Freeze ¶
Freeze creates a persistant flag file that prevents orchestration of the object instance.
func (Node) IsVolatile ¶
func (*Node) KeywordDoc ¶
KeywordDoc returns the documentation of a single keyword.
func (Node) KeywordLookup ¶
func (*Node) ListArrays ¶
func (Node) MergedConfig ¶
func (*Node) Nameservers ¶
func (Node) NewCompliance ¶
func (t Node) NewCompliance() (*compliance.T, error)
func (Node) PRKey ¶
PRKey returns the SCSI3-PR key stored as node.prkey in the node config. It sets a new key if not found.
func (Node) PostCommit ¶
func (Node) PrintCapabilities ¶
func (t Node) PrintCapabilities() (capabilities.L, error)
PrintCapabilities load and return node capabilities
func (*Node) PrintConfig ¶
PrintConfig gets a keyword value
func (*Node) PrintSchedule ¶
PrintSchedule display the object scheduling table
func (Node) PushAsset ¶
PushAsset assembles the asset inventory data. Each entry value comes from: * overrides (in config) * probes * default (code)
func (Node) RecoverAndEditConfig ¶
func (Node) Register ¶
Register logs in to the collector using the provided user credentials.
If the node is not already known to the collector, a new node uuid is generated by the collector and stored by the agent in the node config as a node.uuid key.
If user credentials are given, the POST /register collector handler is used, and the app code is supported. If no user credentials are given, the "register_node" jsonrpc handler is used, and app code is ignored.
If app is not set, the node is added to any app under the user's responsibility.
func (Node) ScanCapabilities ¶
func (t Node) ScanCapabilities() (capabilities.L, error)
ScanCapabilities scan node capabilities and return new capabilities
func (*Node) SetVolatile ¶
func (*Node) ShowPools ¶
func (t *Node) ShowPools() pool.StatusList
func (*Node) ShowPoolsByName ¶
func (t *Node) ShowPoolsByName(name string) pool.StatusList
func (Node) Sysreport ¶
Sysreport sends an archive of modified files the agent is configured to track, and the list of files deleted since the last call.
The collector is in charge of versioning this information and of reporting on changes.
func (*Node) Unfreeze ¶
Unfreeze removes the persistant flag file that prevents orchestration of the object instance.
func (*Node) Update ¶
func (t *Node) Update(ctx context.Context, deleteSections []string, unsetKeys []key.T, keyOps []keyop.T) (err error)
Update updates applies configurations changes in the configuration file.
func (*Node) ValidateConfig ¶
ValidateConfig node configuration
type Sec ¶
type Sec interface { Keystore SecureKeystore }
Sec is the sec-kind object.
These objects are encrypted key-value store. Values can be binary or text.
A Key can be installed as a file in a Vol, then exposed to apps and containers. A Key can be exposed as a environment variable for apps and containers. A Signal can be sent to consumer processes upon exposed key value changes.
type SecureKeystore ¶
SecureKeystore is implemented by encrypting Keystore object kinds (usr, sec).
type Status ¶
type Status struct { Avail status.T `json:"avail"` FlexTarget int `json:"flex_target,omitempty"` FlexMin int `json:"flex_min,omitempty"` FlexMax int `json:"flex_max,omitempty"` Frozen string `json:"frozen"` Orchestrate string `json:"orchestrate"` Overall status.T `json:"overall"` PlacementPolicy placement.Policy `json:"placement_policy"` PlacementState placement.State `json:"placement_state"` Priority priority.T `json:"priority"` Provisioned provisioned.T `json:"provisioned"` Scope []string `json:"scope"` Topology topology.T `json:"topology"` UpInstancesCount int `json:"up_instances_count"` // Volume specific Pool *string `json:"pool,omitempty"` Size *int64 `json:"size,omitempty"` UpdatedAt time.Time `json:"updated_at"` }
Status contains the object states obtained via aggregation of all instances states. It exists when an instance config exists somewhere
type Svc ¶
type Svc interface { Actor }
Svc is the svc-kind object.
These objects contain front facing resources like app and containers.
type Usr ¶
type Usr interface { Sec }
Usr is the usr-kind object.
These objects contain a opensvc api user grants and credentials. They are required for basic, session and x509 api access, but not for OpenID access (where grants are embedded in the trusted token)
type UsrDB ¶
type UsrDB struct{}
UsrDB implements UserGrants to authenticate user and get its grants
type Vol ¶
type Vol interface { Actor Head() string Device() *device.T HoldersExcept(ctx context.Context, p naming.Path) naming.Paths }
Vol is the vol-kind object.
These objects contain cluster-dependent fs, disk and sync resources.
They are created by feeding a volume resource configuration (cluster independant) to a pool.
Source Files ¶
- actor.go
- actor_boot.go
- actor_edit_config.go
- actor_enter.go
- actor_freeze.go
- actor_print_schedule.go
- actor_provision.go
- actor_prstart.go
- actor_prstop.go
- actor_push_resinfo.go
- actor_restart.go
- actor_run.go
- actor_set.go
- actor_set_provisioned.go
- actor_set_unprovisioned.go
- actor_shutdown.go
- actor_signal.go
- actor_start.go
- actor_startstandby.go
- actor_status.go
- actor_stop.go
- actor_sync_full.go
- actor_sync_resync.go
- actor_sync_update.go
- actor_unprovision.go
- actor_unset.go
- ccfg.go
- cfg.go
- compliance.go
- core.go
- core_action.go
- core_compliance.go
- core_config.go
- core_delete.go
- core_doc.go
- core_edit_config.go
- core_eval.go
- core_get.go
- core_keywords.go
- core_lock.go
- core_paths.go
- core_print_config.go
- core_print_devices.go
- core_purge.go
- core_set.go
- core_status.go
- core_unset.go
- core_update_config.go
- core_validate_config.go
- data.go
- factory.go
- interfaces.go
- keystore.go
- keystore_add.go
- keystore_decode.go
- keystore_edit_key.go
- keystore_install.go
- keystore_keys.go
- keystore_remove.go
- node.go
- node_array.go
- node_capabilities.go
- node_checks.go
- node_collector.go
- node_compliance.go
- node_config.go
- node_delete_section.go
- node_doc.go
- node_drivers.go
- node_edit_config.go
- node_freeze.go
- node_get.go
- node_keywords.go
- node_paths.go
- node_pool.go
- node_print_config.go
- node_print_schedule.go
- node_prkey.go
- node_push_asset.go
- node_push_disks.go
- node_push_patch.go
- node_push_pkg.go
- node_register.go
- node_set.go
- node_sysreport.go
- node_unset.go
- node_update_config.go
- node_validate_config.go
- pg.go
- sec.go
- sec_gencert.go
- sec_pkcs.go
- svc.go
- svc_disable.go
- svc_enable.go
- type_status.go
- usr.go
- vol.go