goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.98k stars 4.75k forks source link

Harbor proxy cache loses image tag when remote image is deleted #20997

Open sincorchetes opened 2 weeks ago

sincorchetes commented 2 weeks ago

If you are reporting a problem, please make sure the following information are provided:

Expected behavior and actual behavior: Remote registries delete the image by the retention policy. Harbor does have the layer cached but the tag is deleted.

Steps to reproduce the problem:

  1. Go to the remote registry.
  2. Build and push an image.
  3. Deploy the image using your Harbor Registry URI.
  4. Harbor detects that the image is not saved locally and downloads it.
  5. The deployment is successful.
  6. Remove the image from the remote registry.
  7. Try to redeploy the image.
  8. The deployment fails.

Versions: Please specify the versions of following systems.

Additional context: The image is storage but with sha256 not with tag (🤷)

stonezdj commented 2 weeks ago

It is work as designed, when the remote server delete the image, the image should not be served.

sincorchetes commented 2 weeks ago

It is work as designed, when the remote server deletes the image, the image should be served.

But why doesn’t it delete the entire image? Why save the image as a sha256 hash instead of deleting it? Is it not possible to configure this behavior manually? Perhaps I’m interested in saving the tag until I perform a cleanup because if it wrongly deletes the image from the remote server, we won’t be able to pull it again.

MinerYang commented 1 week ago

Please run GC for clean the manifest cache

sincorchetes commented 1 week ago

If it’s not possible, define a policy to save the cache or delete it manually.