-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Implement whitelist for usage of TS from labels #2176
Conversation
I've tried this with an image compiled on my own (
which produces this output for the
Here, the images showing date of 25 Jan 19 are those with a build timestamp inherithed by their parent image but built actually this week. Instead, in the newer images I've overwritten the parent timestamp with a new one. And finally, a release for that same workload gives me this error:
If I can help you more with this please ask me here or in chat, thanks for your work |
@azazel75 this is probably due to the fact that your cache is already filled, I need to bump the version somewhere in the source so it creates new entries. You can confirm this by emptying your memcached instance (deleting the pod should be sufficient). |
@hiddeco But I have completely erased the |
@azazel75 please try it with a |
@hiddeco you were right, I wasn't using the
but a release still gives me an error:
|
6234b8f
to
29b618b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks correct to me 👍 A test specifically of the decorated Registry would be good.
Could the glob pattern be tested once for the whole repo, or is it possible to have e.g., --registry-use-labels=fluxcd/flux:master-*
?
Not possible, filtering happens on the canonical reference, e.g. |
3159c11
to
3ba00ae
Compare
OK so you can test outside the loop -- all the images in an |
1dfe6c6
to
35226d3
Compare
We did not take the inheritance of labels from base images into account while developing the timestamps from image labels feature. As a result, users started experiencing issues with automated image updates, due to the (moderately old) timestamp from the base image being picked up and prioritized over the timestamp from the registry. This commits adds the ability to decorate `ImageRepository` structures before they are returned from cache by `GetImageRepositoryMetadata`. The sole decorator for now is `TimestampLabelWhitelist`, which replaces the `CreatedAt` field on the image info with the timestamp specified in one of the labels if the canonical name of the image matches one of the glob patterns on the whitelist. As a result, the labels from images will only be used if explicitly instructed by the user, dealing with the problem described at the top of this comment.
35226d3
to
6a3835a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM again 🍍
Implement whitelist for usage of TS from labels
In #2176 a whitelist option for the usage of image timestamps was implemented. This PR did however not remove the `CreatedTS` method, with as a result that some elements of Flux like `fluxctl` would still consult the timestamp parsed from labels, rather than relying on the cache decorated `info.CreatedAt`. This commit removes the method, and replaces any calls made to it with `info.CreatedAt`.
In #2176 a whitelist option for the usage of image timestamps from labels was implemented. This PR did however not remove the `CreatedTS` method, with as a result that some elements of Flux like `fluxctl` would still consult the timestamp parsed from labels, rather than relying on the cache decorated `info.CreatedAt`. This commit removes the method, and replaces any calls made to it with `info.CreatedAt`, so that a timestamp from a label is not mistakenly used while the image has not been whitelisted.
In #2176 a whitelist option for the usage of image timestamps from labels was implemented. This PR did however not remove the `CreatedTS` method, with as a result that some elements of Flux like `fluxctl` would still consult the timestamp parsed from labels, rather than relying on the cache decorated `info.CreatedAt`. This commit removes the method, and replaces any calls made to it with `info.CreatedAt`, so that a timestamp from a label is not mistakenly used while the image has not been whitelisted.
We did not take the inheritance of labels from base images into account
while developing the timestamps from image labels feature. As a result,
users started experiencing issues with automated image updates, due to
the (moderately old) timestamp from the base image being picked up and
prioritized over the timestamp from the registry.
This commits adds the ability to decorate
ImageRepository
structuresbefore they are returned from cache by
GetImageRepositoryMetadata
.The sole decorator for now is
TimestampLabelWhitelist
, which replacesthe
CreatedAt
field on the image info with the timestamp specified inone of the labels if the canonical name of the image matches one of
the glob patterns on the whitelist.
As a result, the labels from images will only be used if explicitly
instructed by the user, dealing with the problem described at the top
of this comment.