imageupdate

package
v1.5.9 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package imageupdate periodically asks the control plane to check each opted-in app's image tag against its registry and redeploy when it moved.

Index

Constants

View Source
const DefaultInterval = time.Hour

DefaultInterval is how often opted-in apps are checked. Hourly: registries rate-limit anonymous digest lookups, and a tag rarely moves faster.

View Source
const EnvInterval = "APP_IMAGE_UPDATE_INTERVAL"

EnvInterval overrides DefaultInterval (a Go duration such as "30m").

Variables

This section is empty.

Functions

func IntervalFromEnv

func IntervalFromEnv(logger *slog.Logger) time.Duration

IntervalFromEnv returns EnvInterval as a duration, else DefaultInterval.

func IsNewer

func IsNewer(candidate, current string) bool

IsNewer reports whether candidate is a higher release version than current. A current tag that is not a release version (latest) counts as lower.

func NewestInRange

func NewestInRange(tags []string, r Range, currentTag string) (best string, ok bool)

NewestInRange returns the highest release tag inside r that carries the same variant suffix as currentTag (so "1.25-alpine" never jumps to a plain tag). ok is false when no tag qualifies.

Types

type Checker

type Checker interface {
	CheckImageUpdate(ctx context.Context, serviceName string) (string, error)
}

Checker runs one app's update check; *api.Router satisfies it.

type HTTPTagLister

type HTTPTagLister struct {
	Client *http.Client
}

HTTPTagLister reads /v2/<repo>/tags/list from an OCI registry, following Link pagination and the Bearer token challenge.

func (HTTPTagLister) ListTags

func (l HTTPTagLister) ListTags(ctx context.Context, ref string, auth *docker.RegistryAuth) ([]string, error)

ListTags implements TagLister.

type Range

type Range struct {
	// contains filtered or unexported fields
}

Range is a set of comparators that must all hold, parsed from a spec such as "1.x", "1.2.x", "^1.2.3", "~1.2.3" or ">=1.2.0 <2.0.0".

func ParseRange

func ParseRange(spec string) (Range, error)

ParseRange validates spec. An empty spec or "*" matches every version.

func (Range) Contains

func (r Range) Contains(v Version) bool

Contains reports whether v satisfies every comparator.

type Scheduler

type Scheduler struct {
	Store   Store
	Checker Checker
	Logger  *slog.Logger
}

Scheduler checks every opted-in app once per Tick.

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context, interval time.Duration) error

Run ticks on interval until ctx is done.

func (*Scheduler) Tick

func (s *Scheduler) Tick(ctx context.Context) error

Tick checks each opted-in app; one app's failure never stops the rest.

type Store

type Store interface {
	ListEnabledImageAutoUpdates(ctx context.Context) ([]store.ImageAutoUpdate, error)
}

Store lists the apps that opted in.

type TagLister

type TagLister interface {
	ListTags(ctx context.Context, ref string, auth *docker.RegistryAuth) ([]string, error)
}

TagLister lists every tag of an image repository; ref is any reference of that repository (its tag is ignored).

type Version

type Version [3]int

Version is a numeric major.minor.patch parsed from an image tag.

func ParseTag

func ParseTag(tag string) (v Version, suffix string, ok bool)

ParseTag splits a tag into its version and variant suffix. ok is false for tags that are not release versions (latest, stable) and for pre-releases.

Jump to

Keyboard shortcuts

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