config

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	Name  string `yaml:"name"`  // The annotation name.
	Value string `yaml:"value"` // The value of the annotation.
}

An Annotation represent a kubernetes annotation.

type Config

type Config struct {
	DatadogAPIKey          string   // datadog api key for the datadog account
	DatadogAppKey          string   // datadog app key for the datadog account
	ClusterName            string   // A unique name for the cluster
	OwnerTag               string   // A unique tag to identify the owner of monitors
	MonitorDefinitionsPath []string // A url or local path for the configuration file
	Rulesets               *ruleset // The collection of rulesets to manage
	DryRun                 bool     // when set to true monitors will not be managed in datadog
}

Config represents the application configuration.

func GetInstance

func GetInstance() *Config

GetInstance is a singleton that returns the Configuration for the application.

func (*Config) GetBoundMonitors

func (config *Config) GetBoundMonitors(nsAnnotations map[string]string, objectType string, overrides map[string][]Override) *[]ddapi.Monitor

GetBoundMonitors returns a collection of monitors that are indirectly bound to objectTypes in the namespace specified.

func (*Config) GetMatchingMonitors

func (config *Config) GetMatchingMonitors(annotations map[string]string, objectType string, overrides map[string][]Override) *[]ddapi.Monitor

GetMatchingMonitors returns a collection of monitors that apply to the specified objectType and annotations.

func (*Config) GetStaticMonitors added in v1.6.0

func (config *Config) GetStaticMonitors() *[]ddapi.Monitor

GetStaticMonitors returns a collection of monitors from the config file that do not depend on resources in the kube cluster.

type Event

type Event struct {
	EventType    string             // The type of event - update, delete, or create
	Key          string             // A key identifying the object.  This is in the format <object-type>/<object-name>
	Namespace    string             // The namespace of the event's object
	OldMeta      *metav1.ObjectMeta // Metadata from old kubernetes object in update or delete events
	NewMeta      *metav1.ObjectMeta // Metadata from new kubernetes object in update or add events
	ResourceType string             // The type of resource that was updated.
}

An Event represents an update of a Kubernetes object and contains metadata about the update.

type MonitorSet

type MonitorSet struct {
	ObjectType   string                   `yaml:"type"`                    // The type of object.  Example: deployment
	Annotations  []Annotation             `yaml:"match_annotations"`       // Annotations an object must possess to be considered applicable for the monitors.
	BoundObjects []string                 `yaml:"bound_objects,omitempty"` // A collection of ObjectTypes that are bound to the MonitorSet.
	Monitors     map[string]ddapi.Monitor `yaml:"monitors"`                // A collection of Monitors.
}

A MonitorSet represents a collection of Monitors that applies to an object.

func (*MonitorSet) AppendTag

func (mSet *MonitorSet) AppendTag(tag string)

AppendTag appends a tag to every monitor in a MonitorSet

type Override

type Override struct {
	Field string
	Value string
}

Override represents any datadog monitor fields annotations can be overridden

Jump to

Keyboard shortcuts

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