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

Return latest if no upstream registry is available #586

Open
aapjeisbaas opened this issue Sep 26, 2024 · 1 comment
Open

Return latest if no upstream registry is available #586

aapjeisbaas opened this issue Sep 26, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@aapjeisbaas
Copy link

Describe the problem to be solved

Applicable when running a portable cluster with an unpredictable or no internet connection.
I have a few pods that are defined as image:latest without the pull policy IfNotPresent

If you start a pod with a latest tag it will always try to pull from a registry.
Spegel will try to fetch this upstream and fails with a timeout.
The pod can't start even though there is a cached image available.
Ending in a ErrImagePull > ImagePullBackOff

Extra info:
I run spegel in K3s with --embedded-registry in thje install command.
I have a registries.yaml:

mirrors:
  "*":

spegel metrics:

[root@localhost ~]# kubectl get --raw /api/v1/nodes/localhost/proxy/metrics | grep -F 'spegel'
# HELP spegel_advertised_image_digests Number of image digests advertised to be available.
# TYPE spegel_advertised_image_digests gauge
spegel_advertised_image_digests{registry="docker.io"} 17
spegel_advertised_image_digests{registry="ghcr.io"} 1
spegel_advertised_image_digests{registry="quay.io"} 6
spegel_advertised_image_digests{registry="registry.gitlab.com"} 1
# HELP spegel_advertised_image_tags Number of image tags advertised to be available.
# TYPE spegel_advertised_image_tags gauge
spegel_advertised_image_tags{registry="docker.io"} 22
spegel_advertised_image_tags{registry="ghcr.io"} 1
spegel_advertised_image_tags{registry="quay.io"} 6
spegel_advertised_image_tags{registry="registry.gitlab.com"} 5
# HELP spegel_advertised_images Number of images advertised to be available.
# TYPE spegel_advertised_images gauge
spegel_advertised_images{registry="docker.io"} 39
spegel_advertised_images{registry="ghcr.io"} 2
spegel_advertised_images{registry="quay.io"} 12
spegel_advertised_images{registry="registry.gitlab.com"} 6
# HELP spegel_advertised_keys Number of keys advertised to be available.
# TYPE spegel_advertised_keys gauge
spegel_advertised_keys{registry="docker.io"} 175
spegel_advertised_keys{registry="ghcr.io"} 18
spegel_advertised_keys{registry="quay.io"} 107
spegel_advertised_keys{registry="registry.gitlab.com"} 31
# HELP spegel_mirror_requests_total Total number of mirror requests.
# TYPE spegel_mirror_requests_total counter
spegel_mirror_requests_total{cache="miss",registry="registry.gitlab.com",source="internal"} 6

Proposed solution to the problem

In this scenario I would love it if Spegel would respond with the latest image from cache.

@aapjeisbaas aapjeisbaas added the enhancement New feature or request label Sep 26, 2024
@phillebaba
Copy link
Member

The embedded k3s version of Spegel works slightly differently. Have you enabled resolving latest tags?

https://docs.k3s.io/installation/registry-mirror#latest-tag

I also reccomend reading the FAQ about using latest tag with Spegel.

https://github.com/spegel-org/spegel/blob/main/docs/FAQ.md#why-am-i-not-able-to-pull-the-new-version-of-my-tagged-image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants