Documentation ¶
Overview ¶
package observek8sattributesprocessor implements a processor which calculates and attaches additional k8s attributes
Index ¶
- Constants
- func FormatLabels(labelMap map[string]string) string
- func NewFactory() processor.Factory
- type Config
- type ConfigMapDataAction
- type CronJobActiveAction
- type DaemonSetSelectorAction
- type DeploymentSelectorAction
- type EndpointsStatusAction
- type IngressLoadBalancerAction
- type IngressRulesAction
- type JobDurationAction
- type JobStatusAction
- type K8sEvent
- type K8sEventProcessorAction
- type K8sEventsProcessor
- func (proc *K8sEventsProcessor) RunActions(obj metav1.Object) (attributes, error)
- func (proc *K8sEventsProcessor) RunBodyActions(obj metav1.Object) (bool, error)
- func (kep *K8sEventsProcessor) Shutdown(_ context.Context) error
- func (kep *K8sEventsProcessor) Start(_ context.Context, _ component.Host) error
- type NodePoolAction
- type NodeRolesAction
- type NodeStatusAction
- type PersistentVolumeClaimSelectorAction
- type PersistentVolumeTypeAction
- type PodConditionsAction
- type PodContainersCountsAction
- type PodCronJobNameAction
- type PodDaemonSetNameAction
- type PodJobNameAction
- type PodReadinessAction
- type PodStatefulSetNameAction
- type PodStatusAction
- type SecretRedactorBodyAction
- type ServiceAccountImagePullSecretsAction
- type ServiceAccountSecretsAction
- type ServiceAccountSecretsNamesAction
- type ServiceExternalIPsAction
- type ServiceLBIngressAction
- type ServicePortsAction
- type ServiceSelectorAction
- type Set
- type StatefulSetSelectorAction
Constants ¶
const ( IngressRulesAttributeKey = "rules" IngressLoadBalancerAttributeKey = "loadBalancer" )
const ( JobStatusAttributeKey = "status" JobDurationAttributeKey = "duration" )
const ( NodeStatusAttributeKey = "status" NodePoolAttributeKey = "nodePool" NodeRolesAttributeKey = "roles" )
const ( PodStatusAttributeKey = "status" PodContainerRestartsAttributeKey = "restarts" PodTotalContainersAttributeKey = "total_containers" PodReadyContainersAttributeKey = "ready_containers" PodReadinessGatesReadyAttributeKey = "readinessGatesReady" PodReadinessGatesTotalAttributeKey = "readinessGatesTotal" PodConditionsAttributeKey = "conditions" PodCronJobNameAttributeKey = "cronJobName" OwnerKindCronJob = "CronJob" PodJobNameAttributeKey = "jobName" OwnerKindJob = "Job" PodDaemonSetNameAttributeKey = "daemonSetName" OwnerKindDaemonSet = "DaemonSet" PodStatefulSetNameAttributeKey = "statefulSetName" OwnerKindStatefulSet = "StatefulSet" )
const ( // CORE EventKindPod = "Pod" EventKindNode = "Node" EventKindService = "Service" EventKindServiceAccount = "ServiceAccount" EventKindEndpoints = "Endpoints" EventKindConfigMap = "ConfigMap" EventKindSecret = "Secret" // APPS EventKindStatefulSet = "StatefulSet" EventKindDaemonSet = "DaemonSet" EventKindDeployment = "Deployment" // WORKLOAD EventKindJob = "Job" EventKindCronJob = "CronJob" // STORAGE EventKindPersistentVolume = "PersistentVolume" EventKindPersistentVolumeClaim = "PersistentVolumeClaim" // NETWORK EventKindIngress = "Ingress" )
const ( ServiceAccountSecretsNamesAttributeKey = "secretsNames" ServiceAccountSecretsAttributeKey = "secrets" ServiceAccountImagePullSecretsAttributeKey = "imagePullSecrets" )
const ( ServiceLBIngressAttributeKey = "loadBalancerIngress" ServiceExternalIPsAttributeKey = "externalIPs" ServicePortsAttributeKey = "ports" )
const (
ConfigMapDataAttributeKey = "data"
)
const (
CronJobActiveKey = "activeJobs"
)
const (
DaemonSetSelectorAttributeKey = "selector"
)
const (
DeploymentSelectorAttributeKey = "selector"
)
const (
EnpdointsAttributeKey = "endpoints"
)
const (
PersistentVolumeClaimSelectorAttributeKey = "selector"
)
const (
PersistentVolumeTypeAttributeKey = "volumeType"
)
const (
RedactedSecretValue = "REDACTED"
)
const (
StatefulsetSelectorAttributeKey = "selector"
)
Variables ¶
This section is empty.
Functions ¶
func FormatLabels ¶
FormatLabels converts label map into plain string
func NewFactory ¶
Types ¶
type ConfigMapDataAction ¶
type ConfigMapDataAction struct{}
func NewConfigMapDataAction ¶
func NewConfigMapDataAction() ConfigMapDataAction
func (ConfigMapDataAction) ComputeAttributes ¶
func (ConfigMapDataAction) ComputeAttributes(configMap corev1.ConfigMap) (attributes, error)
Generates the ConfigMap "data" facet, calculated as the total number of entries in data and binaryData
type CronJobActiveAction ¶
type CronJobActiveAction struct{}
func NewCronJobActiveAction ¶
func NewCronJobActiveAction() CronJobActiveAction
func (CronJobActiveAction) ComputeAttributes ¶
func (CronJobActiveAction) ComputeAttributes(cronJob batch.CronJob) (attributes, error)
Generates the CronJob "active" facet. This is essentially just the length of a slice. However, since the slice's inner type is not of the accepted ValueTypes for OTTL's Len() function, computing this requires a custom processor
type DaemonSetSelectorAction ¶
type DaemonSetSelectorAction struct{}
func NewDaemonSetSelectorAction ¶
func NewDaemonSetSelectorAction() DaemonSetSelectorAction
func (DaemonSetSelectorAction) ComputeAttributes ¶
func (DaemonSetSelectorAction) ComputeAttributes(daemonset appsv1.DaemonSet) (attributes, error)
Generates the DaemonSet "selector" facet.
type DeploymentSelectorAction ¶
type DeploymentSelectorAction struct{}
func NewDeploymentSelectorAction ¶
func NewDeploymentSelectorAction() DeploymentSelectorAction
func (DeploymentSelectorAction) ComputeAttributes ¶
func (DeploymentSelectorAction) ComputeAttributes(deployment appsv1.Deployment) (attributes, error)
Generates the Deployment "selector" facet.
type EndpointsStatusAction ¶
type EndpointsStatusAction struct{}
func NewEndpointsStatusAction ¶
func NewEndpointsStatusAction() EndpointsStatusAction
func (EndpointsStatusAction) ComputeAttributes ¶
func (EndpointsStatusAction) ComputeAttributes(endpoints corev1.Endpoints) (attributes, error)
Generates the Endpoints "endpoints" facet, which is a list of all individual endpoints, encoded as strings
type IngressLoadBalancerAction ¶
type IngressLoadBalancerAction struct{}
func NewIngressLoadBalancerAction ¶
func NewIngressLoadBalancerAction() IngressLoadBalancerAction
func (IngressLoadBalancerAction) ComputeAttributes ¶
func (IngressLoadBalancerAction) ComputeAttributes(ingress netv1.Ingress) (attributes, error)
Generates the Ingress "loadBalancer" facet.
type IngressRulesAction ¶
type IngressRulesAction struct{}
func NewIngressRulesAction ¶
func NewIngressRulesAction() IngressRulesAction
func (IngressRulesAction) ComputeAttributes ¶
func (IngressRulesAction) ComputeAttributes(ingress netv1.Ingress) (attributes, error)
Generates the Ingress "rules" facet.
type JobDurationAction ¶
type JobDurationAction struct{}
func NewJobDurationAction ¶
func NewJobDurationAction() JobDurationAction
func (JobDurationAction) ComputeAttributes ¶
func (JobDurationAction) ComputeAttributes(job batch.Job) (attributes, error)
Generates the Job "duration" facet. Same logic as kubectl printer
type JobStatusAction ¶
type JobStatusAction struct{}
func NewJobStatusAction ¶
func NewJobStatusAction() JobStatusAction
func (JobStatusAction) ComputeAttributes ¶
func (JobStatusAction) ComputeAttributes(job batch.Job) (attributes, error)
Generates the Job "status" facet. Same logic as kubectl printer https://github.com/kubernetes/kubernetes/blob/0d3b859af81e6a5f869a7766c8d45afd1c600b04/pkg/printers/internalversion/printers.go#L1204
type K8sEventProcessorAction ¶
type K8sEventProcessorAction interface { // Computes attributes for a k8s entity. Since entities like Pod, Node, // etc. don't have a common interface, the argument of ComputeAttributes is // of type any types that implement this method should check that the arg is // of the right type before proceeding. // Check the utility functions below for more info ComputeAttributes(any) (attributes, error) }
Action that processes a K8S object and computes custom attributes for it
type K8sEventsProcessor ¶
type K8sEventsProcessor struct {
// contains filtered or unexported fields
}
func (*K8sEventsProcessor) RunActions ¶
func (proc *K8sEventsProcessor) RunActions(obj metav1.Object) (attributes, error)
Runs actions that generate new attributes for an (unmarshalled) object.
func (*K8sEventsProcessor) RunBodyActions ¶
func (proc *K8sEventsProcessor) RunBodyActions(obj metav1.Object) (bool, error)
Runs actions that modify parts of the body of this event IN PLACE. Since we want these actions to modify body attributes, these actions intentionally DO NOT DeepCopy() the object and must run BEFORE the actions that generate new attributes. This is useful, for instance, when we want to redact secrets' values, to prevent generating attributes that contain secret's values before redacting them. Returns true if the object was modified by any action, false otherwise
type NodePoolAction ¶
type NodePoolAction struct{}
func NewNodePoolAction ¶
func NewNodePoolAction() NodePoolAction
func (NodePoolAction) ComputeAttributes ¶
func (NodePoolAction) ComputeAttributes(node v1.Node) (attributes, error)
Discover the Node "pool" facet. This facet is not provided natively by Kubernetes, so it will be present only when using a managed deployment/service provided by either of the vendors listed above.
type NodeRolesAction ¶
type NodeRolesAction struct{}
func NewNodeRolesAction ¶
func NewNodeRolesAction() NodeRolesAction
func (NodeRolesAction) ComputeAttributes ¶
func (NodeRolesAction) ComputeAttributes(node v1.Node) (attributes, error)
Generates the Node "roles" facet.
type NodeStatusAction ¶
type NodeStatusAction struct{}
func NewNodeStatusAction ¶
func NewNodeStatusAction() NodeStatusAction
func (NodeStatusAction) ComputeAttributes ¶
func (NodeStatusAction) ComputeAttributes(node v1.Node) (attributes, error)
Generates the Node "status" facet. Assumes that objLog is a log from a Node event.
type PersistentVolumeClaimSelectorAction ¶
type PersistentVolumeClaimSelectorAction struct{}
func NewPersistentVolumeClaimSelectorAction ¶
func NewPersistentVolumeClaimSelectorAction() PersistentVolumeClaimSelectorAction
func (PersistentVolumeClaimSelectorAction) ComputeAttributes ¶
func (PersistentVolumeClaimSelectorAction) ComputeAttributes(pvc corev1.PersistentVolumeClaim) (attributes, error)
Generates the PersistentVolumeClaim "selector" facet.
type PersistentVolumeTypeAction ¶
type PersistentVolumeTypeAction struct{}
func NewPersistentVolumeTypeAction ¶
func NewPersistentVolumeTypeAction() PersistentVolumeTypeAction
func (PersistentVolumeTypeAction) ComputeAttributes ¶
func (PersistentVolumeTypeAction) ComputeAttributes(pvc corev1.PersistentVolume) (attributes, error)
Generates the PersistentVolume "type" facet.
type PodConditionsAction ¶
type PodConditionsAction struct{}
Gather all Pod conditions into a single facet named "conditions"
func NewPodConditionsAction ¶
func NewPodConditionsAction() PodConditionsAction
func (PodConditionsAction) ComputeAttributes ¶
func (PodConditionsAction) ComputeAttributes(pod v1.Pod) (attributes, error)
type PodContainersCountsAction ¶
type PodContainersCountsAction struct{}
This action computes various facets for Pod by aggregating "status" values across all containers of a Pod.
We compute more facets into a single action to avoid iterating over the same slice multiple times in different actions.
func NewPodContainersCountsAction ¶
func NewPodContainersCountsAction() PodContainersCountsAction
func (PodContainersCountsAction) ComputeAttributes ¶
func (PodContainersCountsAction) ComputeAttributes(pod v1.Pod) (attributes, error)
type PodCronJobNameAction ¶
type PodCronJobNameAction struct{}
func NewPodCronJobNameAction ¶
func NewPodCronJobNameAction() PodCronJobNameAction
func (PodCronJobNameAction) ComputeAttributes ¶
func (PodCronJobNameAction) ComputeAttributes(pod v1.Pod) (attributes, error)
Name of the cronJob this Pod belongs to (only present if the owner is a CronJob resource)
type PodDaemonSetNameAction ¶
type PodDaemonSetNameAction struct{}
func NewPodDaemonSetNameAction ¶
func NewPodDaemonSetNameAction() PodDaemonSetNameAction
func (PodDaemonSetNameAction) ComputeAttributes ¶
func (PodDaemonSetNameAction) ComputeAttributes(pod v1.Pod) (attributes, error)
Name of the cronJob this Pod belongs to (only present if the owner is a DaemonSet resource)
type PodJobNameAction ¶
type PodJobNameAction struct{}
func NewPodJobAction ¶
func NewPodJobAction() PodJobNameAction
func (PodJobNameAction) ComputeAttributes ¶
func (PodJobNameAction) ComputeAttributes(pod v1.Pod) (attributes, error)
Name of the job this Pod belongs to (only present if the owner is a Job resource)
type PodReadinessAction ¶
type PodReadinessAction struct{}
func NewPodReadinessAction ¶
func NewPodReadinessAction() PodReadinessAction
func (PodReadinessAction) ComputeAttributes ¶
func (PodReadinessAction) ComputeAttributes(pod v1.Pod) (attributes, error)
type PodStatefulSetNameAction ¶
type PodStatefulSetNameAction struct{}
func NewPodStatefulSetNameAction ¶
func NewPodStatefulSetNameAction() PodStatefulSetNameAction
func (PodStatefulSetNameAction) ComputeAttributes ¶
func (PodStatefulSetNameAction) ComputeAttributes(pod v1.Pod) (attributes, error)
Name of the cronJob this Pod belongs to (only present if the owner is a StatefulSet resource)
type PodStatusAction ¶
type PodStatusAction struct{}
func NewPodStatusAction ¶
func NewPodStatusAction() PodStatusAction
func (PodStatusAction) ComputeAttributes ¶
func (PodStatusAction) ComputeAttributes(pod v1.Pod) (attributes, error)
Generates the Pod "status" facet.
type SecretRedactorBodyAction ¶
type SecretRedactorBodyAction struct{}
func NewSecretRedactorBodyAction ¶
func NewSecretRedactorBodyAction() SecretRedactorBodyAction
type ServiceAccountImagePullSecretsAction ¶
type ServiceAccountImagePullSecretsAction struct{}
func NewServiceAccountImagePullSecretsAction ¶
func NewServiceAccountImagePullSecretsAction() ServiceAccountImagePullSecretsAction
func (ServiceAccountImagePullSecretsAction) ComputeAttributes ¶
func (ServiceAccountImagePullSecretsAction) ComputeAttributes(serviceAccount corev1.ServiceAccount) (attributes, error)
Generates the ServiceAccount "ImagePullSecrets" facet.
type ServiceAccountSecretsAction ¶
type ServiceAccountSecretsAction struct{}
func NewServiceAccountSecretsAction ¶
func NewServiceAccountSecretsAction() ServiceAccountSecretsAction
func (ServiceAccountSecretsAction) ComputeAttributes ¶
func (ServiceAccountSecretsAction) ComputeAttributes(serviceAccount corev1.ServiceAccount) (attributes, error)
Generates the ServiceAccount "secrets" facet.
type ServiceAccountSecretsNamesAction ¶
type ServiceAccountSecretsNamesAction struct{}
func NewServiceAccountSecretsNamesAction ¶
func NewServiceAccountSecretsNamesAction() ServiceAccountSecretsNamesAction
func (ServiceAccountSecretsNamesAction) ComputeAttributes ¶
func (ServiceAccountSecretsNamesAction) ComputeAttributes(serviceAccount corev1.ServiceAccount) (attributes, error)
Generates the ServiceAccount "secretsNames" facet.
type ServiceExternalIPsAction ¶
type ServiceExternalIPsAction struct{}
func NewServiceExternalIPsAction ¶
func NewServiceExternalIPsAction() ServiceExternalIPsAction
func (ServiceExternalIPsAction) ComputeAttributes ¶
func (ServiceExternalIPsAction) ComputeAttributes(service corev1.Service) (attributes, error)
Generates the Service "loadBalancerIngress" facet. We return an array of IPs (even if there's only a single IP) if there is at least one. We set the facet to a string (no array in this case) as follows:
- "None" --> service != LoadBalancer and there are no external IPs - "Pending" --> service is a LoadBalancer and there are no external IPs - "Unknown" --> service is of an unknown type
type ServiceLBIngressAction ¶
type ServiceLBIngressAction struct{}
func NewServiceLBIngressAction ¶
func NewServiceLBIngressAction() ServiceLBIngressAction
func (ServiceLBIngressAction) ComputeAttributes ¶
func (ServiceLBIngressAction) ComputeAttributes(service corev1.Service) (attributes, error)
Generates the Service "loadBalancerIngress" facet.
type ServicePortsAction ¶
type ServicePortsAction struct{}
func NewServicePortsAction ¶
func NewServicePortsAction() ServicePortsAction
func (ServicePortsAction) ComputeAttributes ¶
func (ServicePortsAction) ComputeAttributes(service corev1.Service) (attributes, error)
Generates the Service "ports" facet.
type ServiceSelectorAction ¶
type ServiceSelectorAction struct{}
func NewServiceSelectorAction ¶
func NewServiceSelectorAction() ServiceSelectorAction
func (ServiceSelectorAction) ComputeAttributes ¶
func (ServiceSelectorAction) ComputeAttributes(service corev1.Service) (attributes, error)
Generates the Service "selector" facet.
type StatefulSetSelectorAction ¶
type StatefulSetSelectorAction struct{}
func NewStatefulsetSelectorAction ¶
func NewStatefulsetSelectorAction() StatefulSetSelectorAction
func (StatefulSetSelectorAction) ComputeAttributes ¶
func (StatefulSetSelectorAction) ComputeAttributes(statefulSet appsv1.StatefulSet) (attributes, error)
Generates the Statefulset "selector" facet.
Source Files ¶
- config.go
- configmapactions.go
- cronjobactions.go
- daemonsetactions.go
- deploymentactions.go
- doc.go
- endpointsactions.go
- factory.go
- ingressactions.go
- jobactions.go
- nodeactions.go
- persistentvolumeactions.go
- persistentvolumeclaimactions.go
- podactions.go
- processor.go
- secretactions.go
- serviceaccountactions.go
- serviceactions.go
- statefulsetactions.go
- types.go