Documentation
¶
Index ¶
- Constants
- Variables
- func AcmeChallengeKey(token string) (string, error)
- func CollectorResponseStatusCheck(resp *http.Response, method, path string, wanted []int) error
- func DescribeComputeClaims(m map[string]int64) string
- func GetSecEncryptDecrypter() (encryptDecrypter, error)
- func InitData()
- func IsSecretKey(kind naming.Kind, k key.T, sectionType string) bool
- func KeywordOptions(kind naming.Kind, section string) []string
- func KeywordStoreWithDrivers(kind naming.Kind) keywords.Store
- func ListenerTLSSecs(refs []string) []naming.Path
- func New(p naming.Path, opts ...funcopt.O) (any, error)
- func NewCfg(path naming.Path, opts ...funcopt.O) (*cfg, error)
- func NewList(paths naming.Paths, opts ...funcopt.O) ([]any, error)
- func NewNscfg(path naming.Path, opts ...funcopt.O) (*nscfg, error)
- func NewSec(path naming.Path, opts ...funcopt.O) (*sec, error)
- func NewSvc(path naming.Path, opts ...funcopt.O) (*svc, error)
- func NewT(p naming.Path) any
- func NewUsr(path naming.Path, opts ...funcopt.O) (*usr, error)
- func NewVol(path naming.Path, opts ...funcopt.O) (*vol, error)
- func PGKeywords(kind naming.Kind) []*keywords.Keyword
- func PKCS(privateKeyBytes, certificateChainBytes, passwordBytes []byte) ([]byte, error)
- func RedactSecrets(b []byte, kind string) ([]byte, error)
- func SetClusterConfig() (cluster.Config, error)
- func WithClusterConfigFile(s string) funcopt.O
- 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 ActorStatus
- type ArrayItem
- type ArrayPush
- type Ccfg
- func (t *Ccfg) App() string
- func (t *Ccfg) Cluster() (*Ccfg, error)
- func (t *Ccfg) ComputeClaims() (map[string]int64, error)
- func (t *Ccfg) Config() *xconfig.T
- func (t *Ccfg) ConfigData() any
- 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) Domain() string
- func (t *Ccfg) EditConfig() 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) ID() uuid.UUID
- func (t *Ccfg) IsVolatile() bool
- 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) PGClean(ctx context.Context)
- 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) Priority() priority.T
- func (t *Ccfg) RawConfig() (rawconfig.T, error)
- 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) 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 CertificateRenewOptions
- type CertificateRenewal
- type Cfg
- type CollectorConfigRaw
- type CollectorProblem
- type ComputeClaimer
- type Configurer
- type Core
- type Data
- type DataElement
- type DataStore
- type Dataer
- type Digest
- type FlexStatus
- type KVInstall
- type KVInstallAccessControl
- type KeyStore
- type Migration
- type MigrationRule
- type MigrationRules
- 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(ctx context.Context) (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) CollectorFeeder() (*httphelper.T, error)
- func (t Node) CollectorInitClient() (*collector.Client, error)
- func (t *Node) CollectorRawConfig() *CollectorConfigRaw
- func (t *Node) CollectorRestAPIClient() *http.Client
- func (t *Node) CollectorRestAPIURL() (*url.URL, error)
- func (t *Node) CollectorServer() (*httphelper.T, error)
- func (t *Node) CollectorServerWithAuth(auth string) (*httphelper.T, error)
- func (t *Node) CollectorServerWithoutAuth() (*httphelper.T, error)
- func (t *Node) Config() *xconfig.T
- func (t *Node) ConfigData() any
- 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) Dequeue() error
- func (t *Node) Dereference(ref string) (string, error)
- func (t Node) DiscardAndEditConfig() 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) FrozenScope() freeze.Scope
- 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) KeywordLookup(k key.T, sectionType string) *keywords.Keyword
- func (t *Node) ListArrays() []ArrayItem
- func (t *Node) ListPools() []string
- func (t *Node) ListSwitches() []SwitchItem
- func (t Node) LoadDisks() (disks.Disks, 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) PushArrays(ctx context.Context, name string) ([]ArrayPush, error)
- func (t Node) PushAsset() (asset.Data, error)
- func (t Node) PushAssetDryRun() (asset.Data, error)
- func (t Node) PushDisks() (disks.Disks, error)
- func (t Node) PushDisksDryRun() (disks.Disks, error)
- func (t Node) PushPkg() ([]packages.Pkg, error)
- func (t Node) PushPkgDryRun() ([]packages.Pkg, error)
- func (t *Node) PushStats(ctx context.Context, o PushStatsOptions) (PushStatsResult, error)
- func (t *Node) PushStatsDryRun(ctx context.Context, o PushStatsOptions) (PushStatsResult, error)
- func (t Node) PushSwitches(ctx context.Context, name string) ([]SwitchPush, error)
- func (t *Node) RawConfig() (rawconfig.T, error)
- func (t Node) RecoverAndEditConfig() error
- func (t Node) Register(ctx context.Context, user, password, app string) error
- func (t Node) ScanCapabilities(ctx context.Context) (capabilities.L, error)
- func (t Node) ScanSCSI(ctx context.Context, hba, target, lun string) error
- func (t *Node) Schedules() schedule.Table
- func (t Node) SendSysreport(archive string, deleted []string, full bool) error
- func (t *Node) Set(ctx context.Context, kops ...keyop.T) error
- func (t *Node) SetVolatile(v bool)
- func (t *Node) ShowPools(ctx context.Context) pool.StatusList
- func (t *Node) ShowPoolsByName(ctx context.Context, name string) pool.StatusList
- func (t *Node) Stonith(nodename string) error
- func (t Node) String() string
- func (t *Node) Switch(name string) sanswitch.Driver
- 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 Nscfg
- type PushStatsOptions
- type PushStatsResult
- type QueuedAction
- type QueuedActionDone
- type QueuedActionRunning
- type QueuedActions
- type ResizeOptions
- type ResizePlan
- type ResizeStep
- type Sec
- type Status
- type Svc
- type SwitchItem
- type SwitchPush
- type Usr
- type UsrDB
- type Vol
- type VolStatus
Constants ¶
const ( // AcmeLetsEncrypt is the directory of Let's Encrypt, which // acme.directory = letsencrypt names. AcmeLetsEncrypt = "https://acme-v02.api.letsencrypt.org/directory" // AcmeLetsEncryptStaging is the staging directory of Let's Encrypt, // which acme.directory = letsencrypt-staging names. AcmeLetsEncryptStaging = "https://acme-staging-v02.api.letsencrypt.org/directory" )
const (
// AcmeChallengeKeyPattern matches the keys of the challenge tokens.
AcmeChallengeKeyPattern = acmeChallengeKeyPrefix + "*"
)
const (
DefaultNodeMaxParallel = 10
)
const RedactedValue = redacted
RedactedValue is what a secret value is shown as to a reader not allowed to see it.
Variables ¶
var ( ErrInvalidNode = errors.New("invalid node") ErrDisabled = errors.New("object instance is disabled") ErrEncapAgentNotInstalled = errors.New("opensvc is not installed in the container") )
var ( ErrKeyExist = errors.New("key already exists") ErrKeyEmpty = errors.New("key name is empty") ErrKeyNotExist = errors.New("key does not exist") ErrValueTooBig = errors.New("key value exceeds the allowed size") )
var (
ErrKeyNotFound = errors.New("key not found")
)
var ErrWrongType = errors.New("wrong type provided for interface")
var NodeKeywordStore = keywords.Store(append(nodePrivateKeywords, nodeCommonKeywords...))
var NodeMigrationRules = MigrationRules{ { Doc: "A keyword written under a former name, which om still reads as an alias, " + "is written under its name: node.db_min_ping_interval becomes collector_ping_interval, " + "node.min_avail_mem_pct becomes min_avail_mem, listener.tls_port becomes port, " + "the name of an arbitrator becomes uri, the cmd of a stonith becomes command, " + "and so on for every alias the keyword reference lists.", // contains filtered or unexported fields }, { Doc: "The secret of a pure array becomes its private_key, which names the same secret and reads its private_key key.", // contains filtered or unexported fields }, { Doc: "The ips_per_node of a routed_bridge network becomes mask_per_node, " + "the prefix length of the subnet each node is given, on the address family of its network. " + "A network setting neither is given the mask_per_node the ips_per_node default of 1024 amounts to, " + "so its subnets keep their size.", // contains filtered or unexported fields }, { Doc: "listener.openid_well_known becomes listener.openid_issuer: " + "the url without its /.well-known/openid-configuration end, which om appends itself. " + "An issuer without listener.openid_client_id is reported: om refuses openid logins " + "without the client id om3-webapp is registered with at the provider.", // contains filtered or unexported fields }, { Doc: "The schedule of the brocade section moves to the brocade switch sections that set none, " + "as each switch is inventoried on its own schedule, and the brocade section is deleted.", // contains filtered or unexported fields }, { Doc: "What om no longer reads is removed: the reboot, rotate_root_pw, stats_collection and dequeue_actions sections, " + "node.default_mon_format, the timeout and the secret of an arbitrator, " + "and the secret of a relay heartbeat that authenticates with a username.", // contains filtered or unexported fields }, { Doc: "A relay heartbeat authenticating with a secret, and a switch reached with telnet, are reported and kept: " + "what replaces them is a decision, a relay user with the heartbeat grant and a password secret, " + "an ssh key or a password secret.", // contains filtered or unexported fields }, }
NodeMigrationRules is the rules the configuration of a node, or of the cluster, is migrated by.
var ObjectMigrationRules = MigrationRules{ { Doc: "A filesystem that made the volume it mounts, its vg and size keywords set, " + "becomes a disk.lv resource and a filesystem resting on it. " + "A size written as a share of a volume group becomes arithmetic on what om reports of that group, " + "where the group is a resource of the object, and is kept as it is where it is not.", // contains filtered or unexported fields }, { Doc: "The size and the mode options of the mnt_opt of a tmpfs become its size and mode keywords, " + "the size being what a resize records. " + "The tmpfs of a volume is sized {DEFAULT.size}, the size the volume is claimed with. " + "A size written as a share of the memory is kept in mnt_opt: om cannot say how big it is.", // contains filtered or unexported fields }, }
ObjectMigrationRules is the rules the configuration of an object is migrated by.
Functions ¶
func AcmeChallengeKey ¶
AcmeChallengeKey returns the key of the sec holding the key authorization of the http-01 challenge token, and refuses a token which is not one: a token is a base64url string, so it names no other key.
func CollectorResponseStatusCheck ¶
CollectorResponseStatusCheck verifies if the HTTP response status code matches any of the expected codes in `wanted`. If it doesn't match, attempts to decode the response body as a `CollectorProblem` and includes its details in the error.
func DescribeComputeClaims ¶
DescribeComputeClaims says what an object claims, in the words of the units, for a message.
func GetSecEncryptDecrypter ¶
func GetSecEncryptDecrypter() (encryptDecrypter, error)
func IsSecretKey ¶
IsSecretKey says whether the value of k, in a configuration of an object of kind, is a secret: a key of a sec or usr data section, or a keyword declared with RedactSecret. kind is invalid for a node or cluster configuration, and sectionType is the type of the section k is in.
func KeywordOptions ¶
KeywordOptions returns the options of the keywords a section of a configuration of kind may hold, sorted, each once: the ones the drivers of its group declare, and the ones of the store of the kind. The node configuration is the kind naming.KindInvalid.
It is a superset. Which of them a section holds depends on the driver its type names, and on keywords limited to other kinds or sections, which is what the keyword lookup of the configuration says of each.
func KeywordStoreWithDrivers ¶
KeywordStoreWithDrivers return the keywords supported by a specific object kind, including all resource drivers keywords.
func ListenerTLSSecs ¶
ListenerTLSSecs returns the secs listener.tls_secs names, as paths, or by their names in the system namespace. A reference naming no sec is left out.
func PGKeywords ¶
PGKeywords returns the pg_* keywords of the objects of a kind, which set the process group caps of the object, of a subset or of a resource, sorted by name.
It is what a command setting caps documents and completes, so a keyword added to the store is offered by the command without the command changing.
func RedactSecrets ¶
RedactSecrets returns b with the value of every keyword declared with RedactSecret, and of every key of a sec or usr data section, replaced by asterisks. kind is the object kind the configuration belongs to, empty for a node or cluster configuration.
Only those values change. The parser writes back verbatim the lines it was not asked to touch, so comments, blank lines, spacing, inline comments and multiline layout are all preserved, and the substitution is refused if it would not parse back to the redacted value.
An unparseable configuration is an error rather than a configuration returned unredacted.
func SetClusterConfig ¶
SetClusterConfig refreshes the config data cache and returns the new config data.
func WithClusterConfigFile ¶
WithConfigFile sets a non-standard configuration location.
func WithConfigData ¶
WithConfigData sets configuration file (string) or content ([]byte) 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
Install(context.Context) error
PRStart(context.Context) error
PRStop(context.Context) error
PGUpdate(context.Context) error
Provision(context.Context) error
Unprovision(context.Context) error
ResourceHandlingDevice(ctx context.Context, p device.T) (resource.Driver, error)
ResourceHandlingFile(ctx context.Context, filename string) (resource.Driver, error)
SetProvisioned(context.Context) error
SetUnprovisioned(context.Context) error
SyncFull(context.Context) error
SyncResync(context.Context) error
SyncSplit(context.Context) error
SyncUpdate(context.Context) error
SyncIngest(context.Context) error
Enter(context.Context, string) error
ContainerLogs(context.Context, string, bool, int) error
ContainerLogsStream(context.Context, string, bool, int) (<-chan []byte, error)
Schedules() schedule.Table
RefreshResInfo(context.Context) (resource.Infos, error)
HardAffinity() []string
HardAntiAffinity() []string
SoftAffinity() []string
SoftAntiAffinity() []string
// contains filtered or unexported methods
}
Actor is implemented by object kinds supporting start, stop, ...
type ActorStatus ¶
type ActorStatus struct {
Avail status.T `json:"avail"`
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"`
Provisioned provisioned.T `json:"provisioned"`
Topology topology.T `json:"topology"`
UpInstancesCount int `json:"up_instances_count"`
Flex *FlexStatus `json:"flex,omitempty"`
}
func (*ActorStatus) DeepCopy ¶
func (s *ActorStatus) DeepCopy() *ActorStatus
type ArrayPush ¶
type ArrayPush struct {
Name string `json:"name"`
Type string `json:"type"`
Keys int `json:"keys"`
Error string `json:"error,omitempty"`
}
ArrayPush is what came of pushing one array to the collector.
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 overridden by the definition found in node.conf.
func (*Ccfg) Cluster ¶
Cluster returns a cached Ccfg struct pointer. If none is already cached, allocate a new Ccfg{} and cache it.
func (*Ccfg) ComputeClaims ¶
ComputeClaims is what the object claims of each compute type, cluster-wide: what its processes are capped to, on every instance it may run at once.
A failover object runs one started instance, and a flex object as many as its target. Every other instance runs its standby resources. The instances started are counted where they take the most, since any node may be the one running them: the claim is what the object may take, not what it takes now.
A process capped by nothing takes what it finds, and makes the claim of the object Unbounded on that type.
func (*Ccfg) ConfigData ¶
func (t *Ccfg) ConfigData() any
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) EditConfig ¶
func (t *Ccfg) EditConfig() error
func (*Ccfg) EvalConfig ¶
func (*Ccfg) FlexTarget ¶
func (*Ccfg) IsVolatile ¶
func (t *Ccfg) IsVolatile() bool
func (*Ccfg) KeywordLookup ¶
func (*Ccfg) MonitorStatus ¶
func (*Ccfg) NewCompliance ¶
func (t *Ccfg) NewCompliance() (*compliance.T, error)
func (*Ccfg) Node ¶
Node returns a cached 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) 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) 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 CertificateRenewOptions ¶
type CertificateRenewOptions struct {
// Force issues a certificate even when the current one is not due.
Force bool
// Webroot is the host directory the http-01 challenge token is
// written in, acme.webroot when empty. It is ignored when HTTP01
// is set.
Webroot string
// HTTP01 writes the http-01 challenge token where the http server
// of the domains serves it from, as a task writes it in a volume of
// its object, confined there.
HTTP01 challenge.Provider
}
CertificateRenewOptions says how a certificate is renewed.
type CertificateRenewal ¶
type CertificateRenewal struct {
// Renewed is true when a certificate was issued.
Renewed bool `json:"renewed"`
// Reason says why a certificate was issued, or why none was.
Reason string `json:"reason"`
// Sec is the sec the certificate is of, for a renewal of several.
Sec string `json:"sec,omitempty"`
Domains []string `json:"domains"`
// Directory is the ACME directory the certificate is issued by,
// empty for a certificate generated, self-signed or signed by the
// ca of the sec.
Directory string `json:"directory,omitempty"`
NotAfter time.Time `json:"not_after,omitzero"`
}
CertificateRenewal tells what a certificate renewal did.
func (CertificateRenewal) Render ¶
func (t CertificateRenewal) Render() string
Render is the renewal as a person reads it.
type Cfg ¶
type Cfg interface {
DataStore
}
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 CollectorConfigRaw ¶
type CollectorConfigRaw struct {
// contains filtered or unexported fields
}
func (*CollectorConfigRaw) AsConfig ¶
func (t *CollectorConfigRaw) AsConfig() *collector.Config
func (*CollectorConfigRaw) FeederUrl ¶
func (t *CollectorConfigRaw) FeederUrl() string
func (*CollectorConfigRaw) HasServerV3 ¶
func (t *CollectorConfigRaw) HasServerV3() bool
func (*CollectorConfigRaw) ServerUrl ¶
func (t *CollectorConfigRaw) ServerUrl() string
type CollectorProblem ¶
type CollectorProblem struct {
// contains filtered or unexported fields
}
type ComputeClaimer ¶
ComputeClaimer is an object claiming compute of its namespace.
type Configurer ¶
type Configurer interface {
ConfigFile() string
Config() *xconfig.T
EditConfig() error
RecoverAndEditConfig() error
DiscardAndEditConfig() error
RawConfig() (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
}
Configurer is implemented by object kinds supporting get, set, unset, eval, edit, ...
func NewConfigurer ¶
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 DataStore ¶
type DataStore interface {
Core
AddKey(name string, b []byte) error
ChangeKey(name string, b []byte) error
DecodeKey(name string) ([]byte, error)
DecodeKeys(name ...string) ([][]byte, error)
EditKey(name string) error
InstallKey(name string) error
InstallKeyTo(KVInstall) (bool, error)
RemoveKey(name string) error
RenameKey(name, to string) error
Allow(string) bool
HasKey(name string) bool
AllKeys() ([]string, error)
MatchingKeys(string) ([]string, error)
TransactionAddKey(name string, b []byte) error
TransactionChangeKey(name string, b []byte) error
TransactionChangeOrAddKey(name string, b []byte) error
TransactionRemoveKey(name string) error
TransactionRenameKey(name, to string) error
}
DataStore is the base interface of sec, cfg and usr objects
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 object full state dataset.
func (Digest) LoadTreeNode ¶
LoadTreeNode add the tree nodes representing the type instance into another.
func (Digest) ObjectWarningsString ¶
ObjectWarningsString returns a string presenting notable information at the object, instances-aggregated, level.
type FlexStatus ¶
type FlexStatus struct {
Target int `json:"target,omitempty"`
Min int `json:"min,omitempty"`
Max int `json:"max,omitempty"`
}
func (*FlexStatus) DeepCopy ¶
func (s *FlexStatus) DeepCopy() *FlexStatus
type KVInstall ¶
type KVInstall struct {
Required bool
ToLog *plog.Logger
ToHead string
ToPath string
FromPattern string
FromStore naming.Path
Source string
IsTemplate bool
AccessControl KVInstallAccessControl
Signals *volsignal.T
// LogUnchanged logs what the install leaves as it is, a file up to
// date or a key the store does not hold, as an install report asked
// by the user shows them. A start installs quietly what has not
// changed.
LogUnchanged bool
// contains filtered or unexported fields
}
func (KVInstall) RelativeToPath ¶
type KVInstallAccessControl ¶
type KeyStore ¶
type KeyStore interface {
GenCert() error
RenewCertificate(ctx context.Context, opts CertificateRenewOptions) (CertificateRenewal, error)
GenCertificateSigningRequest() ([]byte, error)
PKCS(password []byte) ([]byte, error)
}
KeyStore is implemented by encrypting KeyStore object kinds (usr, sec).
type Migration ¶
type Migration struct {
Sets []keyop.T
Unsets []key.T
Deletes []string
// Notes is what changed, in the words of whoever has to read the
// configuration afterwards, one line per change.
Notes []string
// Refusals is what a rule recognized and could not write, with the
// reason. A configuration keeps what nothing can migrate for it.
Refusals []string
}
Migration is what a configuration has to become for om to run what it describes, as the keyword changes a configuration update takes.
It is expressed that way so that it lands through the path every other configuration write takes: the same validation, the same policy, the same claim on a pool.
func MigrateConfig ¶
MigrateConfig is what a configuration has to become for om to run what it describes.
A configuration written for om2 describes things om3 no longer reads that way. What it asked for is still possible, in another shape, and the shape is what this writes: the configuration says the same thing afterwards, in words om3 reads.
It changes nothing by itself. What it answers is what a configuration update would take, so that the caller can show it before writing it.
func MigrateNodeConfig ¶
MigrateNodeConfig is what a node or cluster configuration has to become for om to run what it describes. It changes nothing by itself, as MigrateConfig.
type MigrationRule ¶
type MigrationRule struct {
// Doc says what the rule rewrites, in the words of the help of the
// command applying it: one paragraph, wrapped where it is shown.
Doc string
// contains filtered or unexported fields
}
MigrationRule is one change of shape a configuration written for an older agent takes.
type MigrationRules ¶
type MigrationRules []MigrationRule
MigrationRules is the rules a kind of configuration is migrated by, in the order they apply.
func MigrationRulesOf ¶
func MigrationRulesOf(kind naming.Kind) MigrationRules
MigrationRulesOf returns the rules the configuration of a kind of object is migrated by: the node ones for the cluster configuration, which holds the same keywords as the node one.
func (MigrationRules) Apply ¶
func (t MigrationRules) Apply(cfg *xconfig.T) Migration
Apply returns what the configuration has to become by the rules.
func (MigrationRules) Doc ¶
func (t MigrationRules) Doc(width int) string
Doc lists the rules as the help of a command shows them, a dash heading each, wrapped at width.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the node struct.
func (*Node) Array ¶
Array returns the driver of the array named in the node or cluster configuration, or nil when no section names it or no driver serves its type.
The name is the one of the section, and the driver is chosen by the type that section declares: the two are not the same, and looking a driver up by the name of the array only ever worked for an array named after its own type.
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) CollectorFeeder ¶
func (t *Node) CollectorFeeder() (*httphelper.T, error)
CollectorFeeder returns new collector feeder client from config
func (*Node) CollectorRawConfig ¶
func (t *Node) CollectorRawConfig() *CollectorConfigRaw
func (*Node) CollectorRestAPIClient ¶
func (*Node) CollectorServer ¶
func (t *Node) CollectorServer() (*httphelper.T, error)
CollectorServer returns new collector server client from config
func (*Node) CollectorServerWithAuth ¶
func (t *Node) CollectorServerWithAuth(auth string) (*httphelper.T, error)
CollectorServer returns new collector server client from config
func (*Node) CollectorServerWithoutAuth ¶
func (t *Node) CollectorServerWithoutAuth() (*httphelper.T, error)
CollectorServer returns new collector server client from config
func (*Node) ConfigData ¶
func (*Node) ConfigFile ¶
func (Node) DeleteSection ¶
DeleteSection removes sections from node config
func (Node) DiscardAndEditConfig ¶
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 ¶
ForceSysreport sends every file the agent tracks, as a full report the collector replaces what it holds of the node with.
func (*Node) Freeze ¶
Freeze creates a persistent flag file that prevents orchestration of the object instance.
The flag records a freeze of the cluster when the node monitor says so, for the freeze to reach the nodes that missed it.
func (*Node) FrozenScope ¶
FrozenScope returns the scope of the freeze of the node, empty when it is not frozen.
func (Node) IsVolatile ¶
func (Node) KeywordLookup ¶
func (*Node) ListArrays ¶
func (*Node) ListSwitches ¶
func (t *Node) ListSwitches() []SwitchItem
ListSwitches returns the switch sections of the node and cluster configuration.
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) PushArrays ¶
PushArrays reports the configuration of the arrays of the cluster to the collector.
The collector is fed through the jsonrpc method it exports for the type of each array, "update_freenas" for a freenas and so on, with the section names and their contents. That is the api v2 fed.
It is the jsonrpc api and not a rest one because oc3, which takes the roles of the old collector over one at a time, exposes no array feed yet: its feeder serves the node, the instance and the object, and nothing about an array. oc3 will drop the jsonrpc api when it has taken everything over, so this call is to be moved to the rest feed the day oc3 grows one, and a rest endpoint is to be preferred over jsonrpc wherever both exist.
One array failing does not stop the others: an array that is down or whose credentials have expired must not keep the ones that are reachable from being reported. What failed is in the result, and in the error.
func (Node) PushAsset ¶
PushAsset assembles the asset inventory data. Each entry value comes from: * overrides (in config) * probes * default (code)
func (*Node) PushStats ¶
func (t *Node) PushStats(ctx context.Context, o PushStatsOptions) (PushStatsResult, error)
PushStats sends the performance statistics of the node to the collector, as the pushstats action of the v2 agent did: cpu, memory, swap, load, block and network i/o read from sysstat, and the file system usage.
func (*Node) PushStatsDryRun ¶
func (t *Node) PushStatsDryRun(ctx context.Context, o PushStatsOptions) (PushStatsResult, error)
PushStatsDryRun reads the statistics a push would send, and sends nothing.
func (Node) PushSwitches ¶
PushSwitches inventories the SAN switches of the node and cluster configuration, all of them or the one named, and reports their configuration to the collector.
The report goes to the switch feed of oc3. Where oc3 does not serve it, because the node feeds the old collector only or because the oc3 it feeds is older than the feed, it goes to the "update_<type>" jsonrpc method of the old collector, as v2 sent it. That fallback is to be removed when oc3 has replaced the old collector, which drops the jsonrpc api.
One switch failing does not stop the others: a switch out of reach must not keep the reachable ones from being reported.
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 ¶
ScanCapabilities scan node capabilities and return new capabilities
func (Node) SendSysreport ¶
SendSysreport posts a sysreport to the oc3 feeder, as a multipart form: the archive in the "file" part, when there is one, each deleted file in a "deleted" part, and the "full" flag.
func (*Node) SetVolatile ¶
func (*Node) ShowPoolsByName ¶
func (*Node) Switch ¶
Switch returns the driver of the switch named in the node or cluster configuration, or nil when no section names it or no driver serves its type. The name is the one of the section, with or without its "switch#" prefix.
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 persistent 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 PushStatsOptions ¶
PushStatsOptions bound the statistics a push sends. A zero Begin starts where the last scheduled push left, a zero End is now.
type PushStatsResult ¶
type PushStatsResult struct {
Begin time.Time `json:"begin"`
End time.Time `json:"end"`
// Batches is the number of requests the range was sent in, a day
// of statistics each.
Batches int `json:"batches"`
// Rows is the number of rows read, by group.
Rows map[string]int `json:"rows"`
Series int `json:"series"`
Points int `json:"points"`
Skipped []string `json:"skipped,omitempty"`
Disabled []string `json:"disabled,omitempty"`
// DryRun says the statistics were read and not sent.
DryRun bool `json:"dry_run,omitempty"`
}
PushStatsResult tells what a push read and what the collector stored.
func (PushStatsResult) Render ¶
func (t PushStatsResult) Render() string
Render is the result as a person reads it: the range read, how many rows of each group, and what the collector stored.
type QueuedAction ¶
type QueuedAction struct {
Command string `json:"command"`
DequeuedAt time.Time `json:"dequeued_at"`
Id int `json:"id"`
Nodename string `json:"nodename"`
QueuedAt time.Time `json:"queued_at"`
Status string `json:"status"`
SvcId string `json:"svc_id"`
Svcname string `json:"svcname"`
}
QueuedAction defines the model for QueuedAction.
type QueuedActionDone ¶
type QueuedActionDone struct {
DequeuedAt time.Time `json:"dequeued_at"`
Id int `json:"id"`
Ret int `json:"ret"`
Stderr string `json:"stderr"`
Stdout string `json:"stdout"`
}
QueuedActionDone defines the action queued result processed by the node
type QueuedActionRunning ¶
type QueuedActionRunning struct {
// Ids list of queued action ids
Ids []int `json:"ids"`
}
QueuedActionRunning defines the model for QueuedActionRunning.
type QueuedActions ¶
type QueuedActions struct {
Actions []QueuedAction `json:"actions"`
}
QueuedActions defines the model for QueuedActions.
type ResizeOptions ¶
type ResizeOptions struct {
// SkipHeadStage leaves the last stage of the chain alone. It holds
// the head, which grows only where the object is up, so a node that
// does not hold it up asks for the stages below it and is told there
// is no stage of that number to run here when it reaches the last.
SkipHeadStage bool
// Force allows a resize that would grow one replica of a replicated
// object on its own. The orchestration passes it for the phase that
// runs once every node has grown what is under the replicated
// resource.
Force bool
}
ResizeOptions tunes a resize.
type ResizePlan ¶
type ResizePlan struct {
// Steps are ordered as they would be applied, which is up from the
// device to the filesystem: the space has to exist before anything
// is stretched onto it.
Steps []ResizeStep `json:"steps"`
// Stages is how many stages the chain is grown in, which is one more
// than the number of replicated resources it crosses. Every node has
// to finish a stage before any node starts the next one: a replicated
// resource offers only what its smallest replica holds.
Stages int `json:"stages"`
}
ResizePlan is what a resize would do, in the order it would do it.
func (ResizePlan) HasWork ¶
func (t ResizePlan) HasWork() bool
HasWork says the plan changes something. A plan of links that all hold enough already changes nothing.
func (ResizePlan) String ¶
func (t ResizePlan) String() string
type ResizeStep ¶
type ResizeStep struct {
// Path names the object the resource belongs to, and is empty for
// the object the resize was asked of. A chain can cross into another
// object: a volume resource stands for the head of its volume.
Path string `json:"path,omitempty"`
RID string `json:"rid"`
Driver string `json:"driver"`
From int64 `json:"from"`
To int64 `json:"to"`
Comment string `json:"comment,omitempty"`
// Skip says the link already holds what the link above it needs, so
// there is nothing to do to it. It is listed so a plan shows the
// whole chain.
Skip bool `json:"skip,omitempty"`
// Stage is the step of the chain this link is grown in. A chain
// crossing no replicated resource has one stage, numbered 0.
Stage int `json:"stage"`
// contains filtered or unexported fields
}
ResizeStep is one link of the chain a resize walks, and the size that link is asked to reach.
func (ResizeStep) String ¶
func (t ResizeStep) String() string
type Sec ¶
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 Status ¶
type Status struct {
Priority priority.T `json:"priority"`
Scope []string `json:"scope"`
UpdatedAt time.Time `json:"updated_at"`
*ActorStatus
*VolStatus
}
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 SwitchItem ¶
SwitchItem is a switch section of the node or cluster configuration.
type SwitchPush ¶
type SwitchPush struct {
Name string `json:"name"`
Type string `json:"type"`
// Commands is the number of switch commands whose output was
// pushed.
Commands int `json:"commands"`
// Via says which collector api received the push: "oc3", or
// "jsonrpc" where oc3 does not serve the switch feed.
Via string `json:"via,omitempty"`
Error string `json:"error,omitempty"`
}
SwitchPush is what came of pushing one SAN switch to the collector.
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
func (*UsrDB) GrantsFromUsername ¶
GrantsFromUsername returns grants for username if username existing usr object
type Vol ¶
type Vol interface {
Actor
Head() string
HeadRID(context.Context) (string, error)
ConfiguredSize() (int64, error)
PoolName() (string, error)
ExposedDevice(context.Context) *device.T
ExposedDevices(context.Context) device.L
ExposedDeviceResource(context.Context) resource.Driver
SubDevice(context.Context) *device.T
SubDevices(context.Context) device.L
HoldersExcept(ctx context.Context, p naming.Path) (naming.Paths, error)
Access() (volaccess.T, error)
Children() (naming.Relations, error)
}
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 independent) to a pool.
Source Files
¶
- actor.go
- actor_boot.go
- actor_container_logs.go
- actor_edit_config.go
- actor_enter.go
- actor_freeze.go
- actor_install.go
- actor_interrupt_syncs.go
- actor_pg_reset.go
- actor_pg_update.go
- actor_print_schedule.go
- actor_provision.go
- actor_prstart.go
- actor_prstop.go
- actor_resinfo.go
- actor_resize.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_stopped.go
- actor_sync_full.go
- actor_sync_ingest.go
- actor_sync_resync.go
- actor_sync_split.go
- actor_sync_update.go
- actor_unprovision.go
- actor_unset.go
- ccfg.go
- cfg.go
- claim.go
- compliance.go
- config_migrate.go
- config_migrate_node.go
- core.go
- core_action.go
- core_action_collector.go
- core_compliance.go
- core_config.go
- core_delete.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
- datastore.go
- datastore_key_add.go
- datastore_key_decode.go
- datastore_key_edit.go
- datastore_key_install.go
- datastore_key_list.go
- datastore_key_remove.go
- datastore_key_rename.go
- factory.go
- interfaces.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_deueue.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_schedule.go
- node_prkey.go
- node_push_array.go
- node_push_asset.go
- node_push_disks.go
- node_push_pkg.go
- node_push_stats.go
- node_push_switch.go
- node_register.go
- node_set.go
- node_stonith.go
- node_sysreport.go
- node_unset.go
- node_update_config.go
- node_validate_config.go
- nscfg.go
- pg.go
- pg_keywords.go
- redact.go
- sec.go
- sec_acme.go
- sec_acme_listener.go
- sec_gencert.go
- sec_pkcs.go
- svc.go
- svc_disable.go
- svc_enable.go
- type_status.go
- usr.go
- vol.go