util

package
v0.0.0-...-a159d21 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package util contains utility functions for workload metadata collectors

Index

Constants

View Source
const (
	// SHA256 is the prefix used by containerd for the repo digest
	SHA256 = "@sha256:"
)

Variables

This section is empty.

Functions

func ExtractRepoDigestFromImage

func ExtractRepoDigestFromImage(imageID string, imageRegistry string, store workloadmeta.Component) string

ExtractRepoDigestFromImage extracts the repoDigest from workloadmeta store if it exists and unique the format of repoDigest is "registry/repo@sha256:digest", the format of return value is "sha256:digest"

func GenerateKubeMetadataEntityID

func GenerateKubeMetadataEntityID(group, resource, namespace, name string) workloadmeta.KubeMetadataEntityID

GenerateKubeMetadataEntityID generates and returns a unique entity id for KubernetesMetadata entity for namespaced objects, the id will have the format {group}/{resourceType}/{namespace}/{name} (e.g. app/deployments/default/app ) for cluster scoped objects, the id will have the format {group}/{resourceType}//{name} (e.g. /nodes//master-node)

func LocalProcessCollectorIsEnabled

func LocalProcessCollectorIsEnabled() bool

LocalProcessCollectorIsEnabled returns whether the local process collector is enabled based on agent flavor and config values. This prevents any conflict between the process collectors and unnecessary data collection. Always returns false outside of linux.

func ParseKubeMetadataEntityID

func ParseKubeMetadataEntityID(id workloadmeta.KubeMetadataEntityID) (group, resource, namespace, name string, err error)

ParseKubeMetadataEntityID parses a metadata entity ID and returns the resource type, namespace and resource name. The parsed id should be in the following format: <resourceType>/<namespace>/<name> The namespace field is left empty for cluster-scoped objects. Examples: - app/deployments/default/app - /namespaces//default If the parsed id is malformatted, this function will return empty strings and a non nil error

func UpdateSBOMRepoMetadata

func UpdateSBOMRepoMetadata(sbom *workloadmeta.SBOM, _, _ []string) *workloadmeta.SBOM

UpdateSBOMRepoMetadata does nothing

Types

This section is empty.

Jump to

Keyboard shortcuts

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