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

Attempt to lookup cached entrypoint by digest, if possible #4188

Merged
merged 1 commit into from
Aug 26, 2021

Conversation

imjasonh
Copy link
Member

Today, when the step's image is not specified by digest (i.e., most of the
time), we issue an image pull to get the image's entrypoint, then cache
it. This means that when the step isn't specified by digest (i.e., most
of the time) we hit the remote registry, and can hit DockerHub's rate
limits.

With this change, we'll issue a HEAD request to the registry to first
lookup the digest of the image, then see if we already have the
entrypoint cached by that digest. If the HEAD request fails or the
entrypoint isn't found by image digest, we proceed as normal with the
image pull.

/kind feature

Fixes #4187

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • [n] Docs included if any changes are user facing
  • [n] Tests included if any functionality added or changed
  • [y] Follows the commit message standard
  • [y] Meets the Tekton contributor standards (including
    functionality, content, code)
  • [y] Release notes block below has been filled in or deleted (only if no user facing changes)

Release Notes

Attempt to avoid incurring a rate limited image pull to lookup cached image entrypoints, if we can avoid it.

Today, when the step's image is not specified by digest (i.e., most of the
time), we issue an image pull to get the image's entrypoint, then cache
it. This means that when the step isn't specified by digest (i.e., most
of the time) we hit the remote registry, and can hit DockerHub's rate
limits.

With this change, we'll issue a HEAD request to the registry to first
lookup the digest of the image, then see if we already have the
entrypoint cached by that digest. If the HEAD request fails or the
entrypoint isn't found by image digest, we proceed as normal with the
image pull.
@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Aug 24, 2021
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 24, 2021
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

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

/meow

@tekton-robot
Copy link
Collaborator

@vdemeester: cat image

In response to this:

/meow

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 24, 2021
@imjasonh
Copy link
Member Author

Worth noting: if the image is a multi-arch image (like ubuntu, alpine, etc.), then remote.Head will return the index's digest, which will never be populated in the cache. 😢 This is because the remote.Image we call later uses WithPlatform of the worker node's OS+arch, and returns the platform-specific image (not index), which gets returned and set in the cache in entrypoint_lookup.go.

So this is likely not a full solution to the problem, but should help in the case of single-platform images. We can't seem to resolve index->image (by platform) without a remote GET, which incurs the rate limit hit.

@dlorenc
Copy link
Contributor

dlorenc commented Aug 25, 2021

/lgtm

nice!

@vdemeester
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Aug 26, 2021
@tekton-robot tekton-robot merged commit 5a774e6 into tektoncd:main Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResolveEntrypoints looks up manifest breaking Dockhub Registry Limit
4 participants