Documentation ¶
Index ¶
- func GenerateMap(input map[string]string, dedot bool) mapstr.M
- func RemoveUnnecessaryReplicaSetData(obj interface{}) (interface{}, error)
- 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 NewJobMetadataGenerator(cfg *config.C, jobs cache.Store, client k8s.Interface) 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 NewReplicasetMetadataGenerator(cfg *config.C, replicasets cache.Store, client k8s.Interface) 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 ¶
func RemoveUnnecessaryReplicaSetData ¶ added in v0.9.0
func RemoveUnnecessaryReplicaSetData(obj interface{}) (interface{}, error)
RemoveUnnecessaryReplicaSetData removes all data from a ReplicaSet resource, except what we need to compute Pod metadata. This function works for both ReplicaSet and PartialObjectMetadata.
Types ¶
type AddResourceMetadataConfig ¶
type AddResourceMetadataConfig struct { Node *config.C `config:"node"` Namespace *config.C `config:"namespace"` Deployment bool `config:"deployment"` CronJob bool `config:"cronjob"` }
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"` KubeAdm bool `config:"use_kubeadm"` UseRegexInclude bool `config:"use_regex_include"` UseRegexExclude bool `config:"use_regex_exclude"` 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, replicasetWatcher kubernetes.Watcher, jobWatcher kubernetes.Watcher, metaConf *AddResourceMetadataConfig) MetaGen
GetPodMetaGen is a wrapper function that creates a metaGen for pod resource and has embeeded nodeMetaGen and namespaceMetaGen
func NewJobMetadataGenerator ¶ added in v0.6.1
NewJobMetadataGenerator creates a metagen for job resources
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
func NewPodMetadataGenerator ¶
func NewPodMetadataGenerator( cfg *config.C, pods cache.Store, client k8s.Interface, node MetaGen, namespace MetaGen, replicaset MetaGen, job MetaGen, addResourceMetadata *AddResourceMetadataConfig) MetaGen
NewPodMetadataGenerator creates a metagen for pod resources
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource generates metadata for any kubernetes resource
func NewNamespaceAwareResourceMetadataGenerator ¶ added in v0.5.0
func NewNamespaceAwareResourceMetadataGenerator(cfg *config.C, client k8s.Interface, namespace MetaGen) *Resource
NewNamespaceAwareResourceMetadataGenerator creates a metadata generator with informatuon about namespace
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(_ 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