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

Image name/tag resolution preprocessing pass #1697

Open
bgrant0607 opened this issue Oct 9, 2014 · 25 comments
Open

Image name/tag resolution preprocessing pass #1697

bgrant0607 opened this issue Oct 9, 2014 · 25 comments
Labels
area/app-lifecycle area/images-registry lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/apps Categorizes an issue or PR as relevant to SIG Apps.

Comments

@bgrant0607
Copy link
Member

As discussed in #1007, #1694, #1132, and elsewhere, Docker image names/tags are not immutable. If one wants a repeatable deployment, predictable rollbacks, etc., they need to be resolved at deployment time and recorded. I expect rollbacks to be driven off of version-controlled configuration data, which means they need to be processed on the client side or returned to the client. I propose a self-contained pre-processing program to do this, to fit into the build-oriented approach proposed in #1694.

The original names/tags should be recorded in the pod as annotations.

@bgrant0607
Copy link
Member Author

Note that pulling by image id may not be supported by Docker: moby/moby#4106.

We could help push/implement that feature, and/or we could potentially work around it by adding a new unique tag to the image.

@erictune
Copy link
Member

How does this interact with PullPolicy?
On Oct 9, 2014 3:55 PM, "bgrant0607" notifications@github.com wrote:

Note that pulling by image id may not be supported by Docker:
moby/moby#4106 moby/moby#4106.

We could help push/implement that feature, and/or we could potentially
work around it by adding a new unique tag to the image
https://docs.docker.com/reference/api/docker_remote_api_v1.14/#tag-an-image-into-a-repository
.


Reply to this email directly or view it on GitHub
#1697 (comment)
.

@bgrant0607
Copy link
Member Author

@erictune Excellent question!

Current policies are PullAlways (the default), PullNever, and PullIfNotPresent.

Really only PullNever and PullIfNotPresent are useful if one binds to a specific version, though PullAlways would still work -- ideally Docker should realize it doesn't actually need to pull in that case.

I don't expect everyone to use this pass. People who don't care about predictable deployments and rollbacks probably wouldn't use it, for instance, and would just use a combination of PullPolicy and version tags (e.g., ubuntu:14.04) instead.

@bgrant0607
Copy link
Member Author

We could also do image name validation. Currently, pods just stay in Waiting forever and the user has to look at Docker logs to figure this out. This was discussed in #1088, but we should just validate image names as early as possible.

@bgrant0607 bgrant0607 added the priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. label Dec 4, 2014
@smarterclayton
Copy link
Contributor

We're working on getting pull be immutable id into the next version of the registry.

@bgrant0607 bgrant0607 added status/help-wanted area/usability sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. labels Feb 28, 2015
@bgrant0607
Copy link
Member Author

Docker 1.6 supports content-addessable images.

Also discussed in the context of pull policy (#3028) and rolling updates (#1353, #1743).

@bgrant0607
Copy link
Member Author

Presentation on our internal package manager:
https://www.usenix.org/sites/default/files/conference/protected-files/lisa_2014_talk.pdf

@shaded-enmity
Copy link

Greetings,

just today I committed support for obtaining the image digest from the V2 Registry:

https://github.com/shaded-enmity/docker-doug/tree/distv2

It's as simple as:

$ doug-cli digest fedora:21
sha256:f53501a88bdc4bbc026f251671e9b3014699403d2015bf1473444d43a2de736f

A quick introduction into libdoug / doug-cli:

  • self-sufficient library/binary for working with image histories and Docker internals
  • focused on delivering consistent update model:
    • version information is stored in the tag
    • built-in solver for version-release versioning strategy
    • 'latest' tag is ignored because it's not what people expect it to be

My original plan was to have 'hooks' or 'triggers' into K8s to issue a configuration change when new version of an image was available, but after seeing this issue and #1743 I think that the scope of libdoug fits very well into the requirements:

  • self-contained program
  • ad-hoc querying of remote registries for image changes
  • consistent update model

It's written in Python, but I could rewrite it in Go should that be a problem for integration.

@ncdc
Copy link
Member

ncdc commented May 21, 2015

distribution/distribution#387 was merged yesterday, providing a Go client for 2.0 registries.

We could vendor it in and use it directly, or if that's not desirable, we could provide a contrib example that uses the distribution code to get the digest for a specific repo and tag.

@ncdc
Copy link
Member

ncdc commented May 21, 2015

Also, see #7203 for information about rkt image identifiers, and the differences between how rkt and Docker identify images.

@bgrant0607 bgrant0607 added this to the v1.0-post milestone May 22, 2015
@bgrant0607 bgrant0607 removed this from the v1.0-post milestone Jul 24, 2015
@bgrant0607 bgrant0607 added priority/backlog Higher priority than priority/awaiting-more-evidence. and removed priority/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough support to actually get it done. kind/design Categorizes issue or PR as related to design. labels Jul 27, 2015
@bgrant0607 bgrant0607 added priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. and removed priority/backlog Higher priority than priority/awaiting-more-evidence. labels Jun 30, 2017
@smarterclayton
Copy link
Contributor

OpenShift 3.6 implements an admission controller that automatically replaces image tags with digests if the image matches a known construct. I believe weaveworks Flux also has mechanisms for this at config time. With initializers, it should now be possible to resolve images in replicasets to digests automatically, and that may be a good candidate for a simple example of how initializers can be used.

@bgrant0607
Copy link
Member Author

I've been thinking the image "stream" could be specified by an annotation initially and, eventually, a field.

One issue is that access to the image pull secrets is needed.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or @fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 2, 2018
@bgrant0607
Copy link
Member Author

/remove-lifecycle stale
/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 16, 2018
@spiffxp spiffxp removed the triaged label Mar 16, 2018
@lavalamp
Copy link
Member

lavalamp commented Oct 3, 2018

While designing webhooks / apply we've actually had in mind the case where a mutating admission webhook resolves the image tag and swaps in the digest. Unfortunately, to get the right rollback behavior I think you'd have to resolve when the template is submitted and not when the pod is created (so on all of deployment, statefulset, daemonset, ... create/update).

Anyway I don't think there's anything stopping someone from making an image resolver cluster plugin.

@lavalamp
Copy link
Member

lavalamp commented Oct 3, 2018

(Which is to say, I'm not 100% sure it will work, but I'd be interested in seeing the results if someone tries.)

@bgrant0607
Copy link
Member Author

Another example solution:
https://carvel.dev/kbld

That would be great as a kubectl plugin.

@ahmetb
Copy link
Member

ahmetb commented Feb 19, 2022

https://github.com/google/k8s-digester also offers this either as an admission controller or a client-side kpt function.

jsafrane pushed a commit to jsafrane/kubernetes that referenced this issue Sep 26, 2023
…erry-pick-1694-to-release-4.11

[release-4.11] OCPBUGS-18843: UPSTREAM: <carry>: Force using host go always and use host libriaries
@github-project-automation github-project-automation bot moved this to Needs Triage in SIG Apps Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/app-lifecycle area/images-registry lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. sig/apps Categorizes an issue or PR as relevant to SIG Apps.
Projects
Status: Needs Triage
Development

No branches or pull requests