prometheus

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AWSNodeAppName is the label value for aws-node targets.
	AWSNodeAppName = "aws-node"

	// CadvisorAppName is the label value for Cadvisor targets.
	CadvisorAppName = "cadvisor"

	// CalicoNodeAppName is the label value for calico-node targets.
	CalicoNodeAppName = "calico-node"

	// DockerAppName is the label value for Docker targets.
	DockerAppName = "docker"

	// WorkloadClusterType is the cluster type for workload clusters.
	WorkloadClusterType = "workload_cluster"

	// KubeletAppName is the label value for kubelets.
	KubeletAppName = "kubelet"

	// KubernetesAppName is the label value for Kubernetes API servers.
	KubernetesAppName = "kubernetes"

	// NodeExporterAppName is the label value for node-exporters.
	NodeExporterAppName = "node-exporter"

	// NodeExporterAppName is the label value for node-exporters.
	KubeProxyAppName = "kube-proxy"

	// WorkerRole is the label value used for Kubernetes workers.
	WorkerRole = "worker"

	// ManagedAppsDeployment is the value used to indicate a managed app workload of type Deployment.
	ManagedAppsDeployment = "deployment"

	// ManagedAppsDaemonSet is the value used to indicate a managed app workload of type DaemonSet.
	ManagedAppsDaemonSet = "daemonset"

	// ManagedAppsStatefulSet is the value used to indicate a managed app workload of type StatefulSet.
	ManagedAppsStatefulSet = "statefulset"
)

Giant Swarm metrics schema values.

View Source
const (
	// CadvisorMetricsPath is the path under which cadvisor metrics can be scraped.
	CadvisorMetricsPath = "/api/v1/nodes/${1}:10250/proxy/metrics/cadvisor"

	// DockerMetricsPath is the path under which docker metrics can be scraped.
	DockerMetricsPath = "/api/v1/nodes/${1}:9393/proxy/metrics"

	// NodeExporterPort is the path under which node-exporter metrics can be scraped.
	NodeExporterPort = "${1}:10300"

	// GroupCapture is the regular expression to match against the first capture group.
	GroupCapture = "${1}"
)

Path replacements.

View Source
const (

	// HttpScheme is the scheme for http connections.
	HttpScheme = "http"
	// HttpsScheme is the scheme for https connections.
	HttpsScheme = "https"

	// APIServerJobType is the job type for scraping Kubernetes API servers.
	APIServerJobType = "apiserver"
	// AWSNodeJobType is the job type for scraping aws-node Pods.
	AWSNodeJobType = "aws-node"
	// CadvisorJobType is the job type for scraping Cadvisor.
	CadvisorJobType = "cadvisor"
	// CalicoNodeJobType is the job type for scraping calico-node pods.
	CalicoNodeJobType = "calico-node"
	// DockerDaemonJobType is the job type for scraping docker daemon.
	DockerDaemonJobType = "docker-daemon"
	// EtcdJobType is the job type for scraping etcd.
	EtcdJobType = "etcd"
	// KubeletJobType is the job type for scraping kubelets.
	KubeletJobType = "kubelet"
	// ManagedAppJobType is the job type for scraping managed app metrics.
	ManagedAppJobType = "managed-app"
	// NodeExporterJobType is the job type for scraping node-exporters
	NodeExporterJobType = "node-exporter"
	// WorkloadJobType is the job type for scraping general workloads.
	WorkloadJobType = "workload"
	// IngressJobType is the job type for scraping the ingress controller
	IngressJobType = "ingress"
	// KubeStateManagedAppJobType is the job type for scraping kube-state-metrics-provided endpoints for managed apps.
	KubeStateManagedAppJobType = "kube-state-managed-app"
	// KubeProxyJobType is the job type for scraping node-exporters
	KubeProxyJobType = "kube-proxy"

	// ActionKeep is action type that keeps only matching metrics.
	ActionKeep = "keep"
	// ActionDrop is action type that drops matching metrics.
	ActionDrop = "drop"
	// ActionRelabel is action type that relabel metrics.
	ActionRelabel = "replace"
)
View Source
const (
	// ClusterAnnotation is the Kubernetes annotation that identifies Services
	// that the prometheus-config-controller should scrape.
	ClusterAnnotation = "giantswarm.io/prometheus-cluster"
)

Variables

