-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Try .docker/.dockercfg and $HOME/.docker/... too #2260
Comments
The issue is that when we create the secret containing the file about the docker credentials, kubernetes proposes 2 formats including the new but the filename is different. So, when they will be mounted from the generated secret, then they will be created as such old: |
I still get a Bearer anonymous even if I use the
|
Somehow, it still couldn't retrieve credentials for the target image. If all goes well, you should see something like
Can you try passing |
I added the parameter as you suggested
but we got another error : https://gist.github.com/cmoulliard/945a461e2abc33d222177a553bb1a0ae#file-gistfile1-txt-L398 This error is perhaps related to the fact that the config.json file that I'm using has been created manually and dont use the one generated by kubernetes/openshift :-( Log of the docker registry is reporting invalid token
|
Great that
Likely. The content of your password (
This password is being passed as (from https://gist.github.com/cmoulliard/2a0edd9f2e6e1f3b28539539021e2426)
So I think it's just that the password in |
That means that for the moment, if we want to perform a build on openshift and that we push the image to the docker internal registry using JIB, then we must use a pre-step able to convert the This is what tekton is doing as pre-step here : https://github.com/tektoncd/pipeline/blob/master/pkg/credentials/dockercreds/creds.go#L151 |
Ah, I didn't realized |
Right according to this log of the docker registry
Remarks :
|
@cmoulliard Kubernetes has two types of secrets: |
I agree but the issue is that currently on ocp only the secret containing the old format is populated and not the new one needed by JBI.
|
Why is it an issue? Kubelet and other tools usually support both formats and there is no reason to create a second secret in another format. No matter what type you have, you can link the secret to a service account and it will be used for pulling images. That's how it is implemented in Kubernetes: https://github.com/kubernetes/kubernetes/blob/7f23a743e8c23ac6489340bbb34fa6f1d392db9d/pkg/credentialprovider/secrets/secrets.go#L29 |
@dmage. The concern/issue that we have is that currently Openshift only populates the old docker config format within a secret for the serviceaccount Is there a way to tell to openshift to populate the secret with the type |
It's not an issue. If your tool works with Kubernetes secrets, it should support both formats. |
Till JIB fixes the problem to support the old docker config format, can you tell us how to resolve that please in order to use the new one ? @dmage |
@cmoulliard OpenShift populates secrets only in one format, you cannot change this. |
Jib does not work with Kubernetes secrets. The |
@briandealwis still OpenShift can't change the format because of backward compatibility: other tools may rely on the secret format. We can change it only with another major release.
Well, it does. Or you wouldn't have this problem. |
@dmage I believe what @briandealwis tried to say is that fundamentally Jib is not a tool for k8s. Jib neither interfaces with k8s nor requires it. It happens to be that @cmoulliard tried to run Jib on the k8s platform for whatever reasons. But I think it is not terribly difficult to read the old Docker config format; looks like I just need to wrap the entire JSON of the old format with an outer |
@chanseokoh Do you agree that we update this part of the code in order to :
|
I hope we don't need to add new properties, can we just handle this in a known order? |
@cmoulliard I'm working on it, just in case. |
Dont forget then to take care of the filename created by kubernetes -> |
@cmoulliard can you confirm that the actual file for the new format is |
ocp only creates the old config file within the pod -> |
@cmoulliard I installed Tekton on Red Hat CodeReady Containers and was testing the Jib Maven Tekton task. I came to know that Tekton actually provides an auth mechanism to create
|
@cmoulliard we've released Jib 2.1.0 with this fix. |
FTR
This auth mechanism has an issue and I see it may not work in the future.
I came to understand how Kubernetes kind: Secret
...
type: kubernetes.io/basic-auth
stringData:
username: developer
password: 5Am4... the filenames will be
For the
or kind: Secret
...
data:
.dockerconfigjson: eyJodHRwczovL2luZGV4L ... J0QUl6RTIifX0=
type: kubernetes.io/dockerconfigjson Therefore, the filename will be
|
(From #2258 (comment).)
It may (or may not) make sense to check
.dockercfg
. Looks like it was an old config name. Note.dockercfg
has a different JSON structure. Seems like.dockercfg
is from a really old Docker version.But more importantly, I think we should also try
$HOME
in addition toSystem.getProperty("user.home")
: #2260 (comment)The text was updated successfully, but these errors were encountered: