Skip to content

Commit f6c505f

Browse files
authored
Merge pull request #35639 from mburke5678/ocpnode-596
Support Multiple Logins to the Same Registry
2 parents 66dc063 + 318d655 commit f6c505f

5 files changed

+66
-22
lines changed

modules/builds-docker-credentials-private-registries.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
You can supply builds with a .`docker/config.json` file with valid credentials for private container registries. This allows you to push the output image into a private container image registry or pull a builder image from the private container image registry that requires authentication.
99

10+
You can supply credentials for multiple repositories within the same registry, each with credentials specific to that registry path.
11+
1012
[NOTE]
1113
====
1214
For the {product-title} container image registry, this is not required because secrets are generated automatically for you by {product-title}.
@@ -21,12 +23,20 @@ auths:
2123
https://index.docker.io/v1/: <1>
2224
auth: "YWRfbGzhcGU6R2labnRib21ifTE=" <2>
2325
email: "[email protected]" <3>
26+
https://docker.io/my-namespace/my-user/my-image: <4>
27+
auth: "GzhYWRGU6R2fbclabnRgbkSp=""
28+
29+
https://docker.io/my-namespace: <5>
30+
auth: "GzhYWRGU6R2deesfrRgbkSp=""
31+
2432
----
2533
<1> URL of the registry.
2634
<2> Encrypted password.
2735
<3> Email address for the login.
36+
<4> URL and credentials for a specific image in a namespace.
37+
<5> URL and credentials for a registry namespace.
2838

29-
You can define multiple container image registry entries in this file. Alternatively, you can also add authentication entries to this file by running the `docker login` command. The file will be created if it does not exist.
39+
You can define multiple container image registries or define multiple repositories in the same registry. Alternatively, you can also add authentication entries to this file by running the `docker login` command. The file will be created if it does not exist.
3040

3141
Kubernetes provides `Secret` objects, which can be used to store configuration and passwords.
3242

modules/images-allow-pods-to-reference-images-from-secure-registries.adoc

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,45 @@ The `.dockercfg` `$HOME/.docker/config.json` file for Docker clients is a Docker
1010

1111
To pull a secured container image that is not from {product-title}'s internal registry, you must create a pull secret from your Docker credentials and add it to your service account.
1212

13+
The Docker credentials file and the associated pull secret can contain multiple references to the same registry, each with its own set of credentials.
14+
15+
.Example `config.json` file
16+
[source,json]
17+
----
18+
{
19+
"auths":{
20+
"cloud.openshift.com":{
21+
"auth":"b3Blb=",
22+
23+
},
24+
"quay.io":{
25+
"auth":"b3Blb=",
26+
27+
},
28+
"quay.io/repository-main":{
29+
"auth":"b3Blb=",
30+
31+
}
32+
}
33+
}
34+
----
35+
36+
.Example pull secret
37+
[source,yaml]
38+
----
39+
apiVersion: v1
40+
data:
41+
.dockerconfigjson: ewogICAiYXV0aHMiOnsKICAgICAgIm0iOnsKICAgICAgIsKICAgICAgICAgImF1dGgiOiJiM0JsYj0iLAogICAgICAgICAiZW1haWwiOiJ5b3VAZXhhbXBsZS5jb20iCiAgICAgIH0KICAgfQp9Cg==
42+
kind: Secret
43+
metadata:
44+
creationTimestamp: "2021-09-09T19:10:11Z"
45+
name: pull-secret
46+
namespace: default
47+
resourceVersion: "37676"
48+
uid: e2851531-01bc-48ba-878c-de96cfe31020
49+
type: Opaque
50+
----
51+
1352
.Procedure
1453

1554
* If you already have a `.dockercfg` file for the secured registry, you can create a secret from that file by running:

modules/images-update-global-pull-secret.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ $ oc registry login --registry="<registry>" \ <1>
3939
--auth-basic="<username>:<password>" \ <2>
4040
--to=<pull_secret_location> <3>
4141
----
42-
<1> Provide the new registry.
42+
<1> Provide the new registry. You can include multiple repositories within the same registry, for example: `--registry="<registry/my-namespace/my-repository>"`.
4343
<2> Provide the credentials of the new registry.
4444
<3> Provide the path to the pull secret file.
4545
+

modules/olm-accessing-images-private-registries.adoc

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ The file path of your registry credentials can be different depending on the con
4444

4545
.. It is recommended to include credentials for only one registry per secret, and manage credentials for multiple registries in separate secrets. Multiple secrets can be included in a `CatalogSource` object in later steps, and {product-title} will merge the secrets into a single virtual credentials file for use during an image pull.
4646
+
47-
A registry credentials file can, by default, store details for more than one registry. Verify the current contents of your file. For example:
47+
A registry credentials file can, by default, store details for more than one registry or for multiple repositories in one registry. Verify the current contents of your file. For example:
4848
+
49-
.File storing credentials for two registries
49+
.File storing credentials for multiple registries
5050
[source,json]
5151
----
5252
{
@@ -55,7 +55,19 @@ A registry credentials file can, by default, store details for more than one reg
5555
"auth": "FrNHNydQXdzclNqdg=="
5656
},
5757
"quay.io": {
58-
"auth": "Xd2lhdsbnRib21iMQ=="
58+
"auth": "fegdsRib21iMQ=="
59+
}
60+
},
61+
"https://quay.io/my-namespace/my-user/my-image": {
62+
"auth": "eWfjwsDdfsa221=="
63+
}
64+
},
65+
"https://quay.io/my-namespace/my-user": {
66+
"auth": "feFweDdscw34rR=="
67+
}
68+
},
69+
"https://quay.io/my-namespace": {
70+
"auth": "frwEews4fescyq=="
5971
}
6072
}
6173
}

openshift_images/managing_images/using-image-pull-secrets.adoc

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,6 @@ You can obtain the image pull secret, `pullSecret`, from the link:https://consol
1313

1414
You use this pull secret to authenticate with the services that are provided by the included authorities, including link:quay.io[Quay.io] and link:registry.redhat.io[registry.redhat.io], which serve the container images for {product-title} components.
1515

16-
.Example `config.json` file
17-
[source,json]
18-
----
19-
{
20-
"auths":{
21-
"cloud.openshift.com":{
22-
"auth":"b3Blb=",
23-
24-
},
25-
"quay.io":{
26-
"auth":"b3Blb=",
27-
28-
}
29-
}
30-
}
31-
----
32-
3316
include::modules/images-allow-pods-to-reference-images-across-projects.adoc[leveloffset=+1]
3417

3518
include::modules/images-allow-pods-to-reference-images-from-secure-registries.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)