View Source
var (
	// KubernetesSDNamespaceLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes namespace.
	KubernetesSDNamespaceLabel = model.LabelName("__meta_kubernetes_namespace")

	// KubernetesSDNodeNameLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes node name.
	KubernetesSDNodeNameLabel = model.LabelName("__meta_kubernetes_node_name")

	// KubernetesSDNodeAddressInternalIPLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes node addres internal IP.
	KubernetesSDNodeAddressInternalIPLabel = model.LabelName("__meta_kubernetes_node_address_InternalIP")

	// KubernetesSDNodeLabelRole is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes node role label.
	KubernetesSDNodeLabelRole = model.LabelName("__meta_kubernetes_node_label_role")

	// KubernetesSDPodNameLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes pod name.
	KubernetesSDPodNameLabel = model.LabelName("__meta_kubernetes_pod_name")

	// KubernetesSDPodNodeNameLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes pod node name.
	KubernetesSDPodNodeNameLabel = model.LabelName("__meta_kubernetes_pod_node_name")

	// KubernetesSDServiceNameLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service.
	KubernetesSDServiceNameLabel = model.LabelName("__meta_kubernetes_service_name")

	// KubernetesSDServiceGiantSwarmMonitoringPresentLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service presenting the annotation giantswarm_io_monitoring.
	KubernetesSDServiceGiantSwarmMonitoringPresentLabel = model.LabelName("__meta_kubernetes_service_annotationpresent_giantswarm_io_monitoring")

	// KubernetesSDServiceGiantSwarmMonitoringLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service presenting the annotation giantswarm_io_monitoring as true.
	KubernetesSDServiceGiantSwarmMonitoringLabel = model.LabelName("__meta_kubernetes_service_annotation_giantswarm_io_monitoring")

	// KubernetesSDServiceGiantSwarmMonitoringAppTypeLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service type of managed application (default, optional).
	KubernetesSDServiceGiantSwarmMonitoringAppTypeLabel = model.LabelName("__meta_kubernetes_service_annotation_giantswarm_io_monitoring_app_type")

	// KubernetesSDServiceGiantSwarmMonitoringPathLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service path.
	KubernetesSDServiceGiantSwarmMonitoringPathLabel = model.LabelName("__meta_kubernetes_service_annotation_giantswarm_io_monitoring_path")

	// KubernetesSDServiceGiantSwarmMonitoringPathPresentLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service presenting the annotation giantswarm_io_monitoring_path.
	KubernetesSDServiceGiantSwarmMonitoringPathPresentLabel = model.LabelName("__meta_kubernetes_service_annotationpresent_giantswarm_io_monitoring_path")

	// KubernetesSDServiceGiantSwarmMonitoringPortLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service port number.
	KubernetesSDServiceGiantSwarmMonitoringPortLabel = model.LabelName("__meta_kubernetes_service_annotation_giantswarm_io_monitoring_port")

	// KubernetesSDServiceGiantSwarmMonitoringPortPresentLabel is the label applied to the target
	// by Prometheus Kubernetes service discovery that holds the target's Kubernetes service presenting the annotation giantswarm_io_monitoring_port.
	KubernetesSDServiceGiantSwarmMonitoringPortPresentLabel = model.LabelName("__meta_kubernetes_service_annotationpresent_giantswarm_io_monitoring_port")
)

Prometheus Kubernetes service discovery labels.

View Source
var (
	// MetricExportedNamespaceLabel is label for filtering by k8s namespace in kube-state-metric.
	MetricExportedNamespaceLabel = model.LabelName("exported_namespace")
	// MetricNamespaceLabel is label for filtering by k8s namespace
	MetricNamespaceLabel = model.LabelName("namespace")
	// MetricNameLabel is label for filtering by metric name.
	MetricNameLabel = model.LabelName("__name__")
	// MetricSystemdNameLabel is a label for filtering by systemd unit name.
	MetricSystemdNameLabel = model.LabelName("name")
	// MetricSystemdStateLabel is a label for filtering by systemd unit state.
	MetricSystemdStateLabel = model.LabelName("state")
	// MetricFSTypeLabel is a label for filtering by mount filesystem type.
	MetricFSTypeLabel = model.LabelName("fstype")
	// DeploymentTypeLabel is a label added by kube-state-metrics to Deployment related metrics.
	DeploymentTypeLabel = model.LabelName("deployment")
	// DaemonSetTypeLabel is a label added by kube-state-metrics to DaemonSet related metrics.
	DaemonSetTypeLabel = model.LabelName("daemonset")
	// StatefulSetTypeLabel is a label added by kube-state-metrics to StatefulSet related metrics.
	StatefulSetTypeLabel = model.LabelName("statefulset")
)

Prometheus Kubernetes metrics labels.

View Source
var (
	// PodSDContainerNameLabel is a label applied to the target by Prometheus
	// POD service discovery that holds the target's POD container name.
	PodSDContainerNameLabel = model.LabelName("__meta_kubernetes_pod_container_name")

	// PodSDPodNameLabel is the label applied to the target by Prometheus POD
	// service discovery that holds the target's Kubernetes POD name.
	PodSDPodNameLabel = model.LabelName("__meta_kubernetes_pod_name")

	// PodSDNamespaceLabel is the label applied to the target by Prometheus POD
	// service discovery that holds the target's Kubernetes namespace.
	PodSDNamespaceLabel = model.LabelName("__meta_kubernetes_namespace")

	// PodSDGiantswarmServiceTypeLabel is the label applied to the target by Prometheus POD
	// service discovery that holds the target's Kubernetes pod's label 'giantswarm.io/service_type'.
	PodSDGiantswarmServiceTypeLabel = model.LabelName("__meta_kubernetes_pod_label_giantswarm_io_service_type")
)

Prometheus POD service discovery labels.

View Source
var (
	// AddressLabel is the label used to hold target ip and port.
	AddressLabel = "__address__"

	// AppIsManaged is the label used to mark metrics coming from managed apps marked with "giantswarm.io/monitoring"
	// k8s annotation.
	AppIsManaged = "is_managed_app"

	// AppLabel is the label used to hold the application's name.
	AppLabel = "app"

	// AppTypeLabel is the label used to hold the type of managed application (optional, default), if applicable.
	AppTypeLabel = "app_type"

	// ClusterIDLabel is the label used to hold the cluster's ID.
	ClusterIDLabel = "cluster_id"

	// ClusterTypeLabel is the label used to hold the cluster's type.
	ClusterTypeLabel = "cluster_type"

	// ExportedNamespaceLabel is the label used to hold the application's namespace.
	ExportedNamespaceLabel = "exported_namespace"

	// IPLabel is the label used to hold the machine's IP.
	IPLabel = "ip"

	// KubeStateMetricsForManagedApps is the label used to mark metrics coming from kube-state-metrics
	// for use with managed apps. They are used to show the basic "is deployment OK" metric.
	KubeStateMetricsForManagedApps = "kube_state_metrics_for_managed_app"

	// NamespaceLabel is the label used to hold the application's namespace.
	NamespaceLabel = "namespace"

	// NamespaceKubeSystemLabel is the label for kube-system namespace.
	NamespaceKubeSystemLabel = "kube-system"

	// ManagedAppWorkloadTypeLabel is the label for showing the workload type (deployment, statefulset, daemonset)
	// of a managed app.
	ManagedAppWorkloadTypeLabel = "workload_type"

	// ManagedAppWorkloadNameLabel is the label for storing any workload's name.
	ManagedAppWorkloadNameLabel = "workload_name"

	// MetricPathLabel is the label used to hold the scrape metrics path.
	MetricPathLabel = "__metrics_path__"

	// PodNameLabel is the label used to hold the pod name.
	PodNameLabel = "pod_name"

	// ProviderLabel is the label used to hold the provider type.
	ProviderLabel = "provider"

	// NodeLabel is the label used to hold the node name.
	NodeLabel = "node"

	// RoleLabel is the label used to hold the machine's role.
	RoleLabel = "role"
)

Giant Swarm metrics schema labels.

