Documentation ¶
Index ¶
- func GenerateMap(input map[string]string, dedot bool) mapstr.M
- type AddResourceMetadataConfig
- type ClusterConfiguration
- type ClusterInfo
- type Config
- type FieldOptions
- type MetaGen
- func GetPodMetaGen(cfg *config.C, podWatcher kubernetes.Watcher, nodeWatcher kubernetes.Watcher, ...) MetaGen
- func NewNamespaceMetadataGenerator(cfg *config.C, namespaces cache.Store, client k8s.Interface) MetaGen
- func NewNodeMetadataGenerator(cfg *config.C, nodes cache.Store, client k8s.Interface) MetaGen
- func NewPodMetadataGenerator(cfg *config.C, pods cache.Store, client k8s.Interface, node MetaGen, ...) MetaGen
- func NewServiceMetadataGenerator(cfg *config.C, services cache.Store, namespace MetaGen, client k8s.Interface) MetaGen
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddResourceMetadataConfig ¶
type AddResourceMetadataConfig struct { Node *config.C `config:"node"` Namespace *config.C `config:"namespace"` Deployment bool `config:"deployment"` }
AddResourceMetadataConfig allows adding config for enriching additional resources
func GetDefaultResourceMetadataConfig ¶
func GetDefaultResourceMetadataConfig() *AddResourceMetadataConfig
type ClusterConfiguration ¶
type ClusterInfo ¶
func GetKubernetesClusterIdentifier ¶
GetKubernetesClusterIdentifier returns ClusterInfo for k8s if available
type Config ¶
type Config struct { KubeConfig string `config:"kube_config"` IncludeLabels []string `config:"include_labels"` ExcludeLabels []string `config:"exclude_labels"` IncludeAnnotations []string `config:"include_annotations"` LabelsDedot bool `config:"labels.dedot"` AnnotationsDedot bool `config:"annotations.dedot"` }
Config declares supported configuration for metadata generation
func (*Config) InitDefaults ¶
func (c *Config) InitDefaults()
InitDefaults initializes the defaults for the config.
type FieldOptions ¶
FieldOptions allows additional enrichment to be done on top of existing metadata
func WithFields ¶
func WithFields(key string, value interface{}) FieldOptions
WithFields FieldOption allows adding specific fields into the generated metadata
func WithMetadata ¶
func WithMetadata(kind string) FieldOptions
WithMetadata FieldOption allows adding labels and annotations under sub-resource(kind) example if kind=namespace namespace.labels key will be added
type MetaGen ¶
type MetaGen interface { // Generate generates metadata for a given resource. // Metadata map is formed in the following format: // { // "kubernetes": GenerateK8s(), // "some.ecs.field": "asdf, // populated by GenerateECS() // } // This method is called in top level and returns the complete map of metadata. Generate(kubernetes.Resource, ...FieldOptions) mapstr.M // GenerateFromName generates metadata for a given resource based on it's name GenerateFromName(string, ...FieldOptions) mapstr.M // GenerateK8s generates kubernetes metadata for a given resource GenerateK8s(kubernetes.Resource, ...FieldOptions) mapstr.M // GenerateECS generates ECS metadata for a given resource GenerateECS(kubernetes.Resource) mapstr.M }
MetaGen allows creation of metadata from either Kubernetes resources or their Resource names.
func GetPodMetaGen ¶
func GetPodMetaGen( cfg *config.C, podWatcher kubernetes.Watcher, nodeWatcher kubernetes.Watcher, namespaceWatcher kubernetes.Watcher, metaConf *AddResourceMetadataConfig) MetaGen
GetPodMetaGen is a wrapper function that creates a metaGen for pod resource and has embeeded nodeMetaGen and namespaceMetaGen
func NewNamespaceMetadataGenerator ¶
func NewNamespaceMetadataGenerator(cfg *config.C, namespaces cache.Store, client k8s.Interface) MetaGen
NewNamespaceMetadataGenerator creates a metagen for namespace resources
func NewNodeMetadataGenerator ¶
NewNodeMetadataGenerator creates a metagen for service resources
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource generates metadata for any kubernetes resource
func NewResourceMetadataGenerator ¶
NewResourceMetadataGenerator creates a metadata generator for a generic resource
func (*Resource) Generate ¶
func (r *Resource) Generate(kind string, obj kubernetes.Resource, opts ...FieldOptions) mapstr.M
Generate generates metadata from a resource object Generate method returns metadata in the following form:
{ "kubernetes": {}, "ecs.a.field": 42, }
This method should be called in top level and not as part of other metadata generators. For retrieving metadata without kubernetes. prefix one should call GenerateK8s instead.
func (*Resource) GenerateECS ¶
func (r *Resource) GenerateECS(obj kubernetes.Resource) mapstr.M
GenerateECS generates ECS metadata from a resource object
func (*Resource) GenerateK8s ¶
func (r *Resource) GenerateK8s(kind string, obj kubernetes.Resource, options ...FieldOptions) mapstr.M
GenerateK8s takes a kind and an object and creates metadata for the same