Skip to content

Support auto-updates of containers #452

@MrDrMcCoy

Description

@MrDrMcCoy

Upstream issue here: hashicorp/nomad#18440

Problem

Running a container whose registry replaces and updates tags like latest or a major/minor version number leaves the container that Nomad schedules for Podman stuck at whatever version it was initially pulled with. This is cumbersome and hides the fact that containers are out of date.

Attempted solutions

  • Changing the jobspec to initiate a restart does not trigger a pull for image updates.
  • Manually requesting a reschedule and restart also does not trigger a pull.
  • Adding the "io.containers.autoupdate" = "registry" label to the task does not enable Podman's auto-update feature.
  • Enabling force_pull does allow the container to update, but this significantly increases container start time which can be problematic.

Desired solution

Driver config

  • image_auto_pull (bool) defaults to false: Sets the default behavior for checking registries and pulling image updates for defined tags.
  • image_auto_pull_eager (bool) defaults to false: Sets the default behavior for this node to pull all defined images in Nomad, even if an image is not scheduled to run on it. This allows containers to start quickly when being scheduled on a node that has not yet run it. not possible
  • image_auto_prune (bool) defaults to false: Sets the default behavior for this node to prune image layers that belong to image tags which are not defined by any tasks or running containers. This occurs at the end of image_auto_pull_interval for any successfully pulled images.
  • image_auto_pull_interval (int) defaults to 86400 (one day in seconds): Sets the default interval for checking registries for updates to existing image tags.

Task config

  • image_auto_pull (bool) defaults to false: Sets the task behavior for checking registries and pulling image updates for defined tags.
  • image_auto_pull_eager (bool) defaults to false: Sets the task behavior for all nodes to pull the defined image, even if the image is not scheduled to run on a node. This allows containers to start quickly when being scheduled on a node that has not yet run it. not possible.
  • image_auto_pull_interval (int) defaults to 86400 (one day in seconds): Sets the task interval for checking registries for updates to existing image tags.
  • container_auto_update (bool) defaults to false: Initiates a task restart when new images have been pulled in accordance with defined update config in Jobspec.

Globally (should be documented somewhere)

  • If a task is restarted without force_pull, it will start with the most recent image locally available without checking the upstream registry.
  • Containers that set image_auto_pull but not container_auto_update will get the new image version when restarted. Rescheduling or scaling a task will maintain the previous image tag.
  • The Podman driver keeps track of hashes on each node to ensure the same version comes up for each task. This avoids the scenario where a single node deploys a tag and another node that never pulled it gets a newer version of the same tag when scaling up or rescheduling, potentially running an application with mismatched versions. not possible.

Other notes

image_auto_pull_eager and image_auto_prune are admittedly a bit of scope creep, but are related QoL features that might be worth adding at the same time.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Needs Roadmapping

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions