Documentation ¶
Overview ¶
Package gcrcleaner cleans up stale images from a container registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTimerCache ¶ added in v0.3.0
NewTimerCache creates a new timer-based cache.
Types ¶
type Cache ¶
type Cache interface { // Insert inserts the item into the cache. If the item already exists, this // method returns true. Insert(string) bool // Stop stops the cache. When Stop returns, the cache must not perform any // additionally processing. Stop() }
Cache is an interface used by the PubSub() function to prevent duplicate messages from being processed.
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
Cleaner is a gcr cleaner.
func NewCleaner ¶
func NewCleaner(auther gcrauthn.Authenticator, c int) (*Cleaner, error)
NewCleaner creates a new GCR cleaner with the given token provider and concurrency.
type LogEntry ¶ added in v0.6.0
type LogEntry struct { Time *time.Time Severity Severity Message string Data map[string]interface{} }
func (*LogEntry) MarshalJSON ¶ added in v0.6.0
type Payload ¶
type Payload struct { // Repo is the name of the repo to clean. // // Deprecated: Use Repos instead. Repo string `json:"repo"` // Repos is the list of repositories to clean. Repos sortedStringSlice `json:"repos"` // Grace is a time.Duration value indicating how much grade period should be // given to new, untagged layers. The default is no grace. Grace duration `json:"grace"` // Keep is the minimum number of images to keep. Keep int `json:"keep"` // TagFilterAny is the tags pattern to be allowed removing. If given, any // image with at least one tag that matches this given regular expression will // be deleted. The image will be deleted even if it has other tags that do not // match the given regular expression. TagFilterAny string `json:"tag_filter_any"` // TagFilterAll is the tags pattern to be allowed removing. If given, any // image where all tags match this given regular expression will be deleted. // The image will not be delete if it has other tags that do not match the // given regular expression. TagFilterAll string `json:"tag_filter_all"` // DryRun instructs the server to not perform actual cleaning. The response // will include repositories that would have been deleted. DryRun bool `json:"dry_run"` // Recursive enables cleaning all child repositories. Recursive bool `json:"recursive"` // TagFilterFirst is the tags pattern to be allowed removing. If specified, any // images where the first tag matches the given regular expression will be // deleted. // // Deprecated: Use tag_filter_all or tag_filter_any instead. TagFilterFirst string `json:"tag_filter"` // AllowTagged is a Boolean value determine if tagged images are allowed to be // deleted. // // Deprecated: Use tag_filter_all or tag_filter_any instead. Setting either of // these values enables deleting tagged images. AllowTagged bool `json:"allow_tagged"` }
Payload is the expected incoming payload format.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a cleaning server.
func (*Server) HTTPHandler ¶
func (s *Server) HTTPHandler() http.HandlerFunc
HTTPHandler is an http handler that invokes the cleaner with the given parameters.
func (*Server) PubSubHandler ¶
func (s *Server) PubSubHandler(cache Cache) http.HandlerFunc
PubSubHandler is an http handler that invokes the cleaner from a pubsub request. Unlike an HTTP request, the pubsub endpoint always returns a success unless the pubsub message is malformed.
type TagFilter ¶ added in v0.7.0
TagFilter is an interface which defines whether a given set of tags matches the filter.
func BuildTagFilter ¶ added in v0.7.0
BuildTagFilter builds and compiles a new tag filter for the given inputs. All inputs are strings to be compiled to regular expressions and are mutually exclusive.
type TagFilterAll ¶ added in v0.7.0
type TagFilterAll struct {
// contains filtered or unexported fields
}
TagFilterAll filters based on the entire list. If all tags in the last match, it returns true. If one more more tags do not match, it returns false.
func (*TagFilterAll) Matches ¶ added in v0.7.0
func (f *TagFilterAll) Matches(tags []string) bool
type TagFilterAny ¶ added in v0.7.0
type TagFilterAny struct {
// contains filtered or unexported fields
}
TagFilterAny filters based on the entire list. If any tag in the list matches, it returns true. If no tags match, it returns false.
func (*TagFilterAny) Matches ¶ added in v0.7.0
func (f *TagFilterAny) Matches(tags []string) bool
type TagFilterFirst ¶ added in v0.7.0
type TagFilterFirst struct {
// contains filtered or unexported fields
}
TagFilterFirst filters based on the first item in the list. If the list is empty or if the first item does not match the regex, it returns false.
func (*TagFilterFirst) Matches ¶ added in v0.7.0
func (f *TagFilterFirst) Matches(tags []string) bool
type TagFilterNull ¶ added in v0.7.0
type TagFilterNull struct{}
TagFilterNull always returns false.
func (*TagFilterNull) Matches ¶ added in v0.7.0
func (f *TagFilterNull) Matches(tags []string) bool