gc

package
v1.0.1-0...-217e09f Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: BlueOak-1.0.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ReservedImages = []string{
	"drone/drone:*",
	"drone/agent:*",
	"drone/gc:*",
	"drone/autoscaler:*",
}

ReservedImages provides a list of reserved images names that should not be removed.

View Source
var ReservedNames = []string{
	"drone",
	"drone-server",
	"agent",
	"drone-agent",
	"gc",
	"drone-gc",
	"autoscaler",
	"autoscale",
	"watchtower",
	"cadvisor",
}

ReservedNames provides a list of reserved container names that should not be removed.

Functions

func Schedule

func Schedule(ctx context.Context, collector Collector, interval time.Duration) error

Schedule schedules the garbage collector to execute at the specified interval duration.

Types

type Collector

type Collector interface {
	Collect(context.Context) error
}

Collector defines a Docker container garbage collector.

func New

func New(client docker.APIClient, opt ...Option) Collector

New returns a garbage collector.

type FilterFunc

type FilterFunc func(map[string]string) bool

FilterFunc filters the Docker resource based on its labels. If the function returns false, the resource is ignored.

type Option

type Option func(*collector)

Option configures a garbage collector option.

func WithImageWhitelist

func WithImageWhitelist(images []string) Option

WithImageWhitelist returns an option to set an image whitelist. This will prevent the garbage collector from removing named containers.

func WithThreshold

func WithThreshold(threshold int64) Option

WithThreshold returns an option to set a threshold for the image cache. The cache will clear images until the layer size is below the target threshold.

func WithWhitelist

func WithWhitelist(names []string) Option

WithWhitelist returns an option to set a whitelist of container names. This will prevent the garbage collector from removing matching containers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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