View Source
var (
	// APIServerRegexp is the regular expression to match against Kubernetes API servers.
	APIServerRegexp = relabel.MustNewRegexp(`default;kubernetes`)

	// AWSNodePodRegexp is the regular expression to match aws-node pod name and namespace.
	AWSNodePodRegexp = relabel.MustNewRegexp(`kube-system;aws-node.*`)

	// AWSNodePodNameRegexp is the regular expression to match aws-node pod name.
	AWSNodePodNameRegexp = relabel.MustNewRegexp(`(aws-node.*)`)

	// CalicoNodePodRegexp is the regular expression to match calico-node pod name and namespace.
	CalicoNodePodRegexp = relabel.MustNewRegexp(`kube-system;calico-node.*`)

	// CalicoNodePodNameRegexp is the regular expression to match calico-node pod name.
	CalicoNodePodNameRegexp = relabel.MustNewRegexp(`(calico-node.*)`)

	// DockerMetricsNameRegexp is the regular expression to keep only Docker metrics which we need for performance tracking.
	DockerMetricsNameRegexp = relabel.MustNewRegexp(`(process_virtual_memory_bytes|process_resident_memory_bytes)`)

	// EmptyRegexp is the regular expression to match against the empty string.
	EmptyRegexp = relabel.MustNewRegexp(``)

	// NonEmptyRegexp is the regular expression to match against the non-empty string.
	NonEmptyRegexp = relabel.MustNewRegexp(`(.+)`)

	// KubeletPortRegexp is the regular expression to match against the
	// Kubelet IP (including port), and capture the IP.
	KubeletPortRegexp = relabel.MustNewRegexp(`(.*):10250`)

	// NSRegexp is the regular expression to match against the specified namespaces.
	NSRegexp = relabel.MustNewRegexp(`(kube-system|giantswarm.*|vault-exporter)`)

	// MetricDropBucketLatencies is the regular expression to match against the several bucket latencies metrics.
	MetricDropBucketLatencies = relabel.MustNewRegexp(`(apiserver_admission_controller_admission_latencies_seconds_.*|apiserver_admission_step_admission_latencies_seconds_.*|apiserver_request_count|apiserver_request_duration_seconds_.*|apiserver_request_latencies_.*|apiserver_request_total|apiserver_response_sizes_.*|rest_client_request_latency_seconds_.*)`)

	// MetricDropContainerNetworkRegexp is the regular expression to match againts cadvisor container network metrics.
	MetricDropContainerNetworkRegexp = relabel.MustNewRegexp(`container_network_.*`)

	// MetricDropFStypeRegexp is the regular expression to match againts not interesting filesystem (for node exporter metrics).
	MetricDropFStypeRegexp = relabel.MustNewRegexp(`(cgroup|devpts|mqueue|nsfs|overlay|tmpfs)`)

	// MetricKeepICRegexp is the regular expression to match against metric exposed by IC with low cardinality.
	MetricKeepICRegexp = relabel.MustNewRegexp(`(nginx_ingress_controller_config_hash|nginx_ingress_controller_config_last_reload_successful|nginx_ingress_controller_config_last_reload_successful_timestamp_seconds|nginx_ingress_controller_nginx_process_connections|nginx_ingress_controller_nginx_process_connections_total|nginx_ingress_controller_nginx_process_cpu_seconds_total|nginx_ingress_controller_nginx_process_num_procs|nginx_ingress_controller_nginx_process_oldest_start_time_seconds|nginx_ingress_controller_nginx_process_read_bytes_total|nginx_ingress_controller_nginx_process_requests_total|nginx_ingress_controller_nginx_process_resident_memory_bytes|nginx_ingress_controller_nginx_process_virtual_memory_bytes|nginx_ingress_controller_nginx_process_write_bytes_total|nginx_ingress_controller_success|^go_.+|^process_.+|^prom.+)`)

	// MetricDropSystemdStateRegexp is the regular expression to match against not interesting systemd unit (for node exporter metrics).
	MetricDropSystemdStateRegexp = relabel.MustNewRegexp(`node_systemd_unit_state;(active|activating|deactivating|inactive)`)

	// MetricDropSystemdNameRegexp is the regular expression to match against not interesting systemd units(docker mounts and calico network devices).
	MetricDropSystemdNameRegexp = relabel.MustNewRegexp(`node_systemd_unit_state;(dev-disk-by|run-docker-netns|sys-devices|sys-subsystem-net|var-lib-docker-overlay2|var-lib-docker-containers|var-lib-kubelet-pods).*`)

	// MetricsDropReflectorRegexp is the regular expression to match against spammy reflector metrics returned by the Kubelet.
	MetricsDropReflectorRegexp = relabel.MustNewRegexp(`(reflector.*)`)

	// ElasticLoggingPodNameRegexp is the regular expression to match elastic-logging-elasticsearch-exporter pod name.
	ElasticLoggingPodNameRegexp = relabel.MustNewRegexp(`(elastic-logging-elasticsearch-exporter.*)`)

	// NginxIngressControllerPodNameRegexp is the regular expression to match nginx ic pod name.
	NginxIngressControllerPodNameRegexp = relabel.MustNewRegexp(`(nginx-ingress-controller.*)`)

	// KubeStateMetricsPodNameRegexp is the regular expression to match kube-state-metrics pod name.
	KubeStateMetricsPodNameRegexp = relabel.MustNewRegexp(`(kube-state-metrics.*)`)

	// KubeStateMetricsServiceNameRegexpis the regular expression to match kube-state-metrics service name.
	KubeStateMetricsServiceNameRegexp = relabel.MustNewRegexp(`(kube-system;kube-state-metrics)`)

	// KubeStateMetricsManagedAppMetricsNameRegexp is the regular expression to keep only KSM metrics realted to SLI of managed apps.
	KubeStateMetricsManagedAppMetricsNameRegexp = relabel.MustNewRegexp(`(kube_deployment_status_replicas_unavailable|kube_deployment_labels|kube_daemonset_status_number_unavailable|kube_daemonset_labels|kube_statefulset_status_replicas|kube_statefulset_status_replicas_current|kube_statefulset_labels)`)

	// ChartOperatorPodNameRegexp is the regular expression to match chart-operator pod name.
	ChartOperatorPodNameRegexp = relabel.MustNewRegexp(`(chart-operator.*)`)

	// CertExporterPodNameRegexp is the regular expression to match cert-exporter pod name.
	CertExporterPodNameRegexp = relabel.MustNewRegexp(`(cert-exporter.*)`)

	// ClusterAutoscalerPodNameRegexp is the regular expression to match cluster-autoscaler pod name.
	ClusterAutoscalerPodNameRegexp = relabel.MustNewRegexp(`(cluster-autoscaler.*)`)

	// CoreDNSPodNameRegexp is the regular expression to match coredns pod name.
	CoreDNSPodNameRegexp = relabel.MustNewRegexp(`(coredns.*)`)

	// KiamPodNameRegexp is the regular expression to match kiam pod name.
	KiamPodNameRegexp = relabel.MustNewRegexp(`(kiam-agent.*|kiam-server.*)`)

	// KiamPodNameRegexpNonManaged is the regular expression to match kiam pod and empty giatnswarm.io/managed-type label, which indicate a non-managed kiam pod.
	KiamPodNameRegexpNonManaged = relabel.MustNewRegexp(`(kiam-agent.*|kiam-server.*);`)

	// KubeProxyPodNameRegexp is the regular expression to match kube-proxy pod name.
	KubeProxyPodNameRegexp = relabel.MustNewRegexp(`(kube-proxy.*)`)

	// MetricsDropReflectorRegexp is the regular expression to match against spammy reflector metrics returned by the Kubelet.
	MetricsKeepKubeProxyIptableRegexp = relabel.MustNewRegexp(`(kubeproxy_sync_proxy_rules_iptables_restore_failures_total)`)

	// NetExporterPodNameRegexp is the regular expression to match net-exporter pod name.
	NetExporterPodNameRegexp = relabel.MustNewRegexp(`(net-exporter.*)`)

	// NicExporterPodNameRegexp is the regular expression to match nic-exporter pod name.
	NicExporterPodNameRegexp = relabel.MustNewRegexp(`(nic-exporter.*)`)

	// VaultExporterPodNameRegexp is the regular expression to match against the
	// vault-exporter name.
	VaultExporterPodNameRegexp = relabel.MustNewRegexp(`(vault-exporter.*)`)

	// RelabelNamespaceRegexp is the regular expression to match against metrics with empty exported_namespace and namespace kube-system.
	RelabelNamespaceRegexp = relabel.MustNewRegexp(`;(kube-system|giantswarm.*|vault-exporter)`)

	ManagedAppSourceRegexp = relabel.MustNewRegexp(`(.*);(.*);(.*);(.*)`)

	// NodeExporterRegexp is the regular expression to match against the
	// node-exporter name.
	NodeExporterRegexp = relabel.MustNewRegexp(`kube-system;node-exporter`)

	// NodeExporterPortRegexp is the regular expression to match against the
	// node-exporter IP (including port), and capture the IP.
	NodeExporterPortRegexp = relabel.MustNewRegexp(`(.*):10300`)

	// ServiceWhitelistRegexp is the regular expression to match workload targets to scrape.
	ServiceWhitelistRegexp = relabel.MustNewRegexp(`(kube-system;(cert-exporter|cluster-autoscaler|coredns|kiam-agent|kiam-server|kube-state-metrics|net-exporter|nic-exporter))|(giantswarm;chart-operator)|(giantswarm-elastic-logging;elastic-logging-elasticsearch-exporter)|(vault-exporter;vault-exporter)`)

	// IngressWhitelistRegexp is the regular expression to match workload targets to scrape.
	IngressWhitelistRegexp = relabel.MustNewRegexp(`(kube-system;nginx-ingress-controller)`)
)

Regular expressions.

View Source
var (
	TestConfigOneApiserver = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-apiserver",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: true,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleEndpoint,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{
					KubernetesSDNamespaceLabel,
					KubernetesSDServiceNameLabel,
				},
				Regex:  APIServerRegexp,
				Action: relabel.Keep,
			},
			{
				TargetLabel: AppLabel,
				Replacement: KubernetesAppName,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
		},
		MetricRelabelConfigs: []*relabel.Config{

			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        MetricDropBucketLatencies,
			},
			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        MetricsDropReflectorRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneAWSNode = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-aws-node",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RolePod,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{PodSDNamespaceLabel, PodSDPodNameLabel},
				Regex:        AWSNodePodRegexp,
				Action:       relabel.Keep,
			},
			{
				TargetLabel:  AppLabel,
				SourceLabels: model.LabelNames{PodSDContainerNameLabel},
			},
			{
				TargetLabel:  NamespaceLabel,
				SourceLabels: model.LabelNames{PodSDNamespaceLabel},
			},
			{
				TargetLabel:  PodNameLabel,
				SourceLabels: model.LabelNames{PodSDPodNameLabel},
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{PodSDPodNameLabel},
				Regex:        AWSNodePodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.AWSNodeNamespace, key.AWSNodeMetricPort),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneCadvisor = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-cadvisor",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleNode,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				TargetLabel: model.AddressLabel,
				Replacement: "apiserver.xa5ly",
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDNodeNameLabel},
				Replacement:  CadvisorMetricsPath,
				TargetLabel:  model.MetricsPathLabel,
			},
			{
				TargetLabel: AppLabel,
				Replacement: CadvisorAppName,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel:  IPLabel,
				SourceLabels: model.LabelNames{KubernetesSDNodeAddressInternalIPLabel},
			},
			{
				TargetLabel:  RoleLabel,
				SourceLabels: model.LabelNames{KubernetesSDNodeLabelRole},
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDNodeLabelRole},
				Regex:        EmptyRegexp,
				Replacement:  WorkerRole,
				TargetLabel:  RoleLabel,
			},
		},
		MetricRelabelConfigs: []*relabel.Config{

			{
				Action:       ActionKeep,
				SourceLabels: model.LabelNames{MetricNamespaceLabel},
				Regex:        NSRegexp,
			},

			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        MetricDropContainerNetworkRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneCalicoNode = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-calico-node",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RolePod,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{PodSDNamespaceLabel, PodSDPodNameLabel},
				Regex:        CalicoNodePodRegexp,
				Action:       relabel.Keep,
			},
			{
				TargetLabel:  AppLabel,
				SourceLabels: model.LabelNames{PodSDContainerNameLabel},
			},
			{
				TargetLabel:  NamespaceLabel,
				SourceLabels: model.LabelNames{PodSDNamespaceLabel},
			},
			{
				TargetLabel:  PodNameLabel,
				SourceLabels: model.LabelNames{PodSDPodNameLabel},
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{PodSDPodNameLabel},
				Regex:        CalicoNodePodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.CalicoNodeNamespace, key.CalicoNodeMetricPort),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneDocker = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-docker-daemon",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleNode,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				TargetLabel: model.AddressLabel,
				Replacement: "apiserver.xa5ly",
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDNodeNameLabel},
				Replacement:  DockerMetricsPath,
				TargetLabel:  model.MetricsPathLabel,
			},
			{
				TargetLabel: AppLabel,
				Replacement: DockerAppName,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel:  IPLabel,
				SourceLabels: model.LabelNames{KubernetesSDNodeAddressInternalIPLabel},
			},
			{
				TargetLabel:  RoleLabel,
				SourceLabels: model.LabelNames{KubernetesSDNodeLabelRole},
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDNodeLabelRole},
				Regex:        EmptyRegexp,
				Replacement:  WorkerRole,
				TargetLabel:  RoleLabel,
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        DockerMetricsNameRegexp,
				Action:       ActionKeep,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneKubelet = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-kubelet",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: true,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleNode,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				TargetLabel: AppLabel,
				Replacement: KubeletAppName,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel:  IPLabel,
				SourceLabels: model.LabelNames{KubernetesSDNodeAddressInternalIPLabel},
			},
			{
				TargetLabel:  RoleLabel,
				SourceLabels: model.LabelNames{KubernetesSDNodeLabelRole},
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDNodeLabelRole},
				Regex:        EmptyRegexp,
				Replacement:  WorkerRole,
				TargetLabel:  RoleLabel,
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        MetricsDropReflectorRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneNodeExporter = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-node-exporter",
		Scheme:  "http",
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleEndpoint,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{
					KubernetesSDNamespaceLabel,
					KubernetesSDServiceNameLabel,
				},
				Regex:  NodeExporterRegexp,
				Action: relabel.Keep,
			},
			{
				SourceLabels: model.LabelNames{model.AddressLabel},
				Regex:        KubeletPortRegexp,
				Replacement:  NodeExporterPort,
				TargetLabel:  model.AddressLabel,
			},
			{
				TargetLabel: AppLabel,
				Replacement: NodeExporterAppName,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				SourceLabels: model.LabelNames{model.AddressLabel},
				Regex:        NodeExporterPortRegexp,
				Replacement:  GroupCapture,
				TargetLabel:  IPLabel,
			},
		},
		MetricRelabelConfigs: []*relabel.Config{

			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricFSTypeLabel},
				Regex:        MetricDropFStypeRegexp,
			},

			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel, MetricSystemdStateLabel},
				Regex:        MetricDropSystemdStateRegexp,
			},

			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel, MetricSystemdNameLabel},
				Regex:        MetricDropSystemdNameRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}

	TestConfigOneKubeProxy = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-kube-proxy",
		Scheme:  "https",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RolePod,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{

			{
				SourceLabels: model.LabelNames{
					KubernetesSDPodNameLabel,
				},
				Regex:  KubeProxyPodNameRegexp,
				Action: relabel.Keep,
			},

			{
				TargetLabel: AppLabel,
				Replacement: KubeProxyAppName,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        KubeProxyPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.KubeProxyNamespace, key.KubeProxyMetricPort),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{

			{
				Action:       ActionKeep,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        MetricsKeepKubeProxyIptableRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}

	TestConfigOneWorkload = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-workload",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		Scheme: "https",
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleEndpoint,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{KubernetesSDNamespaceLabel, KubernetesSDServiceNameLabel},
				Regex:        ServiceWhitelistRegexp,
				Action:       relabel.Keep,
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel, PodSDGiantswarmServiceTypeLabel},
				Regex:        KiamPodNameRegexpNonManaged,
				Action:       relabel.Drop,
			},
			{
				TargetLabel:  AppLabel,
				SourceLabels: model.LabelNames{KubernetesSDServiceNameLabel},
			},
			{
				TargetLabel:  NamespaceLabel,
				SourceLabels: model.LabelNames{KubernetesSDNamespaceLabel},
			},
			{
				TargetLabel:  PodNameLabel,
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
			},
			{
				TargetLabel:  NodeLabel,
				SourceLabels: model.LabelNames{KubernetesSDPodNodeNameLabel},
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        KubeStateMetricsPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.KubeStateMetricsNamespace, key.KubeStateMetricsPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        CalicoNodePodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.CalicoNodeNamespace, key.CalicoNodeMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        ChartOperatorPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.ChartOperatorNamespace, key.ChartOperatorMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        CertExporterPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.CertExporterNamespace, key.CertExporterMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        ClusterAutoscalerPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.ClusterAutoscalerNamespace, key.ClusterAutoscalerMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        CoreDNSPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.CoreDNSNamespace, key.CoreDNSMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        ElasticLoggingPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.ElasticLoggingNamespace, key.ElasticLoggingMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        NetExporterPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.NetExporterNamespace, key.NetExporterMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        NicExporterPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.NicExporterNamespace, key.NicExporterMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        KiamPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.KiamNamespace, key.KiamMetricPort),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        VaultExporterPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.VaultExporterNamespace, key.VaultExporterMetricPort),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				Action:       ActionRelabel,
				SourceLabels: model.LabelNames{MetricExportedNamespaceLabel, MetricNamespaceLabel},
				Regex:        RelabelNamespaceRegexp,
				Replacement:  GroupCapture,
				TargetLabel:  ExportedNamespaceLabel,
			},

			{
				Action:       ActionKeep,
				SourceLabels: model.LabelNames{MetricExportedNamespaceLabel},
				Regex:        NSRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneIngress = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-ingress",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		Scheme: "https",
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleEndpoint,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{KubernetesSDNamespaceLabel, KubernetesSDServiceNameLabel},
				Regex:        IngressWhitelistRegexp,
				Action:       relabel.Keep,
			},
			{
				TargetLabel:  AppLabel,
				SourceLabels: model.LabelNames{KubernetesSDServiceNameLabel},
			},
			{
				TargetLabel:  NamespaceLabel,
				SourceLabels: model.LabelNames{KubernetesSDNamespaceLabel},
			},
			{
				TargetLabel:  PodNameLabel,
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
			},
			{
				TargetLabel:  NodeLabel,
				SourceLabels: model.LabelNames{KubernetesSDPodNodeNameLabel},
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        NginxIngressControllerPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.NginxIngressControllerNamespace, key.NginxIngressControllerMetricPort),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				Action:       ActionRelabel,
				SourceLabels: model.LabelNames{MetricExportedNamespaceLabel, MetricNamespaceLabel},
				Regex:        RelabelNamespaceRegexp,
				Replacement:  GroupCapture,
				TargetLabel:  ExportedNamespaceLabel,
			},
			{
				Action:       ActionKeep,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        MetricKeepICRegexp,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
	TestConfigOneManagedApp = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-managed-app",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		Scheme: "https",
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleEndpoint,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{KubernetesSDServiceGiantSwarmMonitoringPresentLabel},
				Regex:        relabel.MustNewRegexp(`(true)`),
				Action:       relabel.Keep,
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDServiceGiantSwarmMonitoringLabel},
				Regex:        relabel.MustNewRegexp(`(true)`),
				Action:       relabel.Keep,
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDServiceGiantSwarmMonitoringPortPresentLabel},
				Regex:        relabel.MustNewRegexp(`(true)`),
				Action:       relabel.Keep,
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDServiceGiantSwarmMonitoringPathPresentLabel},
				Regex:        relabel.MustNewRegexp(`(true)`),
				Action:       relabel.Keep,
			},
			{
				TargetLabel:  AppLabel,
				SourceLabels: model.LabelNames{KubernetesSDServiceNameLabel},
			},
			{
				TargetLabel:  NamespaceLabel,
				SourceLabels: model.LabelNames{KubernetesSDNamespaceLabel},
			},
			{
				TargetLabel:  PodNameLabel,
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDServiceGiantSwarmMonitoringAppTypeLabel},
				Regex:        relabel.MustNewRegexp(`(optional|default)`),
				TargetLabel:  AppTypeLabel,
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDServiceGiantSwarmMonitoringPresentLabel},
				Regex:        relabel.MustNewRegexp(`(true)`),
				TargetLabel:  AppIsManaged,
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{
					model.LabelName(NamespaceLabel),
					model.LabelName(PodNameLabel),
					KubernetesSDServiceGiantSwarmMonitoringPortLabel,
					KubernetesSDServiceGiantSwarmMonitoringPathLabel},
				Regex:       ManagedAppSourceRegexp,
				TargetLabel: MetricPathLabel,
				Replacement: key.ManagedAppPodMetricsPath(),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
			{
				Action:       ActionDrop,
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        relabel.MustNewRegexp(`(nginx_ingress_controller_request_duration_seconds_bucket|nginx_ingress_controller_response_size_bucket|nginx_ingress_controller_request_size_bucket|nginx_ingress_controller_response_duration_seconds_bucket|nginx_ingress_controller_bytes_sent_bucket)`),
			},
		},
	}
	TestConfigOneKubeStateManagedApp = config.ScrapeConfig{
		JobName: "workload-cluster-xa5ly-kube-state-managed-app",
		HTTPClientConfig: config_util.HTTPClientConfig{
			TLSConfig: config_util.TLSConfig{
				CAFile:             "/certs/xa5ly-ca.pem",
				CertFile:           "/certs/xa5ly-crt.pem",
				KeyFile:            "/certs/xa5ly-key.pem",
				InsecureSkipVerify: false,
			},
		},
		Scheme: "https",
		ServiceDiscoveryConfig: sd_config.ServiceDiscoveryConfig{
			KubernetesSDConfigs: []*kubernetes.SDConfig{
				{
					APIServer: config_util.URL{
						URL: &url.URL{
							Scheme: "https",
							Host:   "apiserver.xa5ly",
						},
					},
					Role: kubernetes.RoleEndpoint,
					HTTPClientConfig: config_util.HTTPClientConfig{
						TLSConfig: config_util.TLSConfig{
							CAFile:             "/certs/xa5ly-ca.pem",
							CertFile:           "/certs/xa5ly-crt.pem",
							KeyFile:            "/certs/xa5ly-key.pem",
							InsecureSkipVerify: false,
						},
					},
				},
			},
		},
		RelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{KubernetesSDNamespaceLabel, KubernetesSDServiceNameLabel},
				Regex:        KubeStateMetricsServiceNameRegexp,
				Action:       relabel.Keep,
			},
			{
				TargetLabel: KubeStateMetricsForManagedApps,
				Replacement: "true",
			},
			{
				TargetLabel: ClusterIDLabel,
				Replacement: "xa5ly",
			},
			{
				TargetLabel: ClusterTypeLabel,
				Replacement: WorkloadClusterType,
			},
			{
				TargetLabel: AddressLabel,
				Replacement: key.APIServiceHost(key.PrefixMaster, "xa5ly"),
			},
			{
				SourceLabels: model.LabelNames{KubernetesSDPodNameLabel},
				Regex:        KubeStateMetricsPodNameRegexp,
				TargetLabel:  MetricPathLabel,
				Replacement:  key.APIProxyPodMetricsPath(key.KubeStateMetricsNamespace, key.KubeStateMetricsPort),
			},
		},
		MetricRelabelConfigs: []*relabel.Config{
			{
				SourceLabels: model.LabelNames{MetricNameLabel},
				Regex:        KubeStateMetricsManagedAppMetricsNameRegexp,
				Action:       ActionKeep,
			},
			{
				SourceLabels: model.LabelNames{MetricExportedNamespaceLabel},
				TargetLabel:  NamespaceLabel,
			},
			{
				SourceLabels: model.LabelNames{DeploymentTypeLabel},
				Regex:        NonEmptyRegexp,
				TargetLabel:  ManagedAppWorkloadTypeLabel,
				Replacement:  ManagedAppsDeployment,
			},
			{
				SourceLabels: model.LabelNames{DaemonSetTypeLabel},
				Regex:        NonEmptyRegexp,
				TargetLabel:  ManagedAppWorkloadTypeLabel,
				Replacement:  ManagedAppsDaemonSet,
			},
			{
				SourceLabels: model.LabelNames{StatefulSetTypeLabel},
				Regex:        NonEmptyRegexp,
				TargetLabel:  ManagedAppWorkloadTypeLabel,
				Replacement:  ManagedAppsStatefulSet,
			},
			{
				SourceLabels: model.LabelNames{DeploymentTypeLabel},
				Regex:        NonEmptyRegexp,
				TargetLabel:  ManagedAppWorkloadNameLabel,
				Replacement:  GroupCapture,
			},
			{
				SourceLabels: model.LabelNames{DaemonSetTypeLabel},
				Regex:        NonEmptyRegexp,
				TargetLabel:  ManagedAppWorkloadNameLabel,
				Replacement:  GroupCapture,
			},
			{
				SourceLabels: model.LabelNames{StatefulSetTypeLabel},
				Regex:        NonEmptyRegexp,
				TargetLabel:  ManagedAppWorkloadNameLabel,
				Replacement:  GroupCapture,
			},
			{
				TargetLabel: ProviderLabel,
				Replacement: "aws-test",
			},
		},
	}
)
View Source
var (
	TestConfigTwoApiserver           config.ScrapeConfig
	TestConfigTwoAWSNode             config.ScrapeConfig
	TestConfigTwoCadvisor            config.ScrapeConfig
	TestConfigTwoCalicoNode          config.ScrapeConfig
	TestConfigTwoDocker              config.ScrapeConfig
	TestConfigTwoKubelet             config.ScrapeConfig
	TestConfigTwoNodeExporter        config.ScrapeConfig
	TestConfigTwoWorkload            config.ScrapeConfig
	TestConfigTwoIngress             config.ScrapeConfig
	TestConfigTwoManagedApp          config.ScrapeConfig
	TestConfigTwoKubeStateManagedApp config.ScrapeConfig
	TestConfigTwoKubeProxy           config.ScrapeConfig
)

