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

Garbage collection cronjob leaves registry in an inconsistent state #104

Open
0xDEC0DE opened this issue May 15, 2023 · 3 comments
Open

Comments

@0xDEC0DE
Copy link

0xDEC0DE commented May 15, 2023

Prerequisites

  • kubectl
  • skopeo
  • A deployed registry configured with persistence.deleteEnabled = true and garbageCollect.enabled = true

Steps to reproduce

Setup

export REGISTRY=$NAME_OF_REGISTRY_INGRESS
export REGISTRY_POD=$NAME_OF_REGISTRY_POD_FROM_KUBECTL

docker login $REGISTRY
docker pull hello-world:latest
docker tag hello-world:latest ${REGISTRY}/hello-world:latest
docker push ${REGISTRY}/hello-world:latest
skopeo delete docker://${REGISTRY}/hello-world:latest
kubectl exec $REGISTRY_POD -- /bin/registry garbage-collect --delete-untagged=true /etc/docker/registry/config.yml

Test

docker push ${REGISTRY}/hello-world:latest
docker pull ${REGISTRY}/hello-world:latest

Expected result

Success

Actual behavior

It fails, claiming layers already exist, etc.

Workaround

Restarting the registry after garbage-collection makes it work as expected:

kubectl delete pod $REGISTRY_POD ; sleep 5  # XXX: restart registry
docker push ${REGISTRY}/hello-world:latest
docker pull ${REGISTRY}/hello-world:latest  # XXX: success
@0xDEC0DE
Copy link
Author

Workaround

Disabling caching on the registry server will also make it behave correctly. This can be achieved by setting storage.cache.blobdescriptor to an "invalid" value in the configs, e.g.:

docker-registry:
  configData:
    storage:
      cache:
        blobdescriptor: disabled

0xDEC0DE pushed a commit to 0xDEC0DE/docker-registry.helm that referenced this issue May 20, 2023
The garbage-collection cronjob will cause the registry to go into
an inconsistent state if the blob cache is not cleared afterward.

Since the cronjob has no facility for doing that, disable blob
caching entirely when garbage-collection is in use.

Fixes: Issue twuni#104
@nabaruns
Copy link

Facing same issue.

@BrianValente
Copy link

Can confirm, workaround works.

NextFire added a commit to Japan7/nanak8s that referenced this issue Apr 25, 2024
0xDEC0DE pushed a commit to 0xDEC0DE/docker-registry.helm that referenced this issue Apr 25, 2024
The garbage-collection cronjob will cause the registry to go into
an inconsistent state if the blob cache is not cleared afterward.

Since the cronjob has no facility for doing that, disable blob
caching entirely when garbage-collection is in use.

Fixes: Issue twuni#104
0xDEC0DE pushed a commit to 0xDEC0DE/docker-registry.helm that referenced this issue Apr 25, 2024
The garbage-collection cronjob will cause the registry to go into
an inconsistent state if the blob cache is not cleared afterward.

Since the cronjob has no facility for doing that, disable blob
caching entirely when garbage-collection is in use.

Fixes: Issue twuni#104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants