collector

package
v0.0.0-...-821b6bb Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertImages

func ConvertImages(k8Images *[]kubeclient.Image, defaults *CollectorImage, annotationNames *AnnotationNames, runConfig *RunConfig) (*[]CollectorImage, error)

images from kubernetes, convert, clean and store them in the storage

func GetOrDefaultBool

func GetOrDefaultBool(m map[string]string, name string, default_ bool) bool

GetOrDefaultBool returns the value of the given name from the map m or the default value if it doesn't exist.

func GetOrDefaultInt64

func GetOrDefaultInt64(m map[string]string, name string, default_ int64) int64

GetOrDefaultInt64 the value of the given name from the map m or the default value if it doesn't exist.

func GetOrDefaultString

func GetOrDefaultString(m map[string]string, name, default_ string) string

GetOrDefaultString returns the value of the given name from the map m or the default value if it doesn't exist.

func GetOrDefaultStringSlice

func GetOrDefaultStringSlice(m map[string]string, name string, default_ []string) []string

GetOrDefaultStringSlice the value of the given name from the map m or the default value if it doesn't exist.

func JsonIndentMarshal

func JsonIndentMarshal(v any) ([]byte, error)

func Store

func Store(images *[]CollectorImage, storage io.Writer, jsonMarshal JsonMarshal) error

TODO: Write Tests. Not written yet due to upcomming refactor stores images in the provided storager implementation

Types

type AnnotationNames

type AnnotationNames struct {
	Base       string
	Scans      string
	Contact    string
	DefectDojo string
}

type CollectorImage

type CollectorImage struct {
	Namespace string `json:"namespace"`
	Image     string `json:"image"`
	ImageId   string `json:"image_id"`

	// Fields from annotations and labels
	Environment            string   `json:"environment"`
	Product                string   `json:"product"`
	Description            string   `json:"description"`
	AppKubernetesIoName    string   `json:"app_kubernetes_io_name"`
	AppKubernetesIoVersion string   `json:"app_kubernetes_io_version"`
	ContainerType          string   `json:"container_type"`
	Skip                   bool     `json:"skip"`
	NamespaceFilter        string   `json:"namespace_filter"`
	NamespaceFilterNegated string   `json:"namespace_filter_negated"`
	EngagementTags         []string `json:"engagement_tags"`

	Team  string `json:"team"`
	Slack string `json:"slack"`
	Email string `json:"email"`

	IsScanBaseimageLifetime          bool  `json:"is_scan_baseimage_lifetime"`
	IsScanDependencyCheck            bool  `json:"is_scan_dependency_check"`
	IsScanDependencyTrack            bool  `json:"is_scan_dependency_track"`
	IsScanDistroless                 bool  `json:"is_scan_distroless"`
	IsScanLifetime                   bool  `json:"is_scan_lifetime"`
	IsScanMalware                    bool  `json:"is_scan_malware"`
	IsScanNewVersion                 bool  `json:"is_scan_new_version"`
	IsScanRunAsRoot                  bool  `json:"is_scan_runasroot"`
	IsPotentiallyRunningAsRoot       bool  `json:"is_scan_potentially_running_as_root"`
	IsScanRunAsPrivileged            bool  `json:"is_scan_run_as_privileged"`
	IsPotentiallyRunningAsPrivileged bool  `json:"is_scan_potentially_running_as_privileged"`
	ScanLifetimeMaxDays              int64 `json:"scan_lifetime_max_days"`
}

type JsonMarshal

type JsonMarshal func(any) ([]byte, error)

type RunConfig

type RunConfig struct {
	ImageFilter     []string
	NamespaceToTeam []string
}

Jump to

Keyboard shortcuts

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