Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cephadm: normalize repo digests #40577

Merged
merged 2 commits into from Apr 10, 2021
Merged

cephadm: normalize repo digests #40577

merged 2 commits into from Apr 10, 2021

Conversation

liewegas
Copy link
Member

@liewegas liewegas commented Apr 3, 2021

A RepoDigests returned by docker|podman image inspect can either include
the docker.io/ prefix or not. For reasons that aren't entirely clear,
this may vary between hosts in a cluster. However, ceph/ceph@sha256:abc...
is the same thing as docker.io/ceph/ceph@sha256:abc..., and should be
treated as such. Otherwise, upgrade can get into a loop where it pulls
the image on a new host, finds the other variant of the repodigests,
sees no overlap, updates target_digests, and restarts. (It will then
find the first variant again on the first host and loop.)

Avoid this by normalizing any docker.io digests by always including the
docker.io/ prefix.

Fixes: https://tracker.ceph.com/issues/50114

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@liewegas liewegas requested a review from a team as a code owner April 3, 2021 13:14
# docker.io/ubuntu -> no change
bits = digest.split('/')
if '.' not in bits[0] or len(bits) < 3:
digest = 'docker.io/' + digest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually not totally true. this depends on the unqualified-search-registries parameter of the registries.conf and might vary between hosts.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. When would it not be docker.io though? On my dev host, for instance, selenium/standalone-chrome:3.141 has repo digest selenium/standalone-chrome@sha256:8d0915d29d5fa495256bda78371cb5adb70fd16ec9e4b4aaae72a0181682f5f0. But registries.conf has

unqualified-search-registries = ["registry.fedoraproject.org", "registry.access.redhat.com", "registry.centos.org", "docker.io"]

It seems like we could only have an ambiguous situation come up if we have an unqualified image name in one of the search registries. Perhaps we should, in addition to this patch, also require fully-qualified image names for the ceph orch upgrade start' command, and/or canonicalize the image name that we get from container_image so that we'll always have the docker.io prefix (or some other registry).

I'm not sure if it's possible, though, that we pull something from registry foo (not docker.io) and inspect it and see a RepoDigest that is unqualified (and therefore incorrectly prepend docker.io). We could instead canonicalize using the registry we just pulled from... maybe that is the safest thing?

src/cephadm/cephadm Outdated Show resolved Hide resolved
Copy link
Member

@jmolmo jmolmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ( if constants are used for "docker.io")

@liewegas
Copy link
Member Author

liewegas commented Apr 9, 2021

updated, along with the commit messages!

If we get an unqualified target image, assume it's docker.io.  This
ensures that we're passing a fully-qualified target to docker|podman on
the various hosts and don't end up with something different based on the
per-host search path for unqualified image names.

Signed-off-by: Sage Weil <sage@newdream.net>
A RepoDigests returned by docker|podman image inspect can either include
the docker.io/ prefix or not.  For reasons that aren't entirely clear,
this may vary between hosts in a cluster.  However, ceph/ceph@sha256:abc...
is the same thing as docker.io/ceph/ceph@sha256:abc..., and should be
treated as such.  Otherwise, upgrade can get into a loop where it pulls
the image on a new host, finds the other variant of the repodigests,
sees no overlap, updates target_digests, and restarts.  (It will then
find the first variant again on the first host and loop.)

Avoid this by normalizing any docker.io digests by always including the
docker.io/ prefix.

Note that it is technically possible that this assumption is wrong: it
may be that the image that already exists on the local host is from a
different registry in registries.conf's unqualified-search-registries.
However, we don't know which, since this is a search list.  In practice,
it should be exceeding rare that an image that *we* are installing using
a fully-qualified image name will end up having an unqualified repodigest
in the local registry.  Hopefully!

Fixes: https://tracker.ceph.com/issues/50114
Signed-off-by: Sage Weil <sage@newdream.net>
@liewegas
Copy link
Member Author

liewegas commented Apr 9, 2021

jenkins test docs

1 similar comment
@tchaikov
Copy link
Contributor

jenkins test docs

@liewegas liewegas merged commit d949768 into ceph:master Apr 10, 2021
tserong added a commit to SUSE/ceph that referenced this pull request Jun 1, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jun 1, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jun 7, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jul 12, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jul 12, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jul 13, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Aug 10, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Aug 11, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Oct 10, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Oct 11, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
tserong added a commit to SUSE/ceph that referenced this pull request Dec 14, 2022
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jan 11, 2023
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Jan 27, 2023
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request Apr 19, 2023
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
mgfritch pushed a commit to SUSE/ceph that referenced this pull request May 10, 2023
For SUSE downstream we never want to attempt to use docker.io images,
which is what normalize_image_digest() falls back to when presented with
an unqualified image name (ceph/ceph, ceph/daemon, ceph/daemon-base).
Beyond that though, having read ceph#40577,
ceph#44306 and the related tracker issues,
I've become extremely dubious about allowing unqualified image names at
all, so I figured the safest thing to do is not try to normalize these,
but instead raise an error if one is somehow specified.

Signed-off-by: Tim Serong <tserong@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants