Skip to content

Commit b8c436f

Browse files
authored
Merge pull request #28152 from mburke5678/node-unqualifiedsearchregistries
Add UnqualifiedSearchRegistries to the Image CR
2 parents 33ae763 + c62f761 commit b8c436f

File tree

8 files changed

+109
-9
lines changed

8 files changed

+109
-9
lines changed

modules/images-configuration-allowed.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ When pulling or pushing images, the container runtime searches the registries li
1212

1313
[WARNING]
1414
====
15-
When the `allowedRegistries` parameter is defined, all registries including the registry.redhat.io and quay.io registries are blocked unless explicitly listed. If you use the parameter, to prevent pod failure, add `registry.redhat.io` and `quay.io` to the `allowedRegistries` list, as they are required by payload images within your environment. For disconnected clusters, mirror registries should also be added.
15+
When the `allowedRegistries` parameter is defined, all registries including the `registry.redhat.io` and `quay.io` registries are blocked unless explicitly listed. If you use the parameter, to prevent pod failure, add `registry.redhat.io` and `quay.io` to the `allowedRegistries` list, as they are required by payload images within your environment. For disconnected clusters, mirror registries should also be added.
1616
====
1717

1818
.Procedure
@@ -56,7 +56,7 @@ status:
5656
Either the `allowedRegistries` parameter or the `blockedRegistries` parameter can be set, but not both.
5757
====
5858
+
59-
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it drains the nodes, applies the change, and uncordons the nodes. Changes to the allowed registries creates or updates the image signature policy in the `/host/etc/containers/policy.json` file on each node.
59+
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it drains the nodes, applies the change, and uncordons the nodes. After the nodes return to the `Ready` state, the allowed registries list is used to update the image signature policy in the `/host/etc/containers/policy.json` file on each node.
6060

6161
. To check that the registries have been added to the policy file, use the following command on a node:
6262
+

modules/images-configuration-blocked.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ status:
4949
Either the `blockedRegistries` registry or the `allowedRegistries` registry can be set, but not both.
5050
====
5151
+
52-
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it drains the nodes, applies the change, and uncordons the nodes. Changes to the blocked registries appear in the `/etc/containers/registries.conf` file on each node.
52+
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it drains the nodes, applies the change, and uncordons the nodes. After the nodes return to the `Ready` state, changes to the blocked registries appear in the `/etc/containers/registries.conf` file on each node.
5353

5454
. To check that the registries have been added to the policy file, use the following command on a node:
5555
+

modules/images-configuration-file.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ spec:
4242
insecure: false
4343
additionalTrustedCA: <3>
4444
name: myconfigmap
45-
registrySources:<4>
45+
registrySources: <4>
4646
allowedRegistries:
4747
- example.com
4848
- quay.io

modules/images-configuration-insecure.adoc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ status:
6060
When the `allowedRegistries` parameter is defined, all registries including the registry.redhat.io and quay.io registries are blocked unless explicitly listed. If you use the parameter, to prevent pod failure, add `registry.redhat.io` and `quay.io` to the `allowedRegistries` list, as they are required by payload images within your environment.
6161
====
6262
+
63-
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` CR for any changes to registries and reboots the nodes when it detects changes. Changes to the insecure and blocked registries appear in the `/etc/containers/registries.conf` file on each node.
63+
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` CR for any changes to the registries, then drains and uncordons the nodes when it detects changes. After the nodes return to the `Ready` state, changes to the insecure and blocked registries appear in the `/etc/containers/registries.conf` file on each node.
6464

6565
. To check that the registries have been added to the policy file, use the following command on a node:
6666
+
@@ -81,4 +81,3 @@ unqualified-search-registries = ["registry.access.redhat.com", "docker.io"]
8181
location = "insecure.com"
8282
insecure = true
8383
----
84-

modules/images-configuration-parameters.adoc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,22 @@ configuration for the internal cluster registry.
5656
`insecureRegistries`: Registries which do not have a valid TLS certificate or
5757
only support HTTP connections.
5858

59-
`blockedRegistries`: Denylisted for image pull and push actions. All other
59+
`blockedRegistries`: Registries for which image pull and push actions are denied. All other
6060
registries are allowed.
6161

62-
`allowedRegistries`: Allowlisted for image pull and push actions. All other
62+
`allowedRegistries`: Registries for which image pull and push actions are allowed. All other
6363
registries are blocked.
6464

65+
`containerRuntimeSearchRegistries`: Registries for which image pull and push actions are allowed
66+
using image short names. All other registries are blocked.
67+
6568
Either `blockedRegistries` or `allowedRegistries` can be set, but not both.
6669

6770
|===
6871

6972
[WARNING]
7073
====
71-
When the `allowedRegistries` parameter is defined, all registries including `registry.redhat.io` and `quay.io` are blocked unless explicitly listed. If using the parameter, declare source registries `registry.redhat.io` and `quay.io` as required by payload images within your environment, to prevent pod failure. For disconnected clusters, mirror registries should also be added.
74+
When the `allowedRegistries` parameter is defined, all registries including `registry.redhat.io` and `quay.io` are blocked unless explicitly listed. When using the parameter, to prevent pod failure, declare the `registry.redhat.io` and `quay.io` registries, as they are required by payload images within your environment. For disconnected clusters, mirror registries should also be added.
7275
====
7376

