-
Notifications
You must be signed in to change notification settings - Fork 67
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
Feature Request: Configurable Latest Tags Count for ImageRepository #595
Comments
The latest tags number is just for display, the controller stores all tags of an image, not only the latest 10. The policies for a specific image repo, are executed on the full list of tags. |
@stefanprodan |
The assumptions made in this issue are quite wrong, the number of tags from status play no role in the controller's behaviour. Also the tags listed in status can't be used for any decision making because the upstream registry can serve pages in any order, what you think it's latest can be oldest. The proper way to select "latest" is using an ImagePolicy that looks at all tags and selects latest based on the regex/semver. |
@stefanprodan It’s not a problem for us if the order of the tags in the status is not exact. Rather than relying on the order, we want to apply custom processing logic based on the tags listed in the status. With that said, I would still like to have the ability to increase the number of tags stored in the status for the following reasons:
For these reasons, I believe that making the number of tags stored in the |
Current Behavior
Currently, the
image-reflector-controller
in FluxCD limits the number of latest tags to 10 for all ImageRepository resources. This is hardcoded in thegetLatestTags
function:image-reflector-controller/internal/controller/imagerepository_controller.go
Line 61 in 15a1b09
image-reflector-controller/internal/controller/imagerepository_controller.go
Lines 630 to 642 in 15a1b09
Desired Behavior
We would like to make the number of latest tags configurable on a per-ImageRepository basis, with a default of 10. This would allow users to retrieve more (or fewer) latest tags as needed for specific repositories.
Proposed Solution
We propose adding a
latestTagsCount
field to the ImageRepository spec:Implementation Details
latestTagsCount
field.getLatestTags
function to accept a parameter for the count:Benefits of Increasing Latest Tags Count
Better visibility into recent releases: For projects with frequent releases or using date-based versioning, having access to more than 10 latest tags provides a more comprehensive view of recent project history.
Improved automation capabilities: With more tags available, users can create more sophisticated automation workflows, such as rolling back to specific versions or tracking longer-term trends in releases.
Enhanced compatibility with various versioning schemes: Some projects may use versioning schemes that produce many tags in a short time (e.g., build numbers or git commit hashes). A higher tag count allows for better compatibility with these schemes.
More flexible image selection: Users can implement more nuanced policies for selecting images based on a larger pool of recent tags.
Better support for canary releases and A/B testing: With access to more tags, users can more easily manage multiple versions of an application for testing or gradual rollout purposes.
Using CEL for Validation
To ensure that the
latestTagsCount
is not set to a value less than 10, we can use Common Expression Language (CEL) for validation. Here's an example of how to implement this validation:This CEL rule does the following:
latestTagsCount
is present in the spec.This approach ensures that users can increase the
latestTagsCount
beyond 10, but prevents them from setting it to a value less than 10, maintaining a minimum level of recent tag history.The text was updated successfully, but these errors were encountered: