Skip to content

Commit bf456e3

Browse files
committed
OSDOCS-16880-2: CQAIMG-2: image config and adv features
1 parent 99878ec commit bf456e3

14 files changed

+212
-152
lines changed

modules/images-configuration-allowed.adoc

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@
55

66
:_mod-docs-content-type: PROCEDURE
77
[id="images-configuration-allowed_{context}"]
8-
= Adding specific registries
8+
= Adding specific registries to an allowlist
99

10-
You can add a list of registries, and optionally an individual repository within a registry, that are permitted for image pull and push actions 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+
[role="_abstract"]
11+
You can add an allowlist of registries, or an individual repository, within a registry for image pull and push actions by editing the `image.config.openshift.io/cluster` custom resource (CR).
1112

12-
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 `allowedRegistries` parameter, the container runtime searches only those registries. Registries not in the list are blocked.
13+
{product-title} applies the changes to this CR to all nodes in the cluster.
1314

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 `allowedRegistries` parameter, the container runtime searches only those registries. Registries not in your allowlist are blocked.
16+
//false positive vale example block
1417
[WARNING]
1518
====
16-
When the `allowedRegistries` parameter is defined, all registries, including the `registry.redhat.io` and `quay.io` registries and the default {product-registry}, are blocked unless explicitly listed. If you use the parameter, to prevent pod failure, add the `registry.redhat.io` and `quay.io` registries and the `internalRegistryHostname` to the `allowedRegistries` list, as they are required by payload images within your environment. For disconnected clusters, mirror registries should also be added.
19+
When the `allowedRegistries` parameter is defined, all registries, including the `registry.redhat.io` and `quay.io` registries and the default {product-registry}, are blocked unless explicitly listed. To prevent pod failure when you use the parameter, add both the `registry.redhat.io` and `quay.io` registries and the `internalRegistryHostname` to the `allowedRegistries` list. Payload images within your environment require access to these registries. For disconnected clusters, you must also add mirror registries to the allowlist.
1720
====
1821

1922
.Procedure
2023

21-
* Edit the `image.config.openshift.io/cluster` custom resource:
24+
* Edit the `image.config.openshift.io/cluster` custom resource by running the following command:
2225
+
2326
[source,terminal]
2427
----
@@ -41,8 +44,8 @@ metadata:
4144
selfLink: /apis/config.openshift.io/v1/images/cluster
4245
uid: e34555da-78a9-11e9-b92b-06d6c7da38dc
4346
spec:
44-
registrySources: <1>
45-
allowedRegistries: <2>
47+
registrySources:
48+
allowedRegistries:
4649
- example.com
4750
- quay.io
4851
- registry.redhat.io
@@ -51,8 +54,10 @@ spec:
5154
status:
5255
internalRegistryHostname: image-registry.openshift-image-registry.svc:5000
5356
----
54-
<1> Contains configurations that determine how the container runtime should treat individual registries when accessing images for builds and pods. It does not contain configuration for the internal cluster registry.
55-
<2> Specify registries, and optionally a repository in that registry, to use for image pull and push actions. All other registries are blocked.
57+
+
58+
where::
59+
`registrySources:` Contains configurations that determine how the container runtime should treat individual registries when accessing images for builds and pods. It does not contain configuration for the internal cluster registry.
60+
`registrySources.allowedRegistries:` Specify registries, and optionally a repository in that registry, to use for image pull and push actions. All other registries are blocked.
5661
+
5762
[NOTE]
5863
====
@@ -62,9 +67,7 @@ Either the `allowedRegistries` parameter or the `blockedRegistries` parameter ca
6267
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 triggers a rollout on nodes in machine config pool (MCP). The allowed registries list is used to update the image signature policy in the `/etc/containers/policy.json` file on each node. Changes to the `/etc/containers/policy.json` file do not require the node to drain.
6368
6469
ifndef::openshift-rosa,openshift-dedicated[]
65-
.Verification
66-
67-
* Enter the following command to obtain a list of your nodes:
70+
. After you have made your configuration updates, list your nodes by running the following command:
6871
+
6972
[source,terminal]
7073
----
@@ -79,12 +82,14 @@ NAME STATUS ROLES AGE VERSION
7982
<node_name> Ready control-plane,master 37m v1.27.8+4fab27b
8083
----
8184

82-
. Run the following command to enter debug mode on the node:
85+
. Enter debug mode on the node by running the following command:
8386
+
84-
[source,terminal]
87+
[source,terminal,subs="+quotes"]
8588
----
86-
$ oc debug node/<node_name>
89+
$ oc debug node/_<node_name>_
8790
----
91+
+
92+
Replace _<node-name>_ with the name of your node.
8893

8994
. When prompted, enter `chroot /host` into the terminal:
9095
+
@@ -93,14 +98,16 @@ $ oc debug node/<node_name>
9398
sh-4.4# chroot /host
9499
----
95100

96-
. Enter the following command to check that the registries have been added to the policy file:
101+
.Verification
102+
103+
. Check that the registries are added to the policy file by running the following command:
97104
+
98105
[source,terminal]
99106
----
100107
sh-5.1# cat /etc/containers/policy.json | jq '.'
101108
----
102109
+
103-
The following policy indicates that only images from the example.com, quay.io, and registry.redhat.io registries are permitted for image pulls and pushes:
110+
The following policy indicates that only images from the `example.com`, `quay.io`, and `registry.redhat.io` registries are accessible for image pulls and pushes:
104111
+
105112
.Example image signature policy file
106113
[%collapsible]

modules/images-configuration-blocked-payload.adoc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
// * openshift_images/image-configuration.adoc
44

55
:_mod-docs-content-type: PROCEDURE
6-
[id="images-configuration-blocked-payload"]
7-
6+
[id="images-configuration-blocked-payload_{context}"]
87
= Blocking a payload registry
98

10-
In a mirroring configuration, you can block upstream payload registries in a disconnected environment using a `ImageContentSourcePolicy` (ICSP) object. The following example procedure demonstrates how to block the `quay.io/openshift-payload` payload registry.
9+
[role="_abstract"]
10+
In a mirroring configuration, you can block upstream payload registries in a disconnected environment by using a `ImageContentSourcePolicy` (ICSP) object.
11+
//oc mirror v2 does not support ICSP; this content needs an update or a note
12+
The following example procedure demonstrates how to block the `quay.io/openshift-payload` payload registry.
1113

1214
.Procedure
15+
1316
. Create the mirror configuration using an `ImageContentSourcePolicy` (ICSP) object to mirror the payload to a registry in your instance. The following example ICSP file mirrors the payload `internal-mirror.io/openshift-payload`:
1417
+
1518
[source,yaml]
@@ -24,7 +27,8 @@ spec:
2427
- internal-mirror.io/openshift-payload
2528
source: quay.io/openshift-payload
2629
----
27-
. After the object deploys onto your nodes, verify that the mirror configuration is set by checking the `/etc/containers/registries.conf` file:
30+
31+
. After the object deploys onto your nodes, verify that the mirror configuration is set by checking the `/etc/containers/registries.conf` custom resource (CR):
2832
+
2933
.Example output
3034
[source,terminal]
@@ -37,13 +41,15 @@ spec:
3741
[[registry.mirror]]
3842
location = "internal-mirror.io/openshift-payload"
3943
----
40-
. Use the following command to edit the `image.config.openshift.io` custom resource file:
44+
45+
. Use the following command to edit the `image.config.openshift.io` CR:
4146
+
4247
[source,terminal]
4348
----
4449
$ oc edit image.config.openshift.io cluster
4550
----
46-
. To block the payload registry, add the following configuration to the `image.config.openshift.io` custom resource file:
51+
52+
. To block the payload registry, add the following configuration to the `image.config.openshift.io` CR:
4753
+
4854
[source,yaml]
4955
----
@@ -54,9 +60,10 @@ spec:
5460
----
5561
5662
.Verification
63+
//can we run a command such as an oc debug or oc edit to look at this file?
5764
* Verify that the upstream payload registry is blocked by checking the `/etc/containers/registries.conf` file on the node.
5865
+
59-
.Example output
66+
.Example `/etc/containers/registries.conf` file
6067
[source,terminal]
6168
----
6269
[[registry]]

modules/images-configuration-blocked.adoc

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
[id="images-configuration-blocked_{context}"]
88
= Blocking specific registries
99

10-
You can block any registry, and optionally an individual repository within a registry, 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+
[role="_abstract"]
11+
You can block any registry, or an individual repository, within a registry by editing the `image.config.openshift.io/cluster` custom resource (CR).
12+
13+
{product-title} applies the changes to this CR to all nodes in the cluster.
1114

1215
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 `blockedRegistries` parameter, the container runtime does not search those registries. All other registries are allowed.
1316

1417
[WARNING]
1518
====
16-
To prevent pod failure, do not add the `registry.redhat.io` and `quay.io` registries to the `blockedRegistries` list, as they are required by payload images within your environment.
19+
To prevent pod failure, do not add the `registry.redhat.io` and `quay.io` registries to the `blockedRegistries` list. Payload images within your environment require access to these registries.
1720
====
18-
21+
//how does this work for mirror registries?
1922
.Procedure
2023

21-
* Edit the `image.config.openshift.io/cluster` custom resource:
24+
* Edit the `image.config.openshift.io/cluster` custom resource by running the following command:
2225
+
2326
[source,terminal]
2427
----
@@ -41,27 +44,27 @@ metadata:
4144
selfLink: /apis/config.openshift.io/v1/images/cluster
4245
uid: e34555da-78a9-11e9-b92b-06d6c7da38dc
4346
spec:
44-
registrySources: <1>
45-
blockedRegistries: <2>
47+
registrySources:
48+
blockedRegistries:
4649
- untrusted.com
4750
- reg1.io/myrepo/myapp:latest
4851
status:
4952
internalRegistryHostname: image-registry.openshift-image-registry.svc:5000
5053
----
51-
<1> Contains configurations that determine how the container runtime should treat individual registries when accessing images for builds and pods. It does not contain configuration for the internal cluster registry.
52-
<2> Specify registries, and optionally a repository in that registry, that should not be used for image pull and push actions. All other registries are allowed.
54+
+
55+
where::
56+
`registrySources:` Contains configurations that determine how the container runtime should treat individual registries when accessing images for builds and pods. It does not contain configuration for the internal cluster registry.
57+
`registrySources.blockedRegistries:` Specify registries, and optionally a repository in that registry, that should not be used for image pull and push actions. All other registries are allowed.
5358
+
5459
[NOTE]
5560
====
56-
Either the `blockedRegistries` registry or the `allowedRegistries` registry can be set, but not both.
61+
You cannot set both the `blockedRegistries` and `allowedRegistries` parameters. You must choose one or the other.
5762
====
5863
+
5964
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. During this period, you might experience service unavailability.
6065
6166
ifndef::openshift-rosa,openshift-dedicated[]
62-
.Verification
63-
64-
* Enter the following command to obtain a list of your nodes:
67+
. Get a list of your nodes by running the following command:
6568
+
6669
[source,terminal]
6770
----
@@ -78,10 +81,12 @@ NAME STATUS ROLES AGE VERSION
7881

7982
. Run the following command to enter debug mode on the node:
8083
+
81-
[source,terminal]
84+
[source,terminal,subs="quotes+"]
8285
----
83-
$ oc debug node/<node_name>
86+
$ oc debug node/_<node_name>_
8487
----
88+
+
89+
Replace _<node_name>_ with the name of the node you want details about.
8590

8691
. When prompted, enter `chroot /host` into the terminal:
8792
+
@@ -90,7 +95,9 @@ $ oc debug node/<node_name>
9095
sh-4.4# chroot /host
9196
----
9297

93-
. Enter the following command to check that the registries have been added to the policy file:
98+
.Verification
99+
100+
. Verify that the registries are added to the policy file by running the following command:
94101
+
95102
[source,terminal]
96103
----

modules/images-configuration-cas.adoc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
[id="images-configuration-cas_{context}"]
88
= Configuring additional trust stores for image registry access
99

10-
The `image.config.openshift.io/cluster` custom resource can contain a reference to a config map that contains additional certificate authorities to be trusted during image registry access.
10+
[role="_abstract"]
11+
You can add references to a config map that has additional certificate authorities (CAs) to be trusted during image registry access to the `image.config.openshift.io/cluster` custom resource (CR).
1112

1213
.Prerequisites
13-
* The certificate authorities (CA) must be PEM-encoded.
1414

15-
.Procedure
16-
17-
You can create a config map in the `openshift-config` namespace and use its name in `AdditionalTrustedCA` in the `image.config.openshift.io` custom resource to provide additional CAs that should be trusted when contacting external registries.
15+
* The certificate authorities (CAs) must be PEM-encoded.
1816
19-
The config map key is the hostname of a registry with the port for which this CA is to be trusted, and the PEM certificate content is the value, for each additional registry CA to trust.
17+
.Procedure
2018

19+
. Create a config map in the `openshift-config` namespace, then and use the config mao name in the `AdditionalTrustedCA` parameter of the `image.config.openshift.io` CR. This adds CAs that should be trusted when the cluster contacts external image registries.
20+
+
2121
.Image registry CA config map example
2222
[source,yaml]
2323
----
@@ -30,16 +30,18 @@ data:
3030
-----BEGIN CERTIFICATE-----
3131
...
3232
-----END CERTIFICATE-----
33-
registry-with-port.example.com..5000: | <1>
33+
registry-with-port.example.com..5000: |
3434
-----BEGIN CERTIFICATE-----
3535
...
3636
-----END CERTIFICATE-----
3737
----
38-
<1> If the registry has the port, such as `registry-with-port.example.com:5000`, `:` should be replaced with `..`.
39-
40-
You can configure additional CAs with the following procedure.
38+
+
39+
where::
40+
`data:registry.example.com:` An example hostname of a registry for which this CA is to be trusted.
41+
`data:registry-with-port.example.com..5000:` An example hostname of a registry with the port for which this CA is to be trusted. If the registry has a port, such as `registry-with-port.example.com:5000`, `:` should be replaced with `..`.
42+
The PEM certificate content is the value for each additional registry CA to trust.
4143
42-
* To configure an additional CA:
44+
. Optional. Configure an additional CA by running the following command:
4345
+
4446
[source,terminal]
4547
----

0 commit comments

Comments
 (0)