7477
The `status` field of the `image.config.openshift.io/cluster` resource holds
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * openshift_images/image-configuration.adoc
4+
// * post_installation_configuration/preparing-for-users.adoc
5+
6+
[id="images-configuration-shortname_{context}"]
7+
= Adding registries that allow image short names
8+
9+
You can add registries to search for an image short name by editing the `image.config.openshift.io/cluster` custom resource (CR). {product-title} applies the changes to this CR to all nodes in the cluster.
10+
11+
An image short name enables you to search for images without including the fully qualified domain name in the pull spec. For example, you could use `rhel7/etcd` instead of `registry.access.redhat.com/rhe7/etcd`.
12+
13+
You might use short names in situations where using the full path is not practical. For example, if your cluster references multiple internal registries whose DNS changes frequently, you would need to update the fully qualified domain names in your pull specs with each change. In this case, using an image short name might be beneficial.
14+
15+
When pulling or pushing images, the container runtime searches the registries listed under the `registrySources` parameter in the `image.config.openshift.io/cluster` CR. If you created a list of registries under the `containerRuntimeSearchRegistries` parameter, when pulling an image with a short name, the container runtime searches those registries.
16+
17+
[WARNING]
18+
====
19+
Using image short names with public registries is strongly discouraged. You should use image short names with only internal or private registries.
20+
21+
If you list public registries under the `containerRuntimeSearchRegistries` parameter, you expose your credentials to all the registries on the list and you risk network and registry attacks. You should always use fully-qualified image names with public registries.
22+
====
23+
24+
The Machine Config Operator (MCO) watches the `image.config.openshift.io/cluster` resource for any changes to the registries. When the MCO detects a change, it drains the nodes, applies the change, and uncordons the nodes. After the nodes return to the `Ready` state, if the `containerRuntimeSearchRegistries` parameter is added, the MCO creates a file in the `/etc/containers/registries.conf.d` directory on each node with the listed registries. The file overrides the default list of unqualified search registries in the `/host/etc/containers/registries.conf` file. There is no way to fall back to the default list of unqualified search registries.
25+
26+
The `containerRuntimeSearchRegistries` parameter works only with the Podman and CRI-O container engines. The registries in the list can be used only in pod specs, not in builds and image streams.
27+
28+
.Procedure
29+
30+
. Edit the `image.config.openshift.io/cluster` custom resource:
31+
+
32+
[source,terminal]
33+
----
34+
$ oc edit image.config.openshift.io/cluster
35+
----
36+
+
37+
The following is an example `image.config.openshift.io/cluster` CR:
38+
+
39+
[source,yaml]
40+
----
41+
apiVersion: config.openshift.io/v1
42+
kind: Image
43+
metadata:
44+
annotations:
45+
release.openshift.io/create-only: "true"
46+
creationTimestamp: "2019-05-17T13:44:26Z"
47+
generation: 1
48+
name: cluster
49+
resourceVersion: "8302"
50+
selfLink: /apis/config.openshift.io/v1/images/cluster
51+
uid: e34555da-78a9-11e9-b92b-06d6c7da38dc
52+
spec:
53+
allowedRegistriesForImport:
54+
- domainName: quay.io
55+
insecure: false
56+
additionalTrustedCA:
57+
name: myconfigmap
58+
registrySources:
59+
containerRuntimeSearchRegistries: <1>
60+
- "reg1.io"
61+
- "reg2.io"
62+
- "reg3.io"
63+
allowedRegistries: <2>
64+
- example.com
65+
- quay.io
66+
- registry.redhat.io
67+
- "reg1.io"
68+
- "reg2.io"
69+
- "reg3.io"
70+
...
71+
status:
72+
internalRegistryHostname: image-registry.openshift-image-registry.svc:5000
73+
----
74+
<1> Specify registries to use with image short names. You should use image short names with only internal or private registries to reduce possible security risks.
75+
<2> Ensure that any registries listed under `containerRuntimeSearchRegistries` are included in the `allowedRegistries` list.
76+
+
77+
[NOTE]
78+
====
79+
When the `allowedRegistries` parameter is defined, all registries including the `registry.redhat.io` and `quay.io` registries are blocked unless explicitly listed. If you use this parameter, to prevent pod failure, add `registry.redhat.io` and `quay.io` to the `allowedRegistries` list, as they are required by payload images within your environment.
80+
====
81+
82+
. To check that the registries have been added, use the following command on a node:
83+
+
84+
[source,terminal]
85+
----
86+
$ cat /host/etc/containers/registries.conf.d/01-image-searchRegistries.conf
87+
----
88+
+
89+
.Example output
90+
[source,terminal]
91+
----
92+
unqualified-search-registries = ['reg1.io', 'reg2.io', 'reg3.io']
93+
----
94+

openshift_images/image-configuration.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ include::modules/images-configuration-blocked.adoc[leveloffset=+2]
1616

1717
include::modules/images-configuration-insecure.adoc[leveloffset=+2]
1818

19+
include::modules/images-configuration-shortname.adoc[leveloffset=+2]
20+
1921
include::modules/images-configuration-cas.adoc[leveloffset=+2]
2022

2123
include::modules/images-configuration-registry-mirror.adoc[leveloffset=+2]

post_installation_configuration/preparing-for-users.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ include::modules/images-configuration-cas.adoc[leveloffset=+3]
128128

129129
include::modules/images-configuration-insecure.adoc[leveloffset=+3]
130130

131+
include::modules/images-configuration-shortname.adoc[leveloffset=+3]
132+
131133
include::modules/images-configuration-registry-mirror.adoc[leveloffset=+3]
132134

133135
include::modules/olm-installing-operators-from-operatorhub.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)