Class ImageUpdateService
- Namespace
- Bielu.Microservices.Orchestrator.Storage
- Assembly
- Bielu.Microservices.Orchestrator.dll
Default IImageUpdateService implementation.
Strategy: each managed instance persists its OriginalRequest in IInstanceStore. The container is stamped at creation time with the image digest it was created from (label ImageDigest). We compare that recorded digest with the digest of the image currently available locally (optionally after pulling) and recreate the containers when they differ.
public class ImageUpdateService : IImageUpdateService
- Inheritance
-
ImageUpdateService
- Implements
- Inherited Members
Constructors
ImageUpdateService(IContainerOrchestrator, IInstanceStore, ILogger<ImageUpdateService>)
Default IImageUpdateService implementation.
Strategy: each managed instance persists its OriginalRequest in IInstanceStore. The container is stamped at creation time with the image digest it was created from (label ImageDigest). We compare that recorded digest with the digest of the image currently available locally (optionally after pulling) and recreate the containers when they differ.
public ImageUpdateService(IContainerOrchestrator orchestrator, IInstanceStore instanceStore, ILogger<ImageUpdateService> logger)
Parameters
orchestratorIContainerOrchestratorinstanceStoreIInstanceStoreloggerILogger<ImageUpdateService>
Methods
CheckAllAsync(ImageUpdateOptions?, CancellationToken)
Checks every managed instance and returns the per-instance status.
public Task<IReadOnlyList<ImageUpdateStatus>> CheckAllAsync(ImageUpdateOptions? options = null, CancellationToken cancellationToken = default)
Parameters
optionsImageUpdateOptionscancellationTokenCancellationToken
Returns
CheckAsync(string, ImageUpdateOptions?, CancellationToken)
Checks whether an image update is available for the given managed instance.
public Task<ImageUpdateStatus> CheckAsync(string instanceId, ImageUpdateOptions? options = null, CancellationToken cancellationToken = default)
Parameters
instanceIdstringThe managed instance identifier.
optionsImageUpdateOptionsCheck options (e.g. whether to pull first).
cancellationTokenCancellationTokenCancellation token.
Returns
UpdateAsync(string, ImageUpdateOptions?, CancellationToken)
Pulls the latest image and, if the digest changed (or Force is set), removes the existing containers of the instance and recreates them from the persisted OriginalRequest.
public Task<ImageUpdateResult> UpdateAsync(string instanceId, ImageUpdateOptions? options = null, CancellationToken cancellationToken = default)
Parameters
instanceIdstringoptionsImageUpdateOptionscancellationTokenCancellationToken