Documentation ¶
Index ¶
- Constants
- Variables
- func NewK8sStorer() (*k8sAgentStorage, error)
- func ProcessRequest(r *http.Request, dst interface{}, rw http.ResponseWriter) error
- func ProcessResponse(rw http.ResponseWriter, data interface{}) error
- func UpdateAgentBaseMetrics(am NcAgentMetrics, name string, report, error bool)
- func UpdateAgentProbeMetrics(ai ext_v1.AgentSpec, am AgentMetrics)
- type AgentInfo
- type AgentMetrics
- type AgentStorer
- type AppConfig
- type CheckConnectivityInfo
- type EtcdAgentStorage
- func (s *EtcdAgentStorage) AgentCache() NcAgentCache
- func (h *EtcdAgentStorage) AgentCacheUpdate(key string, ag *ext_v1.AgentSpec)
- func (s *EtcdAgentStorage) CheckAgents() ([]string, []string, error)
- func (h *EtcdAgentStorage) CleanCacheOnDemand(rw http.ResponseWriter)
- func (s *EtcdAgentStorage) GetAgents(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (s *EtcdAgentStorage) GetSingleAgent(rw http.ResponseWriter, r *http.Request, rp httprouter.Params)
- func (s *EtcdAgentStorage) PingETCD() error
- func (h *EtcdAgentStorage) SetKubeClient(cl Proxy)
- func (s *EtcdAgentStorage) UpdateAgents(rw http.ResponseWriter, r *http.Request, rp httprouter.Params) (ext_v1.AgentSpec, error)
- type EtcdConfig
- type Handler
- func (h *Handler) AddMiddleware()
- func (h *Handler) CleanCache(handle httprouter.Handle) httprouter.Handle
- func (h *Handler) CollectAgentsMetrics(checkInterval time.Duration, useKubeClient bool)
- func (h *Handler) ConnectivityCheck(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
- func (h *Handler) SetupRouter()
- func (h *Handler) UpdateAgents(rw http.ResponseWriter, r *http.Request, rp httprouter.Params)
- type K8sConnection
- type KubeProxy
- type NcAgentCache
- type NcAgentMetrics
- type ProbeResult
- type Proxy
Constants ¶
View Source
const AgentLabelKey = "app"
Variables ¶
View Source
var AgentLabelValues = []string{"netchecker-agent", "netchecker-agent-hostnet"}
Functions ¶
func NewK8sStorer ¶ added in v1.2.0
func NewK8sStorer() (*k8sAgentStorage, error)
func ProcessRequest ¶
func ProcessRequest(r *http.Request, dst interface{}, rw http.ResponseWriter) error
func ProcessResponse ¶
func ProcessResponse(rw http.ResponseWriter, data interface{}) error
func UpdateAgentBaseMetrics ¶
func UpdateAgentBaseMetrics(am NcAgentMetrics, name string, report, error bool)
UpdateAgentBaseMetrics function updates basic metrics with reports and error counters
func UpdateAgentProbeMetrics ¶
func UpdateAgentProbeMetrics(ai ext_v1.AgentSpec, am AgentMetrics)
UpdateAgentProbeMetrics function updates HTTP probe metrics.
Types ¶
type AgentInfo ¶
type AgentInfo struct { ReportInterval int `json:"report_interval"` NodeName string `json:"nodename"` PodName string `json:"podname"` HostDate time.Time `json:"hostdate"` LastUpdated time.Time `json:"last_updated"` LookupHost map[string][]string `json:"nslookup"` NetworkProbes []ProbeResult `json:"network_probes"` IPs map[string][]string `json:"ips"` }
AgentInfo is payload structure for keepalive message received from agent.
type AgentMetrics ¶
type AgentMetrics struct { ErrorCount prometheus.Counter ReportCount prometheus.Counter PodName string ErrorsFromLastReport int ProbeConnectionResult *prometheus.GaugeVec ProbeHTTPCode *prometheus.GaugeVec ProbeTotal *prometheus.GaugeVec ProbeContentTransfer *prometheus.GaugeVec ProbeTCPConnection *prometheus.GaugeVec ProbeDNSLookup *prometheus.GaugeVec ProbeConnect *prometheus.GaugeVec ProbeServerProcessing *prometheus.GaugeVec }
AgentMetrics contains Prometheus entities and agent data required for reporting metrics for particular agent.
func NewAgentMetrics ¶
func NewAgentMetrics(ai *ext_v1.AgentSpec) AgentMetrics
NewAgentMetrics setup prometheus metrics
type AgentStorer ¶ added in v1.2.0
type AgentStorer interface { UpdateAgents(http.ResponseWriter, *http.Request, httprouter.Params) (ext_v1.AgentSpec, error) GetSingleAgent(http.ResponseWriter, *http.Request, httprouter.Params) GetAgents(http.ResponseWriter, *http.Request, httprouter.Params) CleanCacheOnDemand(http.ResponseWriter) CheckAgents() ([]string, []string, error) // AgentCache() NcAgentCache // Returns Agent Cache map (RO) AgentCacheUpdate(string, *ext_v1.AgentSpec) // (agentName, agent.Spec) may be interface{} should be used, because format is storage-specific // required for tests SetKubeClient(cl Proxy) }
type AppConfig ¶ added in v1.2.0
type AppConfig struct { sync.Mutex // ensures atomic writes; protects the following fields UseKubeClient bool // use k8s TPR (true) or etcd (false) as a data storage EtcdEndpoints string // endpoints (IPaddress1:PORT1[,IPaddress2:PORT2]) of etcd server // when etcd is being used as a data storage EtcdTree string // Root of NetChecker server etcd tree EtcdCertFile string // SSL certificate file when using HTTPS to connect to etcd EtcdKeyFile string // SSL key file when using HTTPS to connect to etcd EtcdCAFile string // SSL CA file when using HTTPS to connect to etcd HttpListen string // REST API endpoint (IPaddress:PORT) for netchecker server to listen to PingTimeout time.Duration // etcd ping timeout (sec) ReportTTL time.Duration // TTL for Agent report data when etcd is in use (sec) CheckInterval time.Duration // Interval of checking that agents data is up-to-date }
func GetOrCreateConfig ¶ added in v1.2.0
func GetOrCreateConfig() *AppConfig
type CheckConnectivityInfo ¶
type CheckConnectivityInfo struct { Message string `json="message"` Absent []string `json="outdated,omitempty"` Outdated []string `json="absent,omitempty"` }
CheckConnectivityInfo is payload structure for server answer to connectivity check request.
type EtcdAgentStorage ¶ added in v1.2.0
type EtcdAgentStorage struct { sync.Mutex // ensures atomic writes; protects the following fields NcAgentCache NcAgentCache // contains filtered or unexported fields }
func NewEtcdStorer ¶ added in v1.2.0
func NewEtcdStorer() (*EtcdAgentStorage, error)
func (*EtcdAgentStorage) AgentCache ¶ added in v1.2.0
func (s *EtcdAgentStorage) AgentCache() NcAgentCache
func (*EtcdAgentStorage) AgentCacheUpdate ¶ added in v1.2.0
func (h *EtcdAgentStorage) AgentCacheUpdate(key string, ag *ext_v1.AgentSpec)
func (*EtcdAgentStorage) CheckAgents ¶ added in v1.2.0
func (s *EtcdAgentStorage) CheckAgents() ([]string, []string, error)
func (*EtcdAgentStorage) CleanCacheOnDemand ¶ added in v1.2.0
func (h *EtcdAgentStorage) CleanCacheOnDemand(rw http.ResponseWriter)
func (*EtcdAgentStorage) GetAgents ¶ added in v1.2.0
func (s *EtcdAgentStorage) GetAgents(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*EtcdAgentStorage) GetSingleAgent ¶ added in v1.2.0
func (s *EtcdAgentStorage) GetSingleAgent(rw http.ResponseWriter, r *http.Request, rp httprouter.Params)
func (*EtcdAgentStorage) PingETCD ¶ added in v1.2.0
func (s *EtcdAgentStorage) PingETCD() error
func (*EtcdAgentStorage) SetKubeClient ¶ added in v1.2.0
func (h *EtcdAgentStorage) SetKubeClient(cl Proxy)
func (*EtcdAgentStorage) UpdateAgents ¶ added in v1.2.0
func (s *EtcdAgentStorage) UpdateAgents(rw http.ResponseWriter, r *http.Request, rp httprouter.Params) (ext_v1.AgentSpec, error)
type EtcdConfig ¶ added in v1.2.0
type EtcdConfig struct {
// contains filtered or unexported fields
}
type Handler ¶
type Handler struct { Agents AgentStorer Metrics NcAgentMetrics HTTPHandler http.Handler }
func NewHandler ¶
func (*Handler) AddMiddleware ¶
func (h *Handler) AddMiddleware()
func (*Handler) CleanCache ¶
func (h *Handler) CleanCache(handle httprouter.Handle) httprouter.Handle
func (*Handler) CollectAgentsMetrics ¶
func (*Handler) ConnectivityCheck ¶
func (h *Handler) ConnectivityCheck(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)
func (*Handler) SetupRouter ¶
func (h *Handler) SetupRouter()
func (*Handler) UpdateAgents ¶
func (h *Handler) UpdateAgents(rw http.ResponseWriter, r *http.Request, rp httprouter.Params)
type K8sConnection ¶ added in v1.2.0
type K8sConnection struct {
KubeClient Proxy
}
type KubeProxy ¶
type KubeProxy struct {
Client kubernetes.Interface
}
func (*KubeProxy) SetupClientSet ¶
SetupClientSet is a function for initialize kubernetes clientset
type NcAgentCache ¶ added in v1.2.0
type NcAgentMetrics ¶ added in v1.2.0
type NcAgentMetrics map[string]AgentMetrics
Click to show internal directories.
Click to hide internal directories.