Removing the Image Repo Sync Jobs¶
Problem Description¶
Most charts have an image repo sync feature. When a deployment sets
images.local_registry.active: true:
the chart runs a
<chart>-image-repo-syncjob. The job pulls every image inimages.tagsthat is not inimages.local_registry.excludeand pushes it to the registry at thelocal_image_registryendpoint;the
helm-toolkit.snippets.imagesnippet adds the address of that registry in front of every image;the init container of every pod waits for the job and for the registry.
The feature is outdated¶
The job mounts the Docker socket of the host, /var/run/docker.sock, and
runs the docker command: docker pull, docker tag and
docker push. This design comes from the time when Kubernetes nodes ran
Docker. Kubernetes removed dockershim in 1.24, and the nodes run containerd
now. A containerd node has no Docker daemon and no Docker socket, so the job
cannot work there, and it cannot be fixed without a rewrite. The test
clusters of OpenStack-Helm run containerd too, so no CI job turns the feature
on, and the registry chart that the local_image_registry endpoint points
to by default is removed.
The feature is opinionated¶
The feature supports one way to use a local registry: a job in every chart
copies the images that the chart lists to a registry that every node reaches
at the same address, localhost:5000 by default, and every pod waits for
that job. Deployments mirror images in many other ways: a pull-through cache
such as Harbor or the CNCF Distribution registry, a registry mirror in the
container runtime (hosts.toml in containerd), skopeo sync or
crane copy in a pipeline, or an image bundle for an air-gapped site. The
right tool depends on the use case of the deployment, and the choice is
outside the scope of the charts. The charts already let a deployment point
every image at any registry with images.tags and pass the registry
credentials with endpoints.oci_image_registry.
The feature is about 4000 lines in 60 chart templates, the values of 72 charts and six helm-toolkit templates. A new chart copies it from the existing charts.
Use cases¶
A deployment that cannot pull from public registries manages its own registry mirror with the tools that suit it best, and sets
images.tagsto the mirror or configures the mirror in the container runtime of the nodes. Both ways work on containerd nodes and also cover the images that the charts do not list.Chart maintainers do not keep and copy code that no deployment can use.
Proposed Change¶
Remove the feature from all charts and from helm-toolkit in one change:
the
job-image-repo-sync.yamltemplates and theimage-repo-sync.shkey of the-binConfigMaps;the values
images.tags.image_repo_sync,images.local_registry,dependencies.dynamic.common.local_image_registry,dependencies.static.image_repo_sync,pod.resources.jobs.image_repo_sync,endpoints.local_image_registryandmanifests.job_image_repo_sync, from the charts and fromvalues_overrides;the
helm-toolkit.manifests.job_image_repo_sync,helm-toolkit.scripts.image_repo_syncandhelm-toolkit.utils.image_sync_listtemplates, and thelocal_registrycode in theimage,kubernetes_entrypoint_init_containerandkubernetes_pod_rbac_serviceaccountsnippets.
A dependencies.dynamic map that becomes empty is removed. Other maps that
become empty stay as {}, because the templates still read them.
Backward compatibility¶
The values are removed without a deprecation period. The rule is to keep a
value working for one release series, but this feature needs the Docker
socket and the docker command, which containerd nodes do not have. A
deprecation would keep code that cannot work.
After the upgrade:
a deployment that set
images.local_registry.activepulls the images fromimages.tags. It must setimages.tagsto its registry before the upgrade. The charts have no values schema, so Helm ignores the old values;the charts that always put
image-repo-sync.shinto their-binConfigMap get a newconfigmap-bin-hash, and their pods restart once;a chart outside this repository that calls the removed helm-toolkit templates fails to render until it drops its image repo sync job.
The release note says this in the Changelog: removed trailer.
Security Impact¶
The charts no longer mount the Docker socket of the host. Access to that socket is root access to the node.
Performance Impact¶
None. Some pods restart once on the upgrade, as described above.
Alternatives¶
Rewrite the job for containerd, for example with
skopeoorcrane, which push over the network. The charts would still need a registry, which OpenStack-Helm no longer deploys, and the feature would still allow only one way to mirror images. The users are free to choose the tools that suit their use case, and those tools work outside the charts.Deprecate the values for one release series and remove them later. Only a deployment with a Docker daemon on every node can use the feature, CI does not test it, and the code stays in every chart for another series.
Implementation¶
Assignee(s)¶
- Primary assignee:
kozhukalov (Vladimir Kozhukalov)
Work Items¶
Remove the feature from the charts, the overrides and helm-toolkit in one change.
Remove the example value from the networking developer reference.
Testing¶
Render every chart with the default values, and with the overrides that set
the removed values, before and after the change, and compare. The only
expected differences are the removed image-repo-sync.sh keys, the changed
configmap-bin-hash annotations and the egress rule to the
docker-registry namespace in the prometheus NetworkPolicy, which
helm-toolkit generates from the endpoints. The CI deploy jobs do not use the
feature and must pass unchanged.
Documentation Impact¶
The networking developer reference loses one example value. The release notes of all charts describe the removal.
References¶
Removal of the registry chart: https://opendev.org/openstack/openstack-helm/commit/65e539a6c8cce799945e6a0f38cb01e7bc49f5f9
Registry mirrors in containerd: https://github.com/containerd/containerd/blob/main/docs/hosts.md