Documentation
¶
Index ¶
- Constants
- func AuthenticateUser(user string, pass string) (interface{}, error)
- func CheckIfStorageDirIsOK(storageDir string, config *Configuration) error
- func DecodeBootstrapKey(key string) (map[string]string, error)
- func HandlePIDFile(haproxyOptions HAProxyConfiguration)
- func InitStorageNoticeFile(storageDir string) error
- func RemoveStorageFolder(storageDir string) error
- type APIConfiguration
- type AtomicBool
- type AtomicInt
- type AtomicString
- type ChanNotify
- type ClusterConfiguration
- type ClusterSync
- type ConfigWatcher
- type ConfigWatcherParams
- type Configuration
- func (c *Configuration) GetClusterCertDir() string
- func (c *Configuration) GetClusterModeStorage() storage.ClusterModeStorage
- func (c *Configuration) GetStorageData() *StorageDataplaneAPIConfiguration
- func (c *Configuration) GetUsers() storagetype.Users
- func (c *Configuration) InitSignalHandler()
- func (c *Configuration) Load() ([]string, error)
- func (c *Configuration) LoadDataplaneStorageConfig() ([]string, error)
- func (c *Configuration) LoadRuntimeVars(swaggerJSON json.RawMessage, host string, port int) error
- func (c *Configuration) Save() error
- func (c *Configuration) SaveAWS(aws []*models.AwsRegion) error
- func (c *Configuration) SaveClusterModeData() error
- func (c *Configuration) SaveConsuls(consuls []*models.Consul) error
- func (c *Configuration) SaveSDAWSRegions() error
- func (c *Configuration) SaveSDConsuls() error
- func (c *Configuration) StopSignalHandler()
- func (c *Configuration) UnSubscribeAll()
- type HAProxyConfiguration
- type MapSync
- type Node
- type NotifyConfiguration
- type RuntimeData
- type ServiceDiscovery
- type Storage
- type StorageDataplaneAPIConfiguration
- type StorageDummy
- type StorageYML
- type User
- type Users
Constants ¶
View Source
const ( ModeCluster = "cluster" ModeSingle = "single" )
View Source
const ( StatusActive = "active" StatusUnconfigured = "unconfigured" )
View Source
const ( ReloadStratCustom = "custom" ReloadStratS6 = "s6" ReloadStratSystemd = "systemd" )
View Source
const DataplaneAPIType = "community"
Variables ¶
This section is empty.
Functions ¶
func AuthenticateUser ¶
func CheckIfStorageDirIsOK ¶
func CheckIfStorageDirIsOK(storageDir string, config *Configuration) error
func HandlePIDFile ¶
func HandlePIDFile(haproxyOptions HAProxyConfiguration)
func InitStorageNoticeFile ¶
func RemoveStorageFolder ¶
Types ¶
type APIConfiguration ¶
type AtomicBool ¶
type AtomicBool struct {
// contains filtered or unexported fields
}
func (*AtomicBool) Load ¶
func (s *AtomicBool) Load() bool
func (AtomicBool) MarshalYAML ¶
func (s AtomicBool) MarshalYAML() (interface{}, error)
func (*AtomicBool) Store ¶
func (s *AtomicBool) Store(str bool)
func (*AtomicBool) String ¶
func (s *AtomicBool) String() string
func (*AtomicBool) UnmarshalYAML ¶
func (s *AtomicBool) UnmarshalYAML(unmarshal func(interface{}) error) error
type AtomicInt ¶
type AtomicInt struct {
// contains filtered or unexported fields
}
func (AtomicInt) MarshalYAML ¶
func (*AtomicInt) UnmarshalYAML ¶
type AtomicString ¶
type AtomicString struct {
// contains filtered or unexported fields
}
func (*AtomicString) Load ¶
func (s *AtomicString) Load() string
func (AtomicString) MarshalYAML ¶
func (s AtomicString) MarshalYAML() (interface{}, error)
func (*AtomicString) Store ¶
func (s *AtomicString) Store(str string)
func (*AtomicString) String ¶
func (s *AtomicString) String() string
func (*AtomicString) UnmarshalYAML ¶
func (s *AtomicString) UnmarshalYAML(unmarshal func(interface{}) error) error
type ChanNotify ¶
type ChanNotify struct {
// contains filtered or unexported fields
}
func NewChanNotify ¶
func NewChanNotify() *ChanNotify
func (*ChanNotify) Notify ¶
func (cn *ChanNotify) Notify()
func (*ChanNotify) NotifyWithRetry ¶
func (cn *ChanNotify) NotifyWithRetry()
func (*ChanNotify) Subscribe ¶
func (cn *ChanNotify) Subscribe(name string) chan struct{}
func (*ChanNotify) UnSubscribeAll ¶
func (cn *ChanNotify) UnSubscribeAll()
type ClusterConfiguration ¶
type ClusterConfiguration struct { APIRegisterPath AtomicString `yaml:"api_register_path,omitempty" group:"cluster" save:"true"` APIBasePath AtomicString `yaml:"api_base_path,omitempty" group:"cluster" save:"true"` ActiveBootstrapKey AtomicString `yaml:"active_bootstrap_key,omitempty" group:"cluster" save:"true"` Token AtomicString `yaml:"token,omitempty" group:"cluster" save:"true"` ID AtomicString `yaml:"id,omitempty" group:"cluster" save:"true"` Port AtomicInt `yaml:"port,omitempty" group:"cluster" save:"true"` BootstrapKey AtomicString `yaml:"bootstrap_key,omitempty" group:"cluster" save:"true"` APINodesPath AtomicString `yaml:"api_nodes_path,omitempty" group:"cluster" save:"true"` URL AtomicString `yaml:"url,omitempty" group:"cluster" save:"true"` StorageDir AtomicString `yaml:"storage_dir,omitempty" group:"cluster" save:"true"` CertificateDir AtomicString `yaml:"cert_path,omitempty" group:"cluster" save:"true"` CertificateFetched AtomicBool `yaml:"cert_fetched,omitempty" group:"cluster" save:"true" example:"false"` Name AtomicString `yaml:"name,omitempty" group:"cluster" save:"true"` Description AtomicString `yaml:"description,omitempty" group:"cluster" save:"true"` ClusterID AtomicString `yaml:"cluster_id,omitempty" group:"cluster" save:"true"` ClusterLogTargets []*models.ClusterLogTarget `yaml:"cluster_log_targets,omitempty" group:"cluster" save:"true"` }
func (*ClusterConfiguration) Clear ¶
func (c *ClusterConfiguration) Clear()
type ClusterSync ¶
type ClusterSync struct { Context context.Context ReloadAgent haproxy.IReloadAgent // contains filtered or unexported fields }
ClusterSync fetches certificates for joining cluster
func (*ClusterSync) Monitor ¶
func (c *ClusterSync) Monitor(cfg *Configuration, cli client_native.HAProxyClient)
type ConfigWatcher ¶
type ConfigWatcher struct {
// contains filtered or unexported fields
}
func NewConfigWatcher ¶
func NewConfigWatcher(params ConfigWatcherParams) (*ConfigWatcher, error)
func (*ConfigWatcher) Listen ¶
func (w *ConfigWatcher) Listen()
type ConfigWatcherParams ¶
type Configuration ¶
type Configuration struct { Cluster ClusterConfiguration `yaml:"-"` Notify NotifyConfiguration `yaml:"-"` Mode AtomicString `yaml:"mode" default:"single"` Name AtomicString `yaml:"name" example:"famous_condor"` Cmdline AtomicString `yaml:"-"` Status AtomicString `yaml:"status,omitempty"` DeprecatedBootstrapKey AtomicString `yaml:"bootstrap_key,omitempty" deprecated:"true"` MapSync *MapSync `yaml:"-"` Syslog log.SyslogOptions `yaml:"-"` Logging log.LoggingOptions `yaml:"-"` RuntimeData RuntimeData `yaml:"-"` ServiceDiscovery ServiceDiscovery `yaml:"-"` Users []User `yaml:"-"` APIOptions APIConfiguration `yaml:"-"` LogTargets log.Targets `yaml:"log_targets,omitempty" group:"log"` HAProxy HAProxyConfiguration `yaml:"-"` FlagLoadDapiStorageData bool `yaml:"-"` // contains filtered or unexported fields }
func (*Configuration) GetClusterCertDir ¶
func (c *Configuration) GetClusterCertDir() string
func (*Configuration) GetClusterModeStorage ¶
func (c *Configuration) GetClusterModeStorage() storage.ClusterModeStorage
func (*Configuration) GetStorageData ¶
func (c *Configuration) GetStorageData() *StorageDataplaneAPIConfiguration
func (*Configuration) GetUsers ¶
func (c *Configuration) GetUsers() storagetype.Users
func (*Configuration) InitSignalHandler ¶
func (c *Configuration) InitSignalHandler()
func (*Configuration) Load ¶
func (c *Configuration) Load() ([]string, error)
func (*Configuration) LoadDataplaneStorageConfig ¶
func (c *Configuration) LoadDataplaneStorageConfig() ([]string, error)
func (*Configuration) LoadRuntimeVars ¶
func (c *Configuration) LoadRuntimeVars(swaggerJSON json.RawMessage, host string, port int) error
func (*Configuration) Save ¶
func (c *Configuration) Save() error
func (*Configuration) SaveClusterModeData ¶
func (c *Configuration) SaveClusterModeData() error
func (*Configuration) SaveConsuls ¶
func (c *Configuration) SaveConsuls(consuls []*models.Consul) error
func (*Configuration) SaveSDAWSRegions ¶
func (c *Configuration) SaveSDAWSRegions() error
func (*Configuration) SaveSDConsuls ¶
func (c *Configuration) SaveSDConsuls() error
func (*Configuration) StopSignalHandler ¶
func (c *Configuration) StopSignalHandler()
func (*Configuration) UnSubscribeAll ¶
func (c *Configuration) UnSubscribeAll()
type HAProxyConfiguration ¶
type HAProxyConfiguration struct { SpoeDir string `long:"spoe-dir" description:"Path to SPOE directory." default:"/etc/haproxy/spoe" group:"resources"` ServiceName string `long:"service" description:"Name of the HAProxy service" group:"reload"` HAProxy string `short:"b" long:"haproxy-bin" description:"Path to the haproxy binary file" default:"haproxy" group:"haproxy"` UserListFile string `` /* 191-byte string literal not displayed */ ReloadCmd string `short:"r" long:"reload-cmd" description:"Reload command" group:"reload"` RestartCmd string `short:"s" long:"restart-cmd" description:"Restart command" group:"reload"` StatusCmd string `long:"status-cmd" description:"Status command" group:"reload"` NodeIDFile string `` /* 154-byte string literal not displayed */ PIDFile string `` /* 136-byte string literal not displayed */ ReloadStrategy string `long:"reload-strategy" description:"Either systemd, s6 or custom" default:"custom" group:"reload"` TransactionDir string `short:"t" long:"transaction-dir" description:"Path to the transaction directory" default:"/tmp/haproxy" group:"transaction"` ValidateCmd string `long:"validate-cmd" description:"Executes a custom command to perform the HAProxy configuration check" group:"reload"` BackupsDir string `long:"backups-dir" description:"Path to directory in which to place backup files" group:"transaction"` MapsDir string `` /* 137-byte string literal not displayed */ SpoeTransactionDir string `` /* 126-byte string literal not displayed */ DataplaneConfig string `short:"f" description:"Path to the dataplane configuration file" default:"/etc/haproxy/dataplaneapi.yaml" yaml:"-"` ConfigFile string `` /* 132-byte string literal not displayed */ Userlist string `` /* 147-byte string literal not displayed */ MasterRuntime string `short:"m" long:"master-runtime" description:"Path to the master Runtime API socket" group:"haproxy"` SSLCertsDir string `long:"ssl-certs-dir" description:"Path to SSL certificates directory" default:"/etc/haproxy/ssl" group:"resources"` GeneralStorageDir string `long:"general-storage-dir" description:"Path to general storage directory" default:"/etc/haproxy/general" group:"resources"` ClusterTLSCertDir string `` /* 163-byte string literal not displayed */ DataplaneStorageDir string `` /* 138-byte string literal not displayed */ PreferredTimeSuffix string `` /* 167-byte string literal not displayed */ UpdateMapFilesPeriod int64 `` /* 135-byte string literal not displayed */ ReloadDelay int `short:"d" long:"reload-delay" description:"Minimum delay between two reloads (in s)" default:"5" group:"reload"` MaxOpenTransactions int64 `long:"max-open-transactions" description:"Limit for active transaction in pending state" default:"20" group:"transaction"` BackupsNumber int `` /* 184-byte string literal not displayed */ ReloadRetention int `` /* 128-byte string literal not displayed */ UID int `long:"uid" description:"User id value to set on start" group:"dataplaneapi" example:"1000"` GID int `long:"gid" description:"Group id value to set on start" group:"dataplaneapi" example:"1000"` UpdateMapFiles bool `long:"update-map-files" description:"Flag used for syncing map files with runtime maps values" group:"resources"` ShowSystemInfo bool `short:"i" long:"show-system-info" description:"Show system info on info endpoint" group:"dataplaneapi"` MasterWorkerMode bool `long:"master-worker-mode" description:"Flag to enable helpers when running within HAProxy" group:"haproxy"` DisableInotify bool `long:"disable-inotify" description:"Disables inotify watcher for the configuration file" group:"dataplaneapi"` DebugSocketPath string `long:"debug-socket-path" description:"Unix socket path for the debugging command socket" group:"dataplaneapi"` DelayedStartMax time.Duration `` /* 136-byte string literal not displayed */ DelayedStartTick time.Duration `` /* 138-byte string literal not displayed */ }
type MapSync ¶
type MapSync struct {
// contains filtered or unexported fields
}
func NewMapSync ¶
func NewMapSync() *MapSync
func (*MapSync) Sync ¶
func (ms *MapSync) Sync(mp *models.Map, client client_native.HAProxyClient) (bool, error)
Sync syncs one map file to runtime entries
func (*MapSync) SyncAll ¶
func (ms *MapSync) SyncAll(client client_native.HAProxyClient)
SyncAll sync maps file entries with runtime maps entries for all configured files. Missing runtime entries are appended to the map file
type Node ¶
type Node struct { Facts map[string]string `json:"facts"` Address string `json:"address"` APIBasePath string `json:"api_base_path"` APIPassword string `json:"api_password"` APIUser string `json:"api_user"` Certificate string `json:"certificate,omitempty"` Description string `json:"description,omitempty"` ID string `json:"id,omitempty"` Name string `json:"name"` Status string `json:"status"` Type string `json:"type"` Port int64 `json:"port,omitempty"` }
Node is structure required for connection to cluster
type NotifyConfiguration ¶
type NotifyConfiguration struct { BootstrapKeyChanged *ChanNotify `yaml:"-"` ServerStarted *ChanNotify `yaml:"-"` CertificateRefresh *ChanNotify `yaml:"-"` Reload *ChanNotify `yaml:"-"` Shutdown *ChanNotify `yaml:"-"` }
type RuntimeData ¶
type ServiceDiscovery ¶
type Storage ¶
type Storage interface { Load(filename string) error Get() *StorageDataplaneAPIConfiguration Set(cfg *StorageDataplaneAPIConfiguration) SaveAs(filename string) error Save() error }
type StorageDataplaneAPIConfiguration ¶
type StorageDataplaneAPIConfiguration struct { Version *int `yaml:"config_version,omitempty"` Name *string `yaml:"name,omitempty"` DeprecatedMode *string `yaml:"mode,omitempty"` DeprecatedBootstrapKey *string `yaml:"bootstrap_key,omitempty"` DeprecatedStatus *string `yaml:"status,omitempty"` Dataplaneapi *configTypeDataplaneapi `yaml:"dataplaneapi,omitempty"` Haproxy *configTypeHaproxy `yaml:"haproxy,omitempty"` DeprecatedCluster *storagetype.Cluster `yaml:"cluster,omitempty"` DeprecatedServiceDiscovery *storagetypeerviceDiscovery `yaml:"service_discovery,omitempty"` Log *configTypeLog `yaml:"log,omitempty"` LogTargets *dpapilog.Targets `yaml:"log_targets,omitempty"` }
type StorageDummy ¶
type StorageDummy struct {
// contains filtered or unexported fields
}
func (*StorageDummy) Get ¶
func (s *StorageDummy) Get() *StorageDataplaneAPIConfiguration
func (*StorageDummy) Load ¶
func (s *StorageDummy) Load(filename string) error
func (*StorageDummy) Save ¶
func (s *StorageDummy) Save() error
func (*StorageDummy) SaveAs ¶
func (s *StorageDummy) SaveAs(filename string) error
func (*StorageDummy) Set ¶
func (s *StorageDummy) Set(cfg *StorageDataplaneAPIConfiguration)
type StorageYML ¶
type StorageYML struct {
// contains filtered or unexported fields
}
func (*StorageYML) Get ¶
func (s *StorageYML) Get() *StorageDataplaneAPIConfiguration
func (*StorageYML) Load ¶
func (s *StorageYML) Load(filename string) error
func (*StorageYML) Save ¶
func (s *StorageYML) Save() error
func (*StorageYML) SaveAs ¶
func (s *StorageYML) SaveAs(filename string) error
func (*StorageYML) Set ¶
func (s *StorageYML) Set(cfg *StorageDataplaneAPIConfiguration)
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
func GetUsersStore ¶
func GetUsersStore() *Users
Source Files
¶
Click to show internal directories.
Click to hide internal directories.