Documentation
¶
Index ¶
Constants ¶
const ( // Keep is the minimum amount of the most recent images that we want to keep // in the underlying registry, per repository, at all times. This number must // be smaller than the amount of images that we fetch in Handler.search. Keep = 10 // Drop is the maximum amount of older images that we want to cleanup at once, // while respecting the minimum amount of images to keep at all times. Drop = 5 )
const ( // Sha represents the set of prefixes matching image tags in the form of // hexadecimal commit hashes, e.g. 1cd6...6863. Sha prefix = "0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f" // Tag represents the prefix matching image tags in the form of semver // versioned release tags, e.g. v0.2.2. Tag prefix = "v" )
const ( Alloy repository = "alloy" Kayron repository = "kayron" Server repository = "server" Specta repository = "specta" SplitsLite repository = "splits-lite" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler implements handler.Cooler as a cleanup job for container images. A single handler is responsible for cleaning up a single specific combination of container repository and image tag prefixes, e.g. kayron:v*.
func (*Handler) Cooler ¶
Cooler is configured to return a dynamically adjusted wait duration for this worker handler to sleep before running again. The introduced jitter has the purpose of spreading out the same type of work across time, so that we ease the load on our dependency APIs, here ECR, and effectively try to prevent rate limits. E.g. a jitter of 1% applied to 1h results in execution variation of +-36s.
func (*Handler) Ensure ¶
Ensure implements the following algorithm to manage registry bloat.
K threshold amount of tagged images to keep
D threshold amount of tagged images to drop
fetch e.g. 100 tagged images
create a list with tag prefixes, e.g. sha or tag
if <= K, break
sort by date, oldest first
create list of up to D items, never going beyond K
for each D item
fetch digests
batch delete collected digests