Documentation
¶
Overview ¶
Package api exposes the standalone updater service.
Index ¶
- func NewRegistryDigestResolver() digest.RemoteResolver
- func ResolvePullableImageRef(summaryImage, inspectConfigImage string, repoTags []string) (ref, source string)
- type Config
- type DockerClientProvider
- type EventRecorder
- type ImagePuller
- type Notifier
- type PendingStore
- type ProjectUpdater
- type RunRecorder
- type SelfUpdater
- type Service
- func (s *Service) ApplyPending(ctx context.Context, opts types.Options) (out *types.Result, err error)
- func (s *Service) BeginContainerUpdate(containerID string) func()
- func (s *Service) BeginProjectUpdate(projectID string) func()
- func (s *Service) RestartContainersUsingOldImages(ctx context.Context, oldIDToNewRef map[string]string, ...) ([]types.ResourceResult, error)
- func (s *Service) Status() types.Status
- func (s *Service) UpdateContainer(ctx context.Context, containerID string, opts types.Options) (out *types.Result, err error)
- func (s *Service) UpdateStandaloneContainer(ctx context.Context, cnt container.Summary, inspect container.InspectResponse, ...) error
- type SettingsProvider
- type UsedImageCollector
- type UsedImageCollectorFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRegistryDigestResolver ¶ added in v0.2.0
func NewRegistryDigestResolver() digest.RemoteResolver
NewRegistryDigestResolver returns a registry HTTP digest resolver.
func ResolvePullableImageRef ¶
func ResolvePullableImageRef(summaryImage, inspectConfigImage string, repoTags []string) (ref, source string)
ResolvePullableImageRef chooses the best pullable image reference for a container.
Types ¶
type Config ¶
type Config struct {
DockerClientProvider DockerClientProvider
ImagePuller ImagePuller
PendingStore PendingStore
RunRecorder RunRecorder
Settings SettingsProvider
RegistryDigestResolver digest.RemoteResolver
ProjectUpdater ProjectUpdater
SelfUpdater SelfUpdater
Notifier Notifier
EventRecorder EventRecorder
UsedImageCollector UsedImageCollector
LabelPolicy types.LabelPolicy
AllowComposeStandaloneFallback bool
Logger *slog.Logger
}
Config configures Service.
type DockerClientProvider ¶
DockerClientProvider provides Docker clients.
func NewDockerClientProvider ¶ added in v0.2.0
func NewDockerClientProvider(options ...client.Opt) DockerClientProvider
NewDockerClientProvider returns a Docker client provider that uses the local Docker environment.
type EventRecorder ¶
EventRecorder receives updater lifecycle events.
type ImagePuller ¶
type ImagePuller interface {
PullImage(ctx context.Context, imageRef string, progress io.Writer) error
}
ImagePuller pulls images and may write progress to progress.
func NewImagePuller ¶ added in v0.2.0
func NewImagePuller(provider DockerClientProvider) ImagePuller
NewImagePuller returns an image puller backed by Docker's ImagePull API.
type Notifier ¶
type Notifier interface {
Notify(ctx context.Context, notification types.Notification) error
}
Notifier receives successful update notifications.
type PendingStore ¶
type PendingStore interface {
PendingImageUpdates(ctx context.Context) ([]types.ImageUpdateRecord, error)
ClearImageUpdateRecord(ctx context.Context, record types.ImageUpdateRecord) error
}
PendingStore provides pending update records and clears applied records.
func NewMemoryPendingStore ¶ added in v0.2.0
func NewMemoryPendingStore(records ...types.ImageUpdateRecord) PendingStore
NewMemoryPendingStore returns an in-memory pending update store.
type ProjectUpdater ¶
type ProjectUpdater interface {
ProjectByComposeName(ctx context.Context, composeName string) (types.ComposeProject, error)
UpdateServices(ctx context.Context, projectID string, services []string) error
}
ProjectUpdater updates Docker Compose services owned by a host application.
func NewDockerComposeProjectUpdater ¶ added in v0.2.0
func NewDockerComposeProjectUpdater(provider DockerClientProvider) ProjectUpdater
NewDockerComposeProjectUpdater returns a Docker Compose CLI project updater.
type RunRecorder ¶
type RunRecorder interface {
RecordUpdateRun(ctx context.Context, result types.ResourceResult) error
}
RunRecorder records per-resource updater results.
type SelfUpdater ¶
type SelfUpdater interface {
TriggerSelfUpdate(ctx context.Context, target types.SelfUpdateTarget) error
}
SelfUpdater handles host-specific self-update targets.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service coordinates Docker image updates, container recreation, and host adapters.
func NewDefaultService ¶ added in v0.2.0
func NewDefaultService() *Service
NewDefaultService constructs a service with the built-in Docker-backed defaults.
func (*Service) ApplyPending ¶
func (s *Service) ApplyPending(ctx context.Context, opts types.Options) (out *types.Result, err error)
ApplyPending applies pending image updates from the configured PendingStore.
func (*Service) BeginContainerUpdate ¶
BeginContainerUpdate marks a container as updating and returns a completion callback.
func (*Service) BeginProjectUpdate ¶
BeginProjectUpdate marks a project as updating and returns a completion callback.
func (*Service) RestartContainersUsingOldImages ¶
func (s *Service) RestartContainersUsingOldImages(ctx context.Context, oldIDToNewRef map[string]string, oldRefToNewRef map[string]string) ([]types.ResourceResult, error)
RestartContainersUsingOldImages restarts running containers matching old image IDs or refs.
type SettingsProvider ¶
SettingsProvider provides updater settings owned by the host application.
type UsedImageCollector ¶
UsedImageCollector allows callers to provide their own active-image discovery.
type UsedImageCollectorFunc ¶
UsedImageCollectorFunc adapts a function to UsedImageCollector.
func (UsedImageCollectorFunc) UsedImages ¶
func (f UsedImageCollectorFunc) UsedImages(ctx context.Context) (map[string]struct{}, error)
UsedImages calls f(ctx).