-
Notifications
You must be signed in to change notification settings - Fork 70
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
ImageUpdateAutomation enhancements with v1beta2 API #643
Comments
We should take into account the digest feature that will land sometime this year and design IAC with this in mind. I guess we could store the digest in
What about ResultV2, how would digest fit in there without having to introduce v3? |
A Considering the previous work in fluxcd/image-reflector-controller#368, for manifest with marker: containers:
- name: c
image: image:v1.0.0 # {"$imagepolicy": "automation-ns:policy"} If the ImagePolicy's latest image contains a digest, the update will also include the digest. The If we introduce a digest setter as in #508, allowing the following setter use case containers:
- name: c
image: image:v1.0.0 # {"$imagepolicy": "automation-ns:policy:digest"} The ResultV2 Results like the following will be supported depending on the commit template and setter: |
In addition, it would be better to store the image policy result in ImageUpdateAutomation status in the format defined in fluxcd/image-reflector-controller#368. Not a string but as status:
observedPolicies:
- name: policyA
latestRef:
name: foo/bar1
tag: v1.0
- name: policyB
latestRef:
name: foo/bar2
tag: v1.5 |
Awesome, so we are all covered here.
Yes let's do this! |
Updated the examples in the issue description to be in the new |
Slight change in the status:
...
observedPolicies:
podinfo:
name: ghcr.io/stefanprodan/podinfo
tag: 5.0.3
podinfo-test-1:
name: ghcr.io/stefanprodan/podinfo
tag: 4.0.6
podinfo-test-2:
name: ghcr.io/stefanprodan/podinfo
tag: 4.0.0
... Will update the example in the issue description accordingly. |
Similar to other Flux controllers, image-automation-controller is undergoing refactoring. The refactor includes overall code organization changes and design enhancements. This issue discusses the enhancements and API changes.
Refactor PR #647.
Update ResultV2
In order to address #437 (inclusion of previous and new value in the update result), the update
Result
data structure needs to be changed. The current structure is based onfile -> objects -> images
. This only accounts for updates that involve the full image (name+tag) updates. Partial image updates (name or tag) are not recorded in the result. In order to provide complete details about what was updated, we need to record the complete change regardless of image reference.A new ResultV2 can be introduced to capture all the kinds of updates and the previous value with the structure
file -> objects -> changes
. A change constitutes the old value, the new value and the setter responsible for the update. This can be used to construct commit messages like the following with old and new values:In order to keep the current commit templates working as before,
TemplateData
will be extended by introducing the new field for file change based data.The new result will be an opt-in feature.
See #642 for the implementation.
ImagePolicy selector support
Currently, all the ImagePolicies present in a namespace are considered when performing an update. Based on a lot of user feedback, policy selectors will be introduced will allow selecting image policies based on their labels via
.spec.policySelector
field in ImageUpdateAutomation. An implementation of this exists in #619. Along with this, the selected image policies will also be recorded in the status of ImageUpdateAutomation object with their latest images. This will help evaluate and reason about the result of an update, enhancing troubleshooting experience.short-circuit reconciliations
When nothing has changed (git repository commits and the image policies latest images), the reconciliations can be returned early, avoiding full reconciliations. If the latest images of the ImagePolicies have not changed and the remote git repository has no new commit, the full reconciliation operation can be skipped. This will require recording the ImagePolicies and their latest images observed in the last reconciliation, which is described above. And also recording the last observed revision in the git repository. We use similar technique in source-controller to avoid rebuilding the artifact if there's no new commit in the git repository. These can be stored in the status of the ImageUpdateAutomation,
.status.observedPolicies
and.status.observedSourceRevision
.During a reconciliation, git repository can be checked for new commit and the image policies can be checked for new latest images before performing the full reconciliation.
The
observedSourceRevision
will follow any updates in the remote git repository and it will diverge from thelastPushCommit
until new updates are pushed.Limitation: When using a different push branch from the checkout branch or even a refspec, it's difficult to detect a drift in the remote branch at present. This short-circuit reconciliation will only apply when the push branch and checkout branch are the same. In the future, we can work on adding capabilities to also check push branch and refspec and extend this capability.
TODO:
The text was updated successfully, but these errors were encountered: