clusteragent

package
v0.0.0-...-47294c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Overview

Package clusteragent provides clients for the APIs exposed by the Cluster Agent and the Cluster Check Runners.

Index

Constants

View Source
const (

	// RealIPHeader refers to the cluster level check runner ip passed in the request headers
	RealIPHeader = "X-Real-Ip"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CLCRunnerClient

type CLCRunnerClient struct {
	sync.Once
	// contains filtered or unexported fields
}

CLCRunnerClient is required to query the API of Datadog Cluster Level Check Runner

func (*CLCRunnerClient) GetRunnerStats

func (c *CLCRunnerClient) GetRunnerStats(IP string) (types.CLCRunnersStats, error)

GetRunnerStats fetches the runner stats exposed by the Cluster Level Check Runner

func (*CLCRunnerClient) GetRunnerWorkers

func (c *CLCRunnerClient) GetRunnerWorkers(IP string) (types.Workers, error)

GetRunnerWorkers fetches the runner workers information exposed by the Cluster Level Check Runner

func (*CLCRunnerClient) GetVersion

func (c *CLCRunnerClient) GetVersion(IP string) (version.Version, error)

GetVersion fetches the version of the CLC Runner

type CLCRunnerClientInterface

type CLCRunnerClientInterface interface {
	GetVersion(IP string) (version.Version, error)
	GetRunnerStats(IP string) (types.CLCRunnersStats, error)
	GetRunnerWorkers(IP string) (types.Workers, error)
}

CLCRunnerClientInterface is required to query the API of Datadog Cluster Level Check Runner

func GetCLCRunnerClient

func GetCLCRunnerClient() (CLCRunnerClientInterface, error)

GetCLCRunnerClient returns or init the CLCRunnerClient

type DCAClient

type DCAClient struct {
	// contains filtered or unexported fields
}

DCAClient is required to query the API of Datadog cluster agent

func (*DCAClient) ClusterAgentAPIEndpoint

func (c *DCAClient) ClusterAgentAPIEndpoint() string

ClusterAgentAPIEndpoint returns the Agent API Endpoint URL as a string

func (*DCAClient) GetCFAppsMetadataForNode

func (c *DCAClient) GetCFAppsMetadataForNode(nodename string) (map[string][]string, error)

GetCFAppsMetadataForNode returns the CF application tags from the Cluster Agent.

func (*DCAClient) GetClusterCheckConfigs

func (c *DCAClient) GetClusterCheckConfigs(ctx context.Context, identifier string) (types.ConfigResponse, error)

GetClusterCheckConfigs is called by the clustercheck config provider

func (*DCAClient) GetEndpointsCheckConfigs

func (c *DCAClient) GetEndpointsCheckConfigs(ctx context.Context, nodeName string) (types.ConfigResponse, error)

GetEndpointsCheckConfigs is called by the endpointscheck config provider

func (*DCAClient) GetKubernetesClusterID added in v0.9.0

func (c *DCAClient) GetKubernetesClusterID() (string, error)

GetKubernetesClusterID queries the datadog cluster agent to get the Kubernetes cluster ID Prefer calling clustername.GetClusterID which has a cached response

func (*DCAClient) GetKubernetesMetadataNames

func (c *DCAClient) GetKubernetesMetadataNames(nodeName, ns, podName string) ([]string, error)

GetKubernetesMetadataNames queries the datadog cluster agent to get nodeName/podName registered Kubernetes metadata.

func (*DCAClient) GetNamespaceLabels added in v0.9.0

func (c *DCAClient) GetNamespaceLabels(nsName string) (map[string]string, error)

GetNamespaceLabels returns the namespace labels from the Cluster Agent.

func (*DCAClient) GetNamespaceMetadata

func (c *DCAClient) GetNamespaceMetadata(nsName string) (*Metadata, error)

GetNamespaceMetadata returns the namespace metadata from the Cluster Agent.

func (*DCAClient) GetNodeAnnotations

func (c *DCAClient) GetNodeAnnotations(nodeName string) (map[string]string, error)

GetNodeAnnotations returns the node annotations from the Cluster Agent.

func (*DCAClient) GetNodeLabels

func (c *DCAClient) GetNodeLabels(nodeName string) (map[string]string, error)

GetNodeLabels returns the node labels from the Cluster Agent.

func (*DCAClient) GetPodsMetadataForNode

func (c *DCAClient) GetPodsMetadataForNode(nodeName string) (apiv1.NamespacesPodsStringsSet, error)

GetPodsMetadataForNode queries the datadog cluster agent to get nodeName registered Kubernetes pods metadata.

func (*DCAClient) PostClusterCheckStatus

func (c *DCAClient) PostClusterCheckStatus(ctx context.Context, identifier string, status types.NodeStatus) (types.StatusResponse, error)

PostClusterCheckStatus is called by the clustercheck config provider

func (*DCAClient) PostLanguageMetadata

func (c *DCAClient) PostLanguageMetadata(ctx context.Context, data *pbgo.ParentLanguageAnnotationRequest) error

PostLanguageMetadata is called by the core-agent's language detection client

func (*DCAClient) SupportsNamespaceMetadataCollection

func (c *DCAClient) SupportsNamespaceMetadataCollection() bool

SupportsNamespaceMetadataCollection returns true only if the cluster agent supports collecting namespace metadata

func (*DCAClient) Version

func (c *DCAClient) Version(withRefresh bool) version.Version

Version returns ClusterAgentVersion already stored in the DCAClient It refreshes the cached version before returning it if withRefresh is true

type DCAClientInterface

type DCAClientInterface interface {
	Version(withRefresh bool) version.Version
	ClusterAgentAPIEndpoint() string

	GetNodeLabels(nodeName string) (map[string]string, error)
	GetNodeAnnotations(nodeName string) (map[string]string, error)
	GetNamespaceLabels(nsName string) (map[string]string, error)
	GetNamespaceMetadata(nsName string) (*Metadata, error)
	GetPodsMetadataForNode(nodeName string) (apiv1.NamespacesPodsStringsSet, error)
	GetKubernetesMetadataNames(nodeName, ns, podName string) ([]string, error)
	GetCFAppsMetadataForNode(nodename string) (map[string][]string, error)

	PostClusterCheckStatus(ctx context.Context, nodeName string, status types.NodeStatus) (types.StatusResponse, error)
	GetClusterCheckConfigs(ctx context.Context, nodeName string) (types.ConfigResponse, error)
	GetEndpointsCheckConfigs(ctx context.Context, nodeName string) (types.ConfigResponse, error)
	GetKubernetesClusterID() (string, error)

	PostLanguageMetadata(ctx context.Context, data *pbgo.ParentLanguageAnnotationRequest) error
	SupportsNamespaceMetadataCollection() bool
}

DCAClientInterface is required to query the API of Datadog cluster agent

func GetClusterAgentClient

func GetClusterAgentClient() (DCAClientInterface, error)

GetClusterAgentClient returns or init the DCAClient

type Metadata

type Metadata struct {
	Name        string
	Namespace   string
	Annotations map[string]string
	Labels      map[string]string
}

Metadata represents the metadata of a kubernetes resource including its name, namespace, annotations and labels

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL