garbage

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	// Run runs the garbage collector until all eligible Promotion resources have
	// been deleted -- or until an unrecoverable error occurs.
	Run(context.Context) error
}

Collector is an interface for the garbage collector.

func NewCollector

func NewCollector(kubeClient client.Client, cfg CollectorConfig) Collector

NewCollector initializes and returns an implementation of the Collector interface.

type CollectorConfig

type CollectorConfig struct {
	// NumWorkers specifies the number of concurrent workers working on garbage
	// collection. Tuning this too low will result in slow garbage collection.
	// Tuning this too high will result in too many API calls and may result in
	// throttling.
	NumWorkers int `envconfig:"NUM_WORKERS" default:"3"`
	// MaxRetainedPromotions specifies the ideal maximum number of Promotions
	// OLDER than the oldest in a non-terminal state (associated with each Stage)
	// that may be spared by the garbage collector. The ACTUAL number of
	// Promotions spared may exceed this ideal if some Promotions that would
	// otherwise be deleted do not meet the minimum age criterion.
	MaxRetainedPromotions int `envconfig:"MAX_RETAINED_PROMOTIONS" default:"20"`
	// MinPromotionDeletionAge specifies the minimum age Promotions must be before
	// considered eligible for garbage collection.
	MinPromotionDeletionAge time.Duration `envconfig:"MIN_PROMOTION_DELETION_AGE" default:"336h"` // 2 weeks
	// MaxRetainedFreight specifies the ideal maximum number of Freight OLDER than
	// the oldest still in use (from each Warehouse) that may be spared by the
	// garbage collector. The ACTUAL number of older Freight spared may exceed
	// this ideal if some Freight that would otherwise be deleted do not meet the
	// minimum age criterion.
	MaxRetainedFreight int `envconfig:"MAX_RETAINED_FREIGHT" default:"20"`
	// MinFreightDeletionAge specifies the minimum age Freight must be before
	// considered eligible for garbage collection.
	MinFreightDeletionAge time.Duration `envconfig:"MIN_FREIGHT_DELETION_AGE" default:"336h"` // 2 weeks
}

CollectorConfig is configuration for the garbage collector.

func CollectorConfigFromEnv

func CollectorConfigFromEnv() CollectorConfig

CollectorConfigFromEnv returns a CollectorConfig populated from environment variables.

Jump to

Keyboard shortcuts

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