Documentation
¶
Overview ¶
Package operator implements the generic operator: an instance pushes the module configs and functions its YAML config spells to every gateway.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadRequest ¶
LoadRequest reads a module config file, the method's request spelled in YAML, and decodes it against the descriptors linked into this binary.
Types ¶
type ChainConfig ¶
type ChainConfig struct {
// Name is the chain name (e.g. "default").
Name xcfg.NonEmptyString `yaml:"name"`
// Modules are the module configs packets traverse, in order.
Modules []ModuleIdConfig `yaml:"modules"`
}
ChainConfig is an ordered module sequence.
type Config ¶
type Config struct {
// Name is the instance name. The operator reports readiness and metrics
// under it, so it must match the name clients address.
Name xcfg.NonEmptyString `yaml:"name"`
Logging logging.Config `yaml:"logging"`
Server operator.GRPCServerConfig `yaml:"server"`
Gateways []operator.GatewayConfig `yaml:"gateways"`
Register operator.RegisterConfig `yaml:"register"`
Reconcile operator.ReconcileConfig `yaml:"reconcile"`
// Configs are the module configs this instance pushes.
Configs []ModuleConfig `yaml:"configs"`
// Functions are the gateway functions published after the configs.
Functions []FunctionConfig `yaml:"functions"`
}
Config is the top-level YAML configuration for one yanet-generic-operator instance.
The configs section spells the module configs the instance pushes, the functions section the gateway functions published after them.
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a Config populated with sensible defaults.
func (*Config) LoggingConfig ¶
LoggingConfig exposes the embedded logging configuration to the generic operator CLI helper.
type FunctionChainConfig ¶
type FunctionChainConfig struct {
// Chain is the module sequence the weight applies to.
Chain ChainConfig `yaml:"chain"`
// Weight must be spelled explicitly, an explicit 0 disables the chain.
Weight xcfg.Required[uint64] `yaml:"weight"`
}
FunctionChainConfig pairs a chain with its load-balancing weight.
type FunctionConfig ¶
type FunctionConfig struct {
// Name is the function identifier (e.g. "fn:decap").
Name xcfg.NonEmptyString `yaml:"name"`
// Chains are the function's weighted processing chains.
Chains []FunctionChainConfig `yaml:"chains"`
// IgnorePdump skips function updates when the existing chain already
// matches once every pdump:* module is filtered out.
//
// Defaults to true when the field is omitted from the YAML input.
IgnorePdump bool `yaml:"ignore_pdump"`
}
FunctionConfig is one gateway function this instance publishes after the configs.
func (*FunctionConfig) AsFunction ¶
func (m *FunctionConfig) AsFunction() *ynpb.Function
AsFunction converts the spelled function to its proto form.
func (*FunctionConfig) UnmarshalYAML ¶
func (m *FunctionConfig) UnmarshalYAML(value *yaml.Node) error
UnmarshalYAML implements yaml.Unmarshaler so that IgnorePdump defaults to true when the field is absent from the YAML input.
type ModuleConfig ¶
type ModuleConfig struct {
// Name is the module config name.
//
// It is filled into the request when the file omits its own name, so a
// payload file does not have to repeat it.
Name xcfg.NonEmptyString `yaml:"name"`
// Method is the unary gRPC method that replaces the module config,
// spelled as "package.Service/Method".
//
// The reconcile loop repeats the call, so the method must replace
// whole state, not accumulate it.
Method xcfg.NonEmptyString `yaml:"method"`
// File is the path to the module config file, the method's request in
// YAML.
File xcfg.NonEmptyString `yaml:"file"`
}
ModuleConfig describes one module config this instance pushes.
type ModuleIdConfig ¶
type ModuleIdConfig struct {
// Type is the module type (e.g. "decap").
Type xcfg.NonEmptyString `yaml:"type"`
// Name is the module config name (e.g. "decap0").
Name xcfg.NonEmptyString `yaml:"name"`
}
ModuleIdConfig references one module config by type and name.