Bug 1771335
| Summary: | S2I build from authenticated registry can't pull image | ||||||
|---|---|---|---|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | David Simansky <dsimansk> | ||||
| Component: | Build | Assignee: | Gabe Montero <gmontero> | ||||
| Status: | CLOSED ERRATA | QA Contact: | wewang <wewang> | ||||
| Severity: | urgent | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 4.3.0 | CC: | adam.kaplan, aos-bugs, gmontero, maschmid, wzheng | ||||
| Target Milestone: | --- | Keywords: | NeedsTestCase | ||||
| Target Release: | 4.3.0 | ||||||
| Hardware: | x86_64 | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2020-01-23 11:12:18 UTC | Type: | Bug | ||||
| Regression: | --- | Mount Type: | --- | ||||
| Documentation: | --- | CRM: | |||||
| Verified Versions: | Category: | --- | |||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||
| Embargoed: | |||||||
| Attachments: |
|
||||||
|
Description
David Simansky
2019-11-12 08:00:33 UTC
Furthermore other tests the configure DeploymentConfig to run on the base OpenJDK image from registry.redhat.io works without any issues. This seems to be only related to s2i build. Able to reproduce on 4.3.0-0.ci-2019-11-12-025736. Notable observations: 1. Pull secret created as a .dockercfg file [1] 2. Imagestream import from registry.redhat.io failed using the pull secret I provided. Same pull secret worked pulling images via docker (on macOS) 3. Pulling image locally got me past an initial error importing the imagestream tag. [1] https://docs.openshift.com/container-platform/4.2/openshift_images/managing-images/using-image-pull-secrets.html#images-allow-pods-to-reference-images-from-secure-registries_using-image-pull-secrets @Adam perhaps already on your radar, but this could be a containers/image problem. Somewhat similar, I had to submit https://github.com/containers/image/pull/722 to get pulls to work with a .dockercfg based secret when getting the disconnected support for builds to work when trying to pull images from the image registry. Perhaps something is amiss with .dockerconfigjson format as well. Or maybe something was broken in containers/image in general with the last bump of c/image in openshift/builder There is something very broken with containers/image. I found that on macOS the .dockerconfigjson format is not correct for Docker CE. Furthermore seeing this in the build when trying to pull from registry.redhat.io (log level 6): ``` I1113 14:25:09.074137 1 daemonless.go:61] looking for config.json at /var/run/secrets/openshift.io/pull/config.json time="2019-11-13T14:25:09Z" level=debug msg="parsed reference into \"[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.imagestore=/var/lib/shared]registry.redhat.io/openjdk/openjdk-11-rhel8:latest\"" time="2019-11-13T14:25:09Z" level=debug msg="parsed reference into \"[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.imagestore=/var/lib/shared]registry.redhat.io/openjdk/openjdk-11-rhel8:latest\"" I1113 14:25:09.074215 1 cfg.go:163] error reading file: open /var/run/secrets/openshift.io/pull/config.json: no such file or directory I1113 14:25:09.074233 1 daemonless.go:61] looking for .dockerconfigjson at /var/run/secrets/openshift.io/pull/.dockerconfigjson I1113 14:25:09.074333 1 daemonless.go:61] found valid .dockerconfigjson at /var/run/secrets/openshift.io/pull/.dockerconfigjson time="2019-11-13T14:25:09Z" level=debug msg="reference \"[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.imagestore=/var/lib/shared]registry.redhat.io/openjdk/openjdk-11-rhel8:latest\" does not resolve to an image ID" time="2019-11-13T14:25:09Z" level=debug msg="registry \"registry.redhat.io\" is not listed in registries configuration \"/etc/containers/registries.conf\", assuming it's not blocked" time="2019-11-13T14:25:09Z" level=debug msg="parsed reference into \"[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.imagestore=/var/lib/shared]registry.redhat.io/openjdk/openjdk-11-rhel8:latest\"" time="2019-11-13T14:25:09Z" level=debug msg="parsed reference into \"[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.imagestore=/var/lib/shared]registry.redhat.io/openjdk/openjdk-11-rhel8:latest\"" time="2019-11-13T14:25:09Z" level=debug msg="copying \"docker://registry.redhat.io/openjdk/openjdk-11-rhel8:latest\" to \"registry.redhat.io/openjdk/openjdk-11-rhel8:latest\"" time="2019-11-13T14:25:09Z" level=debug msg="starting to write to image \"containers-storage:[overlay@/var/lib/containers/storage+/var/run/containers/storage:overlay.imagestore=/var/lib/shared]registry.redhat.io/openjdk/openjdk-11-rhel8:latest\" using blob cache in \"/var/cache/blobs\"" time="2019-11-13T14:25:09Z" level=debug msg="reference rewritten from 'registry.redhat.io/openjdk/openjdk-11-rhel8:latest' to 'registry.redhat.io/openjdk/openjdk-11-rhel8:latest'" time="2019-11-13T14:25:09Z" level=debug msg="Trying to pull \"registry.redhat.io/openjdk/openjdk-11-rhel8:latest\"" time="2019-11-13T14:25:09Z" level=debug msg="Credentials not found" time="2019-11-13T14:25:09Z" level=debug msg="Using registries.d directory /etc/containers/registries.d for sigstore configuration" time="2019-11-13T14:25:09Z" level=debug msg=" No signature storage configuration found for registry.redhat.io/openjdk/openjdk-11-rhel8:latest" time="2019-11-13T14:25:09Z" level=debug msg="Looking for TLS certificates and private keys in /etc/docker/certs.d/registry.redhat.io" time="2019-11-13T14:25:09Z" level=debug msg="GET https://registry.redhat.io/v2/" ``` I was able to do an oc debug on the build pod - the .dockerconfigjson had the correct pull secret for registry.redhat.io. Given where we are in the release, I am going to revert the latest buildah+containers/image bump. @Gabe based on my analysis, we may an issue with some of the logic you added in [1]. It looks like we are passing in a dockercfg that the keyring can't look up. [1] https://github.com/openshift/builder/pull/102 Created attachment 1635945 [details]
reproducer with --build-loglevel=6
OK I have a patch that gets .dockerconfigjson based secrets working
@David - can you confirm whether when you created the secret you did
1) oc create secret generic <pull_secret_name> \
--from-file=.dockercfg=<path/to/.dockercfg> \
--type=kubernetes.io/dockercfg
or
2) oc create secret generic <pull_secret_name> \
--from-file=.dockerconfigjson=<path/to/.docker/config.json> \
--type=kubernetes.io/dockerconfigjson
@Gabe, yes it was `dockerconfigjson` format. Actually Customer Portal is generating Secret yaml in dockerconfigjson format. ``` apiVersion: v1 kind: Secret metadata: name: rhoarqe-pull-secret data: .dockerconfigjson: <REDACTED_TOKEN> type: kubernetes.io/dockerconfigjson ``` Verified in version:
4.3.0-0.nightly-2019-11-18-175710
steps:
1.Create a bc from registry.redhat.io/rhscl/ruby-25-rhel7:latest image
kind: BuildConfig
apiVersion: v1
metadata:
name: pullsecret-ruby
spec:
source:
git:
uri: "https://github.com/openshift/ruby-hello-world"
strategy:
type: Source
sourceStrategy:
from:
kind: DockerImage
name: registry.redhat.io/rhscl/ruby-25-rhel7:latest
2. Create a pull secret
$ oc create secret generic test-secret --from-file=.dockerconfigjson=/root/.docker/config.json --type=kubernetes.io/dockerconfigjson
3. Add pull secret to bc
$ oc set build-secret --pull bc/pullsecret-ruby test-secret
4. Link builder to secret
$oc secrets link builder test-secret
5. Create a build
[root@Desktop ~]# oc get builds
NAME TYPE FROM STATUS STARTED DURATION
pullsecret-ruby-1 Source Git@57073c0 Complete 4 minutes ago 1m45s
[root@Desktop ~]# oc logs -f build/pullsecret-ruby-1
Cloning "https://github.com/openshift/ruby-hello-world" ...
Commit: 57073c041d103a412ff7d4a6e64b0ea7f77ea1b3 (Merge pull request #85 from wewang58/master)
Author: Ben Parees <bparees.github.com>
Date: Wed Nov 6 09:41:20 2019 -0500
Caching blobs under "/var/cache/blobs".
Getting image source signatures
Copying blob sha256:4a356d454a56b5710572b0d606627d6c9b066deaddea797d5fc8f647674386b9
Copying blob sha256:e5112e3dbe5c13c331015f062c932b60533e76b0c47c1b3707d8f80a86dacfd6
Copying blob sha256:1c9f515fc6ab2b7ebfcaffd8af681b68869d78a3b19c69e87c296363ab1bc2fe
Copying blob sha256:f1e961fe4c5192ab9f8e241a2efc674779623ac6a3ed49ee9a1a5b3b8425fe0d
Copying blob sha256:1d2c4ce43b78cb9a97ede7f19ad1406a43ee50532568bda660193e4a404b424f
Copying config sha256:edc7d7c4ec658c977fe573251e2a2b4ab79c99d8a9b2221721e90619fbacb555
Writing manifest to image destination
Storing signatures
Generating dockerfile with builder image registry.redhat.io/rhscl/ruby-25-rhel7:latest
also tried using command: oc create secret generic test-secret1 --from-file=.dockerconfigjson=/path to/config.json --type=kubernetes.io/dockerconfigjson, it works.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:0062 |