Documentation
¶
Overview ¶
Package imageupdate owns image update checks, persistence, and HTTP routes.
Index ¶
- Constants
- func RegisterImageUpdates(api huma.API, imageUpdateSvc *ImageUpdateService, ...)
- type CheckAllImagesInput
- type CheckImageUpdateByIDInput
- type CheckImageUpdateInput
- type CheckMultipleImagesInput
- type GetUpdateInfoByRefsInput
- type GetUpdateSummaryInput
- type ImageParts
- type ImageUpdate
- type ImageUpdateHandler
- func (h *ImageUpdateHandler) CheckAllImages(ctx context.Context, input *CheckAllImagesInput) (*handlerutil.Out[imageupdate.BatchResponse], error)
- func (h *ImageUpdateHandler) CheckImageUpdate(ctx context.Context, input *CheckImageUpdateInput) (*handlerutil.Out[imageupdate.Response], error)
- func (h *ImageUpdateHandler) CheckImageUpdateByID(ctx context.Context, input *CheckImageUpdateByIDInput) (*handlerutil.Out[imageupdate.Response], error)
- func (h *ImageUpdateHandler) CheckMultipleImages(ctx context.Context, input *CheckMultipleImagesInput) (*handlerutil.Out[imageupdate.BatchResponse], error)
- func (h *ImageUpdateHandler) GetUpdateInfoByRefs(ctx context.Context, input *GetUpdateInfoByRefsInput) (*handlerutil.Out[map[string]*image.UpdateInfo], error)
- func (h *ImageUpdateHandler) GetUpdateSummary(ctx context.Context, input *GetUpdateSummaryInput) (*handlerutil.Out[imageupdate.Summary], error)
- type ImageUpdateRecord
- type ImageUpdateService
- func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef string) (*imageupdate.Response, error)
- func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID string) (*imageupdate.Response, error)
- func (s *ImageUpdateService) CheckImages(ctx context.Context, request imageupdate.CheckRequest, ...) (imageupdate.BatchResponse, error)
- func (s *ImageUpdateService) CheckWorkflow() *flow.Workflow
- func (s *ImageUpdateService) CleanupOrphanedRecords(ctx context.Context) error
- func (s *ImageUpdateService) DeleteRecordsForImages(ctx context.Context, imageIDs []string) error
- func (s *ImageUpdateService) GetUnnotifiedUpdates(ctx context.Context) (map[string]*ImageUpdateRecord, error)
- func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*imageupdate.Summary, error)
- func (s *ImageUpdateService) MarkImageRefUpToDateAfterPull(ctx context.Context, imageRef string) error
- func (s *ImageUpdateService) MarkUpdatesAsNotified(ctx context.Context, records []*ImageUpdateRecord) error
- func (s *ImageUpdateService) MonitoredImageRefs(ctx context.Context, imageRefs []string) ([]string, error)
- func (s *ImageUpdateService) RegisterWorkflows(engine *flow.Engine) error
- func (s *ImageUpdateService) RunImageCheck(ctx context.Context, request imageupdate.CheckRequest) (scheduler.Outcome, error)
- func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) error
- func (s *ImageUpdateService) StoredUpdateByImageID(ctx context.Context, imageID string) (*ImageUpdateRecord, bool, error)
- type Module
Constants ¶
const ( UpdateTypeDigest = "digest" UpdateTypeTag = "tag" UpdateTypeLocal = "local" UpdateTypeNotPulled = "not_pulled" )
Variables ¶
This section is empty.
Functions ¶
func RegisterImageUpdates ¶
func RegisterImageUpdates( api huma.API, imageUpdateSvc *ImageUpdateService, getUpdateInfoByImageRefs func(context.Context, []string) (map[string]*image.UpdateInfo, error), appCtx handlerutil.ActivityAppContext, )
RegisterImageUpdates registers image update endpoints.
Types ¶
type CheckAllImagesInput ¶
type CheckAllImagesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body imageupdate.CheckAllImagesRequest
}
type CheckImageUpdateInput ¶
type CheckMultipleImagesInput ¶
type CheckMultipleImagesInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
Body imageupdate.BatchImageUpdateRequest
}
type GetUpdateSummaryInput ¶
type GetUpdateSummaryInput struct {
EnvironmentID string `path:"id" doc:"Environment ID"`
}
type ImageParts ¶
type ImageUpdate ¶ added in v2.8.1
type ImageUpdateHandler ¶
type ImageUpdateHandler struct {
// contains filtered or unexported fields
}
func (*ImageUpdateHandler) CheckAllImages ¶
func (h *ImageUpdateHandler) CheckAllImages(ctx context.Context, input *CheckAllImagesInput) (*handlerutil.Out[imageupdate.BatchResponse], error)
func (*ImageUpdateHandler) CheckImageUpdate ¶
func (h *ImageUpdateHandler) CheckImageUpdate(ctx context.Context, input *CheckImageUpdateInput) (*handlerutil.Out[imageupdate.Response], error)
func (*ImageUpdateHandler) CheckImageUpdateByID ¶
func (h *ImageUpdateHandler) CheckImageUpdateByID(ctx context.Context, input *CheckImageUpdateByIDInput) (*handlerutil.Out[imageupdate.Response], error)
func (*ImageUpdateHandler) CheckMultipleImages ¶
func (h *ImageUpdateHandler) CheckMultipleImages(ctx context.Context, input *CheckMultipleImagesInput) (*handlerutil.Out[imageupdate.BatchResponse], error)
func (*ImageUpdateHandler) GetUpdateInfoByRefs ¶
func (h *ImageUpdateHandler) GetUpdateInfoByRefs(ctx context.Context, input *GetUpdateInfoByRefsInput) (*handlerutil.Out[map[string]*image.UpdateInfo], error)
func (*ImageUpdateHandler) GetUpdateSummary ¶
func (h *ImageUpdateHandler) GetUpdateSummary(ctx context.Context, input *GetUpdateSummaryInput) (*handlerutil.Out[imageupdate.Summary], error)
type ImageUpdateRecord ¶ added in v2.8.1
type ImageUpdateRecord struct {
database.BaseModel
ProjectID string `json:"projectId,omitempty" gorm:"column:project_id;not null;default:'';index"`
ServiceName string `json:"serviceName,omitempty" gorm:"column:service_name;not null;default:''"`
PolicyKey string `json:"-" gorm:"column:policy_key;not null;default:''"`
ContainerID string `json:"containerId,omitempty" gorm:"column:container_id;not null;default:'';index"`
ImageID string `json:"imageId,omitempty" gorm:"column:image_id;not null;default:'';index"`
CheckTime time.Time `json:"checkTime" gorm:"column:check_time"`
LatestSeenAt *time.Time `json:"latestSeenAt,omitempty" gorm:"column:latest_seen_at"`
LatestVersion *string `json:"latestVersion,omitempty" gorm:"column:latest_version"`
CurrentDigest *string `json:"currentDigest,omitempty" gorm:"column:current_digest"`
LatestDigest *string `json:"latestDigest,omitempty" gorm:"column:latest_digest"`
LastError *string `json:"lastError,omitempty" gorm:"column:last_error"`
AuthMethod *string `json:"authMethod,omitempty" gorm:"column:auth_method"`
AuthUsername *string `json:"authUsername,omitempty" gorm:"column:auth_username"`
AuthRegistry *string `json:"authRegistry,omitempty" gorm:"column:auth_registry"`
ID string `json:"id" gorm:"primaryKey;type:text"`
Repository string `json:"repository"`
Tag string `json:"tag"`
UpdateType string `json:"updateType" gorm:"column:update_type"`
CurrentVersion string `json:"currentVersion" gorm:"column:current_version"`
ResponseTimeMs int `json:"responseTimeMs" gorm:"column:response_time_ms"`
HasUpdate bool `json:"hasUpdate" gorm:"column:has_update"`
UsedCredential bool `json:"usedCredential,omitempty" gorm:"column:used_credential"`
NotificationSent bool `json:"notificationSent" gorm:"column:notification_sent;default:false"`
}
func (*ImageUpdateRecord) IsDigestUpdate ¶ added in v2.8.1
func (i *ImageUpdateRecord) IsDigestUpdate() bool
func (*ImageUpdateRecord) IsTagUpdate ¶ added in v2.8.1
func (i *ImageUpdateRecord) IsTagUpdate() bool
func (*ImageUpdateRecord) NeedsUpdate ¶ added in v2.8.1
func (i *ImageUpdateRecord) NeedsUpdate() bool
func (*ImageUpdateRecord) TableName ¶ added in v2.8.1
func (i *ImageUpdateRecord) TableName() string
func (*ImageUpdateRecord) UpdateInfo ¶ added in v2.11.0
func (i *ImageUpdateRecord) UpdateInfo() *image.UpdateInfo
UpdateInfo returns the public status of this check.
type ImageUpdateService ¶
type ImageUpdateService struct {
// contains filtered or unexported fields
}
func NewImageUpdateService ¶
func NewImageUpdateService( db *database.DB, settingsService *settings.SettingsService, registryService *registry.ContainerRegistryService, dockerService *docker.DockerClientService, eventService *event.EventService, notificationService *notification.NotificationService, activityService *activity.ActivityService, ) *ImageUpdateService
func (*ImageUpdateService) CheckImageUpdate ¶
func (s *ImageUpdateService) CheckImageUpdate(ctx context.Context, imageRef string) (*imageupdate.Response, error)
func (*ImageUpdateService) CheckImageUpdateByID ¶
func (s *ImageUpdateService) CheckImageUpdateByID(ctx context.Context, imageID string) (*imageupdate.Response, error)
func (*ImageUpdateService) CheckImages ¶ added in v2.16.0
func (s *ImageUpdateService) CheckImages(ctx context.Context, request imageupdate.CheckRequest, credentials []containerregistry.Credential) (imageupdate.BatchResponse, error)
CheckImages checks the requested images and returns each ref's result. Usable credentials replace the stored registries for this check, as they always have.
func (*ImageUpdateService) CheckWorkflow ¶ added in v2.16.0
func (s *ImageUpdateService) CheckWorkflow() *flow.Workflow
CheckWorkflow is the image-check workflow, for use as a child step.
func (*ImageUpdateService) CleanupOrphanedRecords ¶
func (s *ImageUpdateService) CleanupOrphanedRecords(ctx context.Context) error
func (*ImageUpdateService) DeleteRecordsForImages ¶ added in v2.15.0
func (s *ImageUpdateService) DeleteRecordsForImages(ctx context.Context, imageIDs []string) error
DeleteRecordsForImages removes image-level rows (keyed by id) and container/project rows (keyed by image_id) for the given images.
func (*ImageUpdateService) GetUnnotifiedUpdates ¶
func (s *ImageUpdateService) GetUnnotifiedUpdates(ctx context.Context) (map[string]*ImageUpdateRecord, error)
GetUnnotifiedUpdates returns a map of image IDs that have updates but haven't been notified yet
func (*ImageUpdateService) GetUpdateSummary ¶
func (s *ImageUpdateService) GetUpdateSummary(ctx context.Context) (*imageupdate.Summary, error)
func (*ImageUpdateService) MarkImageRefUpToDateAfterPull ¶
func (s *ImageUpdateService) MarkImageRefUpToDateAfterPull(ctx context.Context, imageRef string) error
func (*ImageUpdateService) MarkUpdatesAsNotified ¶
func (s *ImageUpdateService) MarkUpdatesAsNotified(ctx context.Context, records []*ImageUpdateRecord) error
func (*ImageUpdateService) MonitoredImageRefs ¶ added in v2.16.0
func (s *ImageUpdateService) MonitoredImageRefs(ctx context.Context, imageRefs []string) ([]string, error)
MonitoredImageRefs keeps the refs whose containers still permit update checks.
func (*ImageUpdateService) RegisterWorkflows ¶ added in v2.16.0
func (s *ImageUpdateService) RegisterWorkflows(engine *flow.Engine) error
RegisterWorkflows defines the image-check workflow; call it before the host starts.
func (*ImageUpdateService) RunImageCheck ¶ added in v2.16.0
func (s *ImageUpdateService) RunImageCheck(ctx context.Context, request imageupdate.CheckRequest) (scheduler.Outcome, error)
RunImageCheck checks the requested images and returns the check outcome; failed images are reported as failed targets.
func (*ImageUpdateService) SendBatchUpdateNotifications ¶
func (s *ImageUpdateService) SendBatchUpdateNotifications(ctx context.Context) error
SendBatchUpdateNotifications delivers pending update notifications. It returns an error only when the pending set could not be determined, so a caller about to consume the records can stop before their notifications are lost; delivery failures leave the records unnotified for the next flush.
func (*ImageUpdateService) StoredUpdateByImageID ¶
func (s *ImageUpdateService) StoredUpdateByImageID(ctx context.Context, imageID string) (*ImageUpdateRecord, bool, error)
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New(service *ImageUpdateService, getUpdateInfo func(context.Context, []string) (map[string]*image.UpdateInfo, error)) *Module
New wires image update routes and registers the arcane.image.updates gauges once.
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)
func (*Module) Service ¶
func (m *Module) Service() *ImageUpdateService