Functions

func FilterInvalidServices

func FilterInvalidServices(services []v1.Service) []v1.Service

FilterInvalidServices takes a list of Kubernetes Services, and returns a list of valid Services.

func GetClusterID

func GetClusterID(service v1.Service) string

GetClusterID returns the value of the cluster annotation. Assumed that the service contains this annotation, see `FilterInvalidServices`.

func GetScrapeConfigs

func GetScrapeConfigs(services []v1.Service, metaConfig Config) ([]config.ScrapeConfig, error)

GetScrapeConfigs takes a list of Kubernetes Services, and returns a list of Prometheus ScrapeConfigs.

func IsExecutionFailed

func IsExecutionFailed(err error) bool

IsExecutionFailed asserts executionFailedError.

func IsInvalidConfig

func IsInvalidConfig(err error) bool

IsInvalidConfig asserts invalidConfigError.

func UpdateConfig

func UpdateConfig(promcfg config.Config, scrapeConfigs []config.ScrapeConfig) (config.Config, error)

UpdateConfig takes an existing Prometheus configuration, and a list of Prometheus scrape configurations. A new configuration is returned, that includes both the scrape configurations in the prior configuration, as well as the new scrape configs.

Types

type Config added in v1.1.0

type Config struct {
	CertDirectory string
	Provider      string
}

Jump to

Keyboard shortcuts

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