Documentation ¶
Index ¶
- Constants
- func CollectKubeMetrics(config KubeAgentConfig)
- func SendData(ms *os.File, uid string, mc client.MetricClient) (err error)
- type ClientsetNodeSource
- type ClusterVersion
- type Connection
- type ConnectionMethod
- type Endpoint
- type EndpointMask
- func (m EndpointMask) Available(endpoint Endpoint, method Connection) bool
- func (m EndpointMask) DirectAllowed(endpoint Endpoint) bool
- func (m EndpointMask) Options(endpoint Endpoint) string
- func (m EndpointMask) ProxyAllowed(endpoint Endpoint) bool
- func (m EndpointMask) SetAvailability(endpoint Endpoint, method Connection, available bool)
- func (m EndpointMask) SetUnreachable(endpoint Endpoint)
- func (m EndpointMask) Unreachable(endpoint Endpoint) bool
- type KubeAgentConfig
- type NodeSource
Constants ¶
const DefaultCollectionRetry = 1
const DefaultInformerResync = 24
const (
FatalNodeError = nodeError("unable to retrieve required metrics from any node via direct or proxy connection")
)
Variables ¶
This section is empty.
Functions ¶
func CollectKubeMetrics ¶
func CollectKubeMetrics(config KubeAgentConfig)
CollectKubeMetrics Collects metrics from Kubernetes on a predetermined interval
Types ¶
type ClientsetNodeSource ¶
type ClientsetNodeSource struct {
// contains filtered or unexported fields
}
ClientsetNodeSource implements NodeSource interface
func NewClientsetNodeSource ¶
func NewClientsetNodeSource(clientSet kubernetes.Interface) ClientsetNodeSource
NewClientsetNodeSource returns a ClientsetNodeSource with the given clientSet
func (ClientsetNodeSource) GetReadyNodes ¶
GetReadyNodes fetches the list of nodes from the clientSet and filters down to only ready nodes
func (ClientsetNodeSource) NodeAddress ¶
NodeAddress returns the internal IP address and kubelet port of a given node
type ClusterVersion ¶
type ClusterVersion struct {
// contains filtered or unexported fields
}
ClusterVersion contains a concatenated version number as well as the k8s version discovery info
type Connection ¶
type Connection uint8
Connection is a bitmask that describes the manner(s) in which the agent can connect to an endpoint
const ( // By bitshifting each constant with iota we can use Connection as a bitmask Direct Connection = 1 << iota // 0001 = 1 Proxy // 0010 = 2 // Unreachable defined at end to avoid affecting iota, // as it should always be set to 0 Unreachable Connection = 0 )
func (*Connection) AddMethod ¶
func (c *Connection) AddMethod(method Connection)
AddMethod adds the provided nonzero method to the bitmask (use SetUnreachable for Unreachable)
func (*Connection) ClearMethod ¶
func (c *Connection) ClearMethod(method Connection)
ClearMethod removes the method from the bitmask
func (*Connection) SetUnreachable ¶
func (c *Connection) SetUnreachable()
SetUnreachable sets the connection as unreachable
func (Connection) String ¶
func (c Connection) String() string
type ConnectionMethod ¶
type ConnectionMethod struct { ConnType Connection API nodeAPI FriendlyName string // contains filtered or unexported fields }
type Endpoint ¶
type Endpoint string
Endpoint represents the various metrics endpoints we hit
const ( // NodeStatsSummaryEndpoint the /stats/summary endpoint NodeStatsSummaryEndpoint Endpoint = "/stats/summary" )
type EndpointMask ¶
type EndpointMask map[Endpoint]Connection
EndpointMask a map representing the currently active endpoints. The keys of the map are the currently active endpoints.
func (EndpointMask) Available ¶
func (m EndpointMask) Available(endpoint Endpoint, method Connection) bool
Available gets the availability of an endpoint for the specified connection method
func (EndpointMask) DirectAllowed ¶
func (m EndpointMask) DirectAllowed(endpoint Endpoint) bool
func (EndpointMask) Options ¶
func (m EndpointMask) Options(endpoint Endpoint) string
func (EndpointMask) ProxyAllowed ¶
func (m EndpointMask) ProxyAllowed(endpoint Endpoint) bool
func (EndpointMask) SetAvailability ¶
func (m EndpointMask) SetAvailability(endpoint Endpoint, method Connection, available bool)
SetAvailability sets an endpoint availability state according to the supplied boolean
func (EndpointMask) SetUnreachable ¶
func (m EndpointMask) SetUnreachable(endpoint Endpoint)
func (EndpointMask) Unreachable ¶
func (m EndpointMask) Unreachable(endpoint Endpoint) bool
type KubeAgentConfig ¶
type KubeAgentConfig struct { APIKey string BearerToken string BearerTokenPath string Cert string ClusterName string ClusterHostURL string HeapsterURL string Key string OutboundProxyAuth string OutboundProxy string ForceKubeProxy bool Insecure bool OutboundProxyInsecure bool UseInClusterConfig bool PollInterval int ConcurrentPollers int CollectionRetryLimit uint AgentStartTime time.Time Clientset kubernetes.Interface ClusterVersion ClusterVersion HeapsterProxyURL url.URL OutboundProxyURL url.URL HTTPClient http.Client NodeClient raw.Client InClusterClient raw.Client TLSClientConfig rest.TLSClientConfig Namespace string ScratchDir string NodeMetrics EndpointMask Informers map[string]*cache.SharedIndexInformer InformerResyncInterval int ParseMetricData bool // contains filtered or unexported fields }
KubeAgentConfig K8s agent configuration