Documentation ¶
Overview ¶
Package util contains utility functions for workload metadata collectors
Index ¶
- Constants
- func ExtractRepoDigestFromImage(imageID string, imageRegistry string, store workloadmeta.Component) string
- func GenerateKubeMetadataEntityID(group, resource, namespace, name string) workloadmeta.KubeMetadataEntityID
- func LocalProcessCollectorIsEnabled() bool
- func ParseKubeMetadataEntityID(id workloadmeta.KubeMetadataEntityID) (group, resource, namespace, name string, err error)
- func UpdateSBOMRepoMetadata(sbom *workloadmeta.SBOM, _, _ []string) *workloadmeta.SBOM
Constants ¶
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.