-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Flux uses wrong imagePullSecret #1485
Comments
Fluxd does only look at secrets in the same namespace as the workload (because those are the only secrets that are relevant to a workload). But the code in question is compiling credentials for images, not for workloads. This is more or less the algorithm:
Two things you may notice:
In other words, assuming that all the workloads run correctly, every image should have valid credentials. Since we have documentary evidence of that not being the case, we have to reject one of the assumptions. Either
My money is on 1. (though it might take a bit of test case construction and debugging to figure out how it's wrong). |
I do not think option 3 is possible because with an incorrect configuration Kubernetes would not be able to pull the images either and each namespace only has one Do you have a link to the described algorithm so I can take a look at it? I am also betting on 1. |
It's in cluster/kubernetes/images.go |
After reading the description of your algorithm again and skimming trough
The issue is in the last sentence. When two Pods with different Later in the process ( You can validate my theory by following the next steps:
|
I think the scenario you're describing is this:
At this point, you see errors in the log, as fluxd tries to scan (say) According to the algorithm, this is what should happen:
When scanning imageA, it can only use credsA; and when scanning imageB, it can only use credsB; when scanning imageC, it can use credsA or credsB, depending on the order it looked at the workloads, but either is fine. My conclusion is that the code doesn't implement the algorithm as given. Or I've misinterpreted your description of the test case. |
Our clusters are running on GKE under GCP
project-x
. Images are however published to GCP projects dedicated to the product (e.g. GCP projectproduct-y
).We add a Docker secret for this GCP project to every product's namespace and use this to pull from the GCR dedicated to this product with a
imagePullSecrets
set on the workload.Now what Flux tries to do is to pull an image from
product-y
with the credentials fromproduct-z
.Say we have a product
subscription
and a productpublish
Flux logs the following:ts=2018-10-30T11:10:19.340162325Z caller=warming.go:192 component=warmer canonical_name=eu.gcr.io/subscription/image auth="{map[eu.gcr.io:<registry creds for [email protected], from publish:secret/gcrsecret>]}" err="requesting tags: denied: Failed to read tags for host 'eu.gcr.io', repository '/v2/subscription/image/tags/list'
After some thinkering with @squaremo we came to the conclusion that credential merge happens on registry (e.g.
eu.gcr.io
), which is the same for both secrets although they differ (they have a uniqueproject_id
).I think the solution would be for Flux to adhere to the same rules as Kubernetes and only use
imagePullSecrets
from the same namespace as the workload.The text was updated successfully, but these errors were encountered: