Documentation ¶
Index ¶
- Constants
- Variables
- func CheckCadvisorHealthOnAllNodes(c clientset.Interface, timeout time.Duration)
- func CleanupAdapter(adapterDeploymentFile string)
- func CleanupDescriptors(service *gcm.Service, projectID string)
- func CreateAdapter(adapterDeploymentFile string) error
- func CreateDescriptors(service *gcm.Service, projectID string) error
- func PrometheusExporterDeployment(name, namespace string, replicas int32, metricValue int64) *appsv1.Deployment
- func SimpleStackdriverExporterDeployment(name, namespace string, replicas int32, metricValue int64) *appsv1.Deployment
- func StackdriverExporterDeployment(name, namespace string, replicas int32, containers []CustomMetricContainerSpec) *appsv1.Deployment
- func StackdriverExporterPod(podName, namespace, podLabel, metricName string, metricValue int64) *corev1.Pod
- type CustomMetricContainerSpec
- type DroppedTarget
- type Metadata
- type Resource
- type Target
- type TargetDiscovery
- type TargetHealth
Constants ¶
const (
// MonitoringScope is the scope for Stackdriver Metadata API
MonitoringScope = "https://www.googleapis.com/auth/monitoring"
)
Variables ¶
var ( // CustomMetricName is the metrics name used in test cases. CustomMetricName = "foo" // UnusedMetricName is the unused metrics name used in test cases. UnusedMetricName = "unused" // CustomMetricValue is the value for CustomMetricName. CustomMetricValue = int64(448) // UnusedMetricValue is the value for UnusedMetricName. UnusedMetricValue = int64(446) // StackdriverExporter is exporter name. StackdriverExporter = "stackdriver-exporter" // HPAPermissions is a ClusterRoleBinding that grants unauthenticated user permissions granted for // HPA for testing purposes, i.e. it should grant permission to read custom metrics. HPAPermissions = &rbac.ClusterRoleBinding{ ObjectMeta: metav1.ObjectMeta{ Name: "custom-metrics-reader", }, RoleRef: rbac.RoleRef{ APIGroup: "rbac.authorization.k8s.io", Kind: "ClusterRole", Name: "system:controller:horizontal-pod-autoscaler", }, Subjects: []rbac.Subject{ { APIGroup: "rbac.authorization.k8s.io", Kind: "Group", Name: "system:unauthenticated", }, }, } // StagingDeploymentsLocation is the location where the adapter deployment files are stored. StagingDeploymentsLocation = "" /* 127-byte string literal not displayed */ // AdapterForOldResourceModel is file name for the old resource model. AdapterForOldResourceModel = "adapter_old_resource_model.yaml" // AdapterForNewResourceModel is file name for the new resource model. AdapterForNewResourceModel = "adapter_new_resource_model.yaml" // AdapterDefault is the default model. AdapterDefault = AdapterForOldResourceModel // ClusterAdminBinding is the cluster rolebinding name for test cases. ClusterAdminBinding = "e2e-test-cluster-admin-binding" )
Functions ¶
func CheckCadvisorHealthOnAllNodes ¶
CheckCadvisorHealthOnAllNodes check cadvisor health via kubelet endpoint
func CleanupAdapter ¶ added in v1.9.0
func CleanupAdapter(adapterDeploymentFile string)
CleanupAdapter deletes Custom Metrics - Stackdriver adapter deployments.
func CleanupDescriptors ¶ added in v1.9.0
CleanupDescriptors deletes descriptors for metrics: CustomMetricName and UnusedMetricName. TODO: Cleanup time series as well
func CreateAdapter ¶ added in v1.9.0
CreateAdapter creates Custom Metrics - Stackdriver adapter adapterDeploymentFile should be a filename for adapter deployment located in StagingDeploymentLocation
func CreateDescriptors ¶ added in v1.9.0
CreateDescriptors creates descriptors for metrics: CustomMetricName and UnusedMetricName.
func PrometheusExporterDeployment ¶ added in v1.10.8
func PrometheusExporterDeployment(name, namespace string, replicas int32, metricValue int64) *appsv1.Deployment
PrometheusExporterDeployment is a Deployment of simple application with two containers one exposing a metric in prometheus format and second a prometheus-to-sd container that scrapes the metric and pushes it to stackdriver.
func SimpleStackdriverExporterDeployment ¶ added in v1.10.8
func SimpleStackdriverExporterDeployment(name, namespace string, replicas int32, metricValue int64) *appsv1.Deployment
SimpleStackdriverExporterDeployment is a Deployment of simple application that exports a metric of fixed value to Stackdriver in a loop.
func StackdriverExporterDeployment ¶ added in v1.9.0
func StackdriverExporterDeployment(name, namespace string, replicas int32, containers []CustomMetricContainerSpec) *appsv1.Deployment
StackdriverExporterDeployment is a Deployment of an application that can expose an arbitrary amount of metrics of fixed value to Stackdriver in a loop. Each metric is exposed by a different container in one pod. The metric names and values are configured via the containers parameter.
Types ¶
type CustomMetricContainerSpec ¶ added in v1.10.8
CustomMetricContainerSpec allows to specify a config for StackdriverExporterDeployment with multiple containers exporting different metrics.
type DroppedTarget ¶ added in v1.11.2
type DroppedTarget struct { // Labels before any processing. DiscoveredLabels map[string]string `json:"discoveredLabels"` }
DroppedTarget has the information for one target that was dropped during relabelling.
type Metadata ¶ added in v1.10.8
type Metadata struct {
Results []map[string]interface{}
}
Metadata has the information fetched from Stackdriver metadata API.
type Resource ¶ added in v1.10.8
type Resource struct {
// contains filtered or unexported fields
}
Resource contains the resource type and labels from Stackdriver metadata API.
type Target ¶ added in v1.11.2
type Target struct { DiscoveredLabels map[string]string `json:"discoveredLabels"` Labels map[string]string `json:"labels"` ScrapeURL string `json:"scrapeUrl"` LastError string `json:"lastError"` LastScrape time.Time `json:"lastScrape"` Health TargetHealth `json:"health"` }
Target has the information for one target.
type TargetDiscovery ¶ added in v1.11.2
type TargetDiscovery struct { ActiveTargets []*Target `json:"activeTargets"` DroppedTargets []*DroppedTarget `json:"droppedTargets"` }
TargetDiscovery has all the active targets.
type TargetHealth ¶ added in v1.11.2
type TargetHealth string
TargetHealth describes the health state of a target.
const ( HealthUnknown TargetHealth = "unknown" HealthGood TargetHealth = "up" HealthBad TargetHealth = "down" )
The possible health states of a target based on the last performed scrape.