-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Merge existing image credentials into a fresh set #1702
Conversation
After deploying this to one of our clusters it seems to create a new issue where Flux is unable to pull images tied to
|
fluxd doesn't try to extract secrets from |
No, I'm being silly -- what's happening is that the credentials extracted from HelmRelease (i.e., none) pre-empting the credentials from the other workloads. This is a bug, but it's not clear what the correct solution is. Going back to merging credentials will solve it, but is not obviously correct either; excluding HelmRelease objects when scanning for images will give the right result, but seems like an arbitrary special case. |
Logically, I'm not sure how this changes the situation: before, credentials were merged meaning an entry for a particular registry can be overwritten (last entry wins); now, whichever workload is scanned first will supply the credentials, and no others can (first entry wins). Either way, if you have two distinct credentials against workloads using the same image, one of them will non-deterministically "win". |
.. all of which doesn't go anywhere in countering your actual experience of it not working! We found the problem with the existing code: https://github.com/weaveworks/flux/blob/master/cluster/kubernetes/images.go#L155 mutates a set of credentials which can be assigned to other images. The most direct fix would be to create a fresh set of credentials for each image, and merge the others into it; i.e.,
|
With the previous merging strategy the set of credentials which got mutated could be assigned to other images, resulting in overwrites where we would (and did) not expect them. This new approach is the most direct fix to work around mutating the credentials of other images. It creates a fresh set of (empty) credentials and merges the others into it before assigning it to the image.
52505f2
to
284b2a1
Compare
Force-pushed the fix mentioned above to solve the issue without leaving a trail of my original approach, which skipped the merge if there were already credentials present for an image. |
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 right to me 🍎
Fixes #1485
With the previous merging strategy the set of credentials which got
mutated could be assigned to other images, resulting in overwrites
where we would (and did) not expect them.
This new approach is the most direct fix to work around mutating the
credentials of other images. It creates a fresh set of (empty)
credentials and merges the others into it before assigning it to the
image.
Details