config

package
v1.2.8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PullPolicies

func PullPolicies() []string

Types

type APIConfig

type APIConfig struct {
	// Port where the agent API should listen on.
	Port string `json:"port"`

	// Listener used by the agent to serve its API. It takes
	// precedence over the Port field. It is closed by the agent.
	Listener net.Listener

	// Interface name that defines the IP a check should use to reach the agent API.
	IName string `json:"iname" toml:"iname"`

	// Host a check should use to reach the agent. Overrides the IName config param.
	Host string `json:"host" toml:"host"`
}

APIConfig defines the configuration for the agent API.

type AgentConfig

type AgentConfig struct {
	LogLevel       string `toml:"log_level"`
	LogFile        string `toml:"log_file"`
	Timeout        int    `toml:"timeout"` // Timeout to start running a check.
	ConcurrentJobs int    `toml:"concurrent_jobs"`
	// MaxMsgsInterval defines the maximun time, in seconds, the agent can
	// running without reading any message from the queue.
	MaxNoMsgsInterval      int `toml:"max_no_msgs_interval"`
	MaxProcessMessageTimes int `toml:"max_message_processed_times"`
}

AgentConfig defines the higher level configuration for the agent.

type Auth

type Auth struct {
	Server string `toml:"server"`
	User   string `toml:"user"`
	Pass   string `toml:"pass"`
}

type CheckConfig

type CheckConfig struct {
	AbortTimeout int               `toml:"abort_timeout"` // Time to wait for a check container to stop gracefully.
	LogLevel     string            `toml:"log_level"`     // Log level for the check default logger.
	Vars         map[string]string `toml:"vars"`          // Environment variables to inject to checks.
}

CheckConfig defines the configuration for the checks.

type ClusterConfig

type ClusterConfig struct {
	Name   string `toml:"name"`
	Server string `toml:"server"`
}

ClusterConfig defines the configuration for the Kubernetes cluster.

type Config

type Config struct {
	Agent     AgentConfig   `toml:"agent"`
	Stream    StreamConfig  `toml:"stream"`
	SQSReader SQSReader     `toml:"sqs_reader"`
	SQSWriter SQSWriter     `toml:"sqs_writer"`
	S3Writer  S3Writer      `toml:"s3_writer"`
	API       APIConfig     `toml:"api"`
	Check     CheckConfig   `toml:"check"`
	Runtime   RuntimeConfig `toml:"runtime"`
	DataDog   DatadogConfig `toml:"datadog"`
}

Config represents the configuration for the agent.

func ReadConfig

func ReadConfig(configFile string) (Config, error)

ReadConfig reads and parses a configuration file.

type ContextConfig

type ContextConfig struct {
	Name      string `toml:"name"`
	Cluster   string `toml:"cluster"`
	Namespace string `toml:"namespace"`
	User      string `toml:"user"`
}

ContextConfig defines the configuration for the Kubernetes context.

type CredentialsConfig

type CredentialsConfig struct {
	Name  string `toml:"name"`
	Token string `toml:"token"`
}

CredentialsConfig defines the configuration for the Kubernetes user.

type DatadogConfig

type DatadogConfig struct {
	Enabled bool   `toml:"metrics_enabled"`
	Statsd  string `toml:"dogstatsd"`
}

DatadogConfig defines the configuration for DataDog.

type DockerConfig

type DockerConfig struct {
	Registry RegistryConfig `toml:"registry"`
}

DockerConfig defines the configuration for the Docker runtime environment.

type KubernetesConfig

type KubernetesConfig struct {
	Cluster     ClusterConfig     `toml:"cluster"`
	Context     ContextConfig     `toml:"context"`
	Credentials CredentialsConfig `toml:"credentials"`
}

KubernetesConfig defines the configuration for the Kubernetes runtime environment.

type PullPolicy

type PullPolicy int
const (
	PullPolicyIfNotPresent PullPolicy = iota
	PullPolicyAlways
	PullPolicyNever
)

func (*PullPolicy) MarshalText

func (a *PullPolicy) MarshalText() (text []byte, err error)

MarshalText returns string representation of a PullPolicy instance.

func (*PullPolicy) String

func (a *PullPolicy) String() (string, error)

func (*PullPolicy) UnmarshalText

func (a *PullPolicy) UnmarshalText(text []byte) error

UnmarshalText creates a PullPolicy from its string representation.

type RegistryConfig

type RegistryConfig struct {
	Auths               []Auth     `toml:"auths"`
	Server              string     `toml:"server"`
	User                string     `toml:"user"`
	Pass                string     `toml:"pass"`
	BackoffInterval     int        `toml:"backoff_interval"`
	BackoffMaxRetries   int        `toml:"backoff_max_retries"`
	BackoffJitterFactor float64    `toml:"backoff_jitter_factor"`
	PullPolicy          PullPolicy `toml:"pull_policy"`
}

RegistryConfig defines the configuration for the Docker registry.

type RuntimeConfig

type RuntimeConfig struct {
	Docker     DockerConfig     `toml:"docker"`
	Kubernetes KubernetesConfig `toml:"kubernetes"`
}

RuntimeConfig defines the configuration for the check runtimes.

type S3Writer added in v1.1.0

type S3Writer struct {
	BucketReports string `toml:"bucket_reports"`
	BucketLogs    string `toml:"bucket_logs"`
	Region        string `toml:"region"`
	LinkBase      string `toml:"link_base"`
	S3Link        bool   `toml:"s3_link"`
	Endpoint      string `toml:"endpoint"`
	PathStyle     bool   `toml:"path_style"`
}

S3Writer defines the config params from the S3 writer.

type SQSReader

type SQSReader struct {
	Endpoint          string `toml:"endpoint"`
	ARN               string `toml:"arn"`
	VisibilityTimeout int    `toml:"visibility_timeout"`
	PollingInterval   int    `toml:"polling_interval"`
	ProcessQuantum    int    `toml:"process_quantum"`
}

SQSReader defines the config of sqs reader.

type SQSWriter

type SQSWriter struct {
	Endpoint string `toml:"endpoint"`
	ARN      string `toml:"arn"`
}

SQSWriter defines the config params from the sqs writer.

type StreamConfig

type StreamConfig struct {
	Endpoint      string `toml:"endpoint"` // Can be empty if no cancelation mechanism is required
	QueryEndpoint string `toml:"query_endpoint"`
	Timeout       int    `toml:"timeout"`
	Retries       int    `toml:"retries"`
	RetryInterval int    `toml:"retry_interval"`
}

StreamConfig defines the configuration for the event stream.

Jump to

Keyboard shortcuts

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