Documentation ¶
Index ¶
- Constants
- func OverwriteControlProxyConfigs(cfg *ControlProxyCfg)
- func OverwriteMagmadConfigs(cfg *MagmadCfg)
- type AtomicStore
- type BootstrapConfig
- type ControlProxyCfg
- type GenericCommandConfig
- type MagmadCfg
- type Metricsd
- type NetworkMonitorConfig
- type ShellCommand
- type StructuredConfig
- type UpgraderFactory
Constants ¶
const ( CONTROL_PROXY_YML_FRESHNESS_CHECK_INTERVAL = time.Minute * 10 // Defaults DefaultNghttpxConfigLocation = "/var/tmp/nghttpx.conf" DefaultRootCaFile = "/var/opt/magma/certs/rootCA.pem" DefaultGwCertFile = "/var/opt/magma/certs/gateway.crt" DefaultGwCertKeyFile = "/var/opt/magma/certs/gateway.key" DefaultCloudPort = 443 DefaultBootstrapPort = 443 DefaultLocalPort = 8443 DefaultProxyCloudConnection = true )
const ( MAGMAD_YML_FRESHNESS_CHECK_INTERVAL = time.Minute * 10 // Defaults DefaultChallengeKeyFile = "/var/opt/magma/certs/gw_challenge.key" DefaultStaticConfigDir = "/etc/magma" DefaultDynamicConfigDir = "/var/opt/magma/configs" )
const MinFreshnessCheckInterval = time.Minute
Variables ¶
This section is empty.
Functions ¶
func OverwriteControlProxyConfigs ¶
func OverwriteControlProxyConfigs(cfg *ControlProxyCfg)
OverwriteControlProxyConfigs overwrites current control proxy configs
func OverwriteMagmadConfigs ¶
func OverwriteMagmadConfigs(cfg *MagmadCfg)
OverwriteMagmadConfigs overwrites current magmad configs
Types ¶
type AtomicStore ¶
func (*AtomicStore) GetCurrent ¶
func (val *AtomicStore) GetCurrent(defaultCfgFactory func() StructuredConfig) StructuredConfig
GetCurrentCfg returns current system/process wide configuration the returned pointer is guaranteed to not to be <nil> and MUST be used only in READ ONLY fashion. An attempt to modify the returned struct fields may lead to unpredictable results If a caller needs mutable copy of configuration, it must copy the returned object
func (*AtomicStore) Overwrite ¶
func (val *AtomicStore) Overwrite(cfg StructuredConfig)
Overwrite unconditionally swaps configs referred by val with the given config
type BootstrapConfig ¶
type BootstrapConfig struct {
ChallengeKey string `yaml:"challenge_key"`
}
BootstrapConfig bootstrapper related configuration - `yaml:"bootstrap_config"`
type ControlProxyCfg ¶
type ControlProxyCfg struct { NghttpxConfigLocation string `yaml:"nghttpx_config_location"` // GW Certificate params RootCaFile string `yaml:"rootca_cert"` GwCertFile string `yaml:"gateway_cert"` GwCertKeyFile string `yaml:"gateway_key"` LocalPort int `yaml:"local_port"` CloudAddr string `yaml:"cloud_address"` CloudPort int `yaml:"cloud_port"` BootstrapAddr string `yaml:"bootstrap_address"` BootstrapPort int `yaml:"bootstrap_port"` ProxyCloudConnection bool `yaml:"proxy_cloud_connections"` }
ControlProxyCfg represents control_proxy.yml configuration struct
func GetControlProxyConfigs ¶
func GetControlProxyConfigs() *ControlProxyCfg
GetControlProxyConfigs returns current magmad configuration
func NewDefaultControlProxyCfg ¶
func NewDefaultControlProxyCfg() *ControlProxyCfg
NewDefaultControlProxyCfg returns new Bootstrapper struct with default configuration
func (*ControlProxyCfg) FreshnessCheckInterval ¶
func (_ *ControlProxyCfg) FreshnessCheckInterval() time.Duration
FreshnessCheckInterval of StructuredConfig interface
func (*ControlProxyCfg) UpdateFromYml ¶
func (cpc *ControlProxyCfg) UpdateFromYml() (StructuredConfig, string, string)
UpdateFromYml of StructuredConfign interface - updates given control proxy config struct from corresponding YML file returns updated ControlProxyCfg, main YML CFG file path & owerwrite YML CFG file path (if any)
type GenericCommandConfig ¶
type GenericCommandConfig struct { Module string `yaml:"module"` Class string `yaml:"class"` ShellCommands []ShellCommand `yaml:"shell_commands"` CommandsMap map[string]ShellCommand `yaml:"-"` }
GenericCommandConfig is generic_command_config configuration block from magmad.yml
func (*GenericCommandConfig) UpdateShellCmdMap ¶
func (gcf *GenericCommandConfig) UpdateShellCmdMap()
UpdateShellCmdMap creates a new CommandsMap and populates it from ShellCommands list UpdateShellCmdMap also does basic format conversion
type MagmadCfg ¶
type MagmadCfg struct { LogLevel string `yaml:"log_level"` MagmaServices []string `yaml:"magma_services"` NonService303Services []string `yaml:"non_service303_services"` RegisteredDynamicServices []string `yaml:"registered_dynamic_services"` SkipCheckinIfMissingMetaServices []string `yaml:"skip_checkin_if_missing_meta_services"` InitSystem string `yaml:"init_system"` // When cloud managed configs (gateway.cmconfig) are loaded by a magma service, the service first tries to // load them from dynamic (most recent) configs directory - DynamicMconfigDir, if unsuccessful, the service // falls back to static configs directory - StaticMconfigDir; this allows services to operate StaticMconfigDir string `yaml:"static_mconfig_dir"` DynamicMconfigDir string `yaml:"dynamic_mconfig_dir"` // StaticMconfigUpdateIntervalMin specifies interval in minutes dynamic gateway.mconfig from DynamicMconfigDir // will be synchronized with (copied to) static gateway.mconfig in StaticMconfigDir // if StaticMconfigUpdateIntervalMin <= 0 (default) - static gateway.mconfig in StaticMconfigDir will never // be overwritten StaticMconfigUpdateIntervalMin int `yaml:"static_mconfig_update_interval_minutes"` BootstrapConfig BootstrapConfig `yaml:"bootstrap_config"` EnableConfigStreamer bool `yaml:"enable_config_streamer"` EnableUpgradeMamager bool `yaml:"enable_upgrade_manager"` EnableNetworkMonitor bool `yaml:"enable_network_monitor"` EnableSystemdTailer bool `yaml:"enable_systemd_tailer"` EnableSyncRpc bool `yaml:"enable_sync_rpc"` EnableKernelVersionChecking bool `yaml:"enable_kernel_version_checking"` SystemdTailerPollInterval int `yaml:"systemd_tailer_poll_interval"` NetworkMonitorConfig NetworkMonitorConfig `yaml:"network_monitor_config"` UpgraderFactory UpgraderFactory `yaml:"upgrader_factory"` MconfigModules []string `yaml:"mconfig_modules"` Metricsd Metricsd `yaml:"metricsd"` GenericCommandConfig GenericCommandConfig `yaml:"generic_command_config"` ConfigStreamErrorRetryInterval int `yaml:"config_stream_error_retry_interval"` }
MagmadCfg represents magmad.yml based configuration
func GetMagmadConfigs ¶
func GetMagmadConfigs() *MagmadCfg
GetMagmadConfigs returns current magmad configuration
func NewDefaultMgmadCfg ¶
func NewDefaultMgmadCfg() *MagmadCfg
NewDefaultMgmadCfg returns new default magmad configs
func (*MagmadCfg) FreshnessCheckInterval ¶
FreshnessCheckInterval of StructuredConfig interface
func (*MagmadCfg) UpdateFromYml ¶
func (mdc *MagmadCfg) UpdateFromYml() (StructuredConfig, string, string)
UpdateFromYml of StructuredConfign interface - updates given magmad config struct from corresponding YML file returns updated MagmadCfg, main YML CFG file path & overwrite YML CFG file path (if any)
type Metricsd ¶
type Metricsd struct { LogLevel string `yaml:"log_level"` CollectInterval int `yaml:"collect_interval"` SyncInterval int `yaml:"sync_interval"` GrpcTimeout int `yaml:"grpc_timeout"` QueueLength int `yaml:"queue_length"` Services []string `yaml:"services"` }
Metricsd is metricsd configuration block from magmad.yml
type NetworkMonitorConfig ¶
type NetworkMonitorConfig struct { SamplingPeriod int `yaml:"sampling_period"` PingConfig struct { Hosts []string `yaml:"hosts"` NumPackets int `yaml:"num_packets"` TimeoutSecs int `yaml:"timeout_secs"` } `yaml:"ping_config"` }
NetworkMonitorConfig is network_monitor_config configuration block from magmad.yml
type ShellCommand ¶
type ShellCommand struct { Name string Command string AllowParams bool `yaml:"allow_params"` CommandFmt string `yaml:"-"` }
ShellCommand magmad shell command definition
type StructuredConfig ¶
type StructuredConfig interface { UpdateFromYml() (cfgPtr StructuredConfig, file, owFile string) FreshnessCheckInterval() time.Duration }
type UpgraderFactory ¶
UpgraderFactory is upgrader_factory configuration block from magmad.yml