Documentation
¶
Overview ¶
Package config contains the configuration for the application.
Index ¶
Constants ¶
const ( FieldNamespace = "namespace" FieldNode = "node" FieldPod = "pod" FieldResourceType = "resource_type" FieldWorkload = "workload" )
Variables ¶
var ResourceTypeToMetricName = map[ResourceType]string{ Unknown: "unknown", Deployment: "deployment", StatefulSet: "statefulset", Pod: "pod", Node: "node", Namespace: "namespace", Job: "job", CronJob: "cronjob", DaemonSet: "daemonset", IngressClass: "ingressclass", Ingress: "ingress", Service: "service", CustomResourceDefinition: "crd", ReplicaSet: "replicaset", StorageClass: "storageclass", PersistentVolume: "pv", PersistentVolumeClaim: "pcv", GatewayClass: "gatewayclass", Gateway: "gateway", }
Functions ¶
This section is empty.
Types ¶
type Annotations ¶
type Annotations struct {
Enabled bool `yaml:"enabled" default:"false" env:"ANNOTATIONS_ENABLED" env-description:"enable annotations"`
Resources Resources `yaml:"resources"`
Patterns []string `yaml:"patterns" env:"ANNOTATIONS_FILTERS" env-description:"list of annotations regular expressions to filter"`
}
type Certificate ¶
type ConfigAccessor ¶
type ConfigAccessor interface {
// LabelsEnabled checks if labels are enabled globally.
LabelsEnabled() bool
// AnnotationsEnabled checks if annotations are enabled globally.
AnnotationsEnabled() bool
// LabelsEnabledForType checks if labels are enabled for a specific resource type.
LabelsEnabledForType() bool
// AnnotationsEnabledForType checks if annotations are enabled for a specific resource type.
AnnotationsEnabledForType() bool
// ResourceType returns the type of resource associated with the configuration.
ResourceType() ResourceType
// Settings retrieves the configuration settings.
Settings() *Settings
}
ConfigAccessor defines the interface for accessing settings related to labels and annotations. It provides methods to check if labels and annotations are enabled globally or for specific resource types, retrieve the associated resource type, and access the configuration settings.
type Database ¶
type Database struct {
Enabled bool `` /* 150-byte string literal not displayed */
StoragePath string `yaml:"storage_path" default:"/opt/insights" env:"DATABASE_STORAGE_PATH" env-description:"location where to write database"`
RetentionTime time.Duration `` /* 136-byte string literal not displayed */
CleanupInterval time.Duration `yaml:"cleanup_interval" default:"3h" env:"DATABASE_CLEANUP_INTERVAL" env-description:"how often to check for expired data"`
BatchUpdateSize int `` /* 134-byte string literal not displayed */
}
type Files ¶
type Files []string
Files is a custom flag type to handle multiple configuration files
type Filters ¶
type Filters struct {
Labels Labels `yaml:"labels"`
Annotations Annotations `yaml:"annotations"`
Policy bluemonday.Policy
}
type Logging ¶
type Logging struct {
Level string `yaml:"level" default:"info" env:"LOG_LEVEL" env-description:"logging level such as debug, info, error"`
}
type MetricLabelTags ¶
MetricLabelTags represents metric labels attached to a metric that represent annotations or labels; value must be prefixed with "label_"
type MetricLabels ¶
MetricLabels represents any metric label that can be added to a metric; "pod", "namespace", "label_foo" etc.
type RemoteWrite ¶
type RemoteWrite struct {
Host string
MaxBytesPerSend int `` /* 129-byte string literal not displayed */
SendInterval time.Duration `yaml:"send_interval" default:"60s" env:"SEND_INTERVAL" env-description:"interval in seconds to send data"`
SendTimeout time.Duration `yaml:"send_timeout" default:"30s" env:"SEND_TIMEOUT" env-description:"timeout in seconds to send data"`
MaxRetries int `yaml:"max_retries" default:"3" env:"MAX_RETRIES" env-description:"maximum number of retries"`
// contains filtered or unexported fields
}
type ResourceType ¶
type ResourceType int
const ( Unknown ResourceType = iota Deployment StatefulSet Pod Node Namespace Job CronJob DaemonSet IngressClass Ingress Service CustomResourceDefinition ReplicaSet StorageClass PersistentVolume PersistentVolumeClaim GatewayClass Gateway )
type Resources ¶
type Resources struct {
Pods bool `yaml:"pods" default:"true"`
Namespaces bool `yaml:"namespaces" default:"true"`
Deployments bool `yaml:"deployments" default:"false"`
Jobs bool `yaml:"jobs" default:"false"`
CronJobs bool `yaml:"cronjobs" default:"false"` //nolint:tagliatelle // compatibility
StatefulSets bool `yaml:"statefulsets" default:"false"` //nolint:tagliatelle // compatibility
DaemonSets bool `yaml:"daemonsets" default:"false"` //nolint:tagliatelle // compatibility
Nodes bool `yaml:"nodes" default:"false"`
}
type Server ¶
type Server struct {
Mode string `yaml:"mode" default:"http" env:"SERVER_MODE" env-description:"server mode such as http, https"`
Namespace string `yaml:"namespace" env:"NAMESPACE" env-description:"namespace of the webhook"`
Domain string `yaml:"domain" default:"" env:"SERVER_DOMAIN" env-description:"server domain"`
Port uint `yaml:"port" default:"8080" env:"SERVER_PORT" env-description:"server port"`
Profiling bool `yaml:"profiling" default:"false" env:"SERVER_PROFILING" env-description:"enable profiling"`
ReadTimeout time.Duration `yaml:"read_timeout" default:"15s" env:"READ_TIMEOUT" env-description:"server read timeout in seconds"`
WriteTimeout time.Duration `yaml:"write_timeout" default:"15s" env:"WRITE_TIMEOUT" env-description:"server write timeout in seconds"`
IdleTimeout time.Duration `yaml:"idle_timeout" default:"60s" env:"IDLE_TIMEOUT" env-description:"server idle timeout in seconds"`
ReconnectFrequency int `` /* 205-byte string literal not displayed */
}
type Settings ¶
type Settings struct {
CloudAccountID string `yaml:"cloud_account_id" env:"CLOUD_ACCOUNT_ID" env-description:"CSP account ID"`
Region string `yaml:"region" env:"CSP_REGION" env-description:"cloud service provider region"`
ClusterName string `yaml:"cluster_name" env:"CLUSTER_NAME" env-description:"name of the cluster to monitor"`
Destination string `` /* 143-byte string literal not displayed */
APIKeyPath string `yaml:"api_key_path" env:"API_KEY_PATH" env-description:"path to the API key file"`
Server Server `yaml:"server"`
Certificate Certificate `yaml:"certificate"`
Logging Logging `yaml:"logging"`
Database Database `yaml:"database"`
Filters Filters `yaml:"filters"`
RemoteWrite RemoteWrite `yaml:"remote_write"`
K8sClient K8sClient `yaml:"k8s_client"`
LabelMatches []regexp.Regexp
AnnotationMatches []regexp.Regexp
// contains filtered or unexported fields
}
Settings represents the configuration settings for the application.