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

imagestreamplugin: sort based on generation #68

Open
alaypatel07 opened this issue Jul 17, 2020 · 2 comments
Open

imagestreamplugin: sort based on generation #68

alaypatel07 opened this issue Jul 17, 2020 · 2 comments

Comments

@alaypatel07
Copy link

  - items:
    - created: "2020-07-17T14:46:03Z"
      dockerImageReference: docker.io/alaypatel07/ruby-hello-world@sha256:173646699fdcfe7c1bca741cb545cf4409046dc2315898466533db694da2d2b5
      generation: 4
      image: sha256:173646699fdcfe7c1bca741cb545cf4409046dc2315898466533db694da2d2b5
    - created: "2020-07-17T01:24:06Z"
      dockerImageReference: docker.io/alaypatel07/ruby-hello-world@sha256:8c392e72bdcf42cb3d051007797d7272c42934594da18d42ddce8d40bd99e6b6
      generation: 3
      image: sha256:8c392e72bdcf42cb3d051007797d7272c42934594da18d42ddce8d40bd99e6b6
    tag: alias

for the same tag, the current logic to transfer the image is to reverse the order and push the oldest image first. Instead of assuming that reversing the order will produce the right output, I wonder if we can sort the list based on generation value to come up with a consistent list of images generated in order w.r.t. time

@alaypatel07
Copy link
Author

status:
  dockerImageRepository: docker-registry.default.svc:5000/image-benchmark/time
  tags:
  - items:
    - created: "2020-07-17T01:06:57Z"
      dockerImageReference: docker-registry.default.svc:5000/image-benchmark/time@sha256:e657280d6bb690c4eb2e1384598cba802fe29a77bacea86889194ac1cc4d4be3
      generation: 1
      image: sha256:e657280d6bb690c4eb2e1384598cba802fe29a77bacea86889194ac1cc4d4be3
    - created: "2020-07-17T01:04:20Z"
      dockerImageReference: docker-registry.default.svc:5000/image-benchmark/time@sha256:253c98ed23b04b7062b5fabea19ecff1808ae0f74da6b05d6979fc179bbf6f09
      generation: 1
      image: sha256:253c98ed23b04b7062b5fabea19ecff1808ae0f74da6b05d6979fc179bbf6f09
    tag: latest

I dont understand how that works, especially both generation being 1

@alaypatel07
Copy link
Author

	// Generation is a counter that tracks mutations to the spec tag (user intent). When a tag reference
	// is changed the generation is set to match the current stream generation (which is incremented every
	// time spec is changed). Other processes in the system like the image importer observe that the
	// generation of spec tag is newer than the generation recorded in the status and use that as a trigger
	// to import the newest remote tag. To trigger a new import, clients may set this value to zero which
	// will reset the generation to the latest stream generation. Legacy clients will send this value as
	// nil which will be merged with the current tag generation.
	// +optional
	Generation *int64 `json:"generation" protobuf:"varint,5,opt,name=generation"`

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

No branches or pull requests

1 participant