utils

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PipeMode                 = 0o644
	ScanErasePath            = "/run/eraser.sh/shared-data/scanErase"
	CollectScanPath          = "/run/eraser.sh/shared-data/collectScan"
	EraseCompleteCollectPath = "/run/eraser.sh/shared-data/eraseCompleteCollect"
	EraseCompleteMessage     = "complete"
	EraseCompleteScanPath    = "/run/eraser.sh/shared-data/eraseCompleteScan"

	CRIPath = "/run/cri/cri.sock"

	EnvEraserRuntimeName = "ERASER_RUNTIME_NAME"
)

Variables

View Source
var (
	ErrProtocolNotSupported  = errors.New("protocol not supported")
	ErrEndpointDeprecated    = errors.New("endpoint is deprecated, please consider using full url format")
	ErrOnlySupportUnixSocket = errors.New("only support unix socket endpoint")
)
View Source
var SharedSecurityContext = &corev1.SecurityContext{
	Capabilities: &corev1.Capabilities{
		Drop: []corev1.Capability{"ALL"},
	},
	ReadOnlyRootFilesystem: &trueval,
	SeccompProfile: &corev1.SeccompProfile{
		Type: corev1.SeccompProfileTypeRuntimeDefault,
	},
}

Functions

func BoolPtr

func BoolPtr(b bool) *bool

func GetConn

func GetConn(ctx context.Context, socketPath string) (conn *grpc.ClientConn, err error)

func GetNamespace

func GetNamespace() string

func GetNonRunningImages

func GetNonRunningImages(runningImages map[string]string, allImages []unversioned.Image, idToImageMap map[string]unversioned.Image) map[string]string

func GetRunningImages

func GetRunningImages(containers []*v1.Container, idToImageMap map[string]unversioned.Image) map[string]string

func IsExcluded

func IsExcluded(excluded map[string]struct{}, img string, idToImageMap map[string]unversioned.Image) bool

func ListContainers

func ListContainers(ctx context.Context, runtime v1.RuntimeServiceClient) (list []*v1.Container, err error)

func ListImages

func ListImages(ctx context.Context, images v1.ImageServiceClient) (list []*v1.Image, err error)

func ParseEndpoint

func ParseEndpoint(endpoint string) (string, string, error)

func ParseEndpointWithFallbackProtocol

func ParseEndpointWithFallbackProtocol(endpoint string, fallbackProtocol string) (protocol string, addr string, err error)

func ParseExcluded

func ParseExcluded() (map[string]struct{}, error)

func ParseImageList

func ParseImageList(path string) ([]string, error)

func ProcessRepoDigests

func ProcessRepoDigests(repoDigests []string) ([]string, []error)

func ReadCollectScanPipe

func ReadCollectScanPipe(ctx context.Context) ([]unversioned.Image, error)

func WriteScanErasePipe

func WriteScanErasePipe(vulnerableImages []unversioned.Image) error

Types

type ExclusionList

type ExclusionList struct {
	Excluded []string `json:"excluded"`
}

type MultiFlag

type MultiFlag []string

func (*MultiFlag) Set

func (nss *MultiFlag) Set(s string) error

func (*MultiFlag) String

func (nss *MultiFlag) String() string

Jump to

Keyboard shortcuts

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