Skip to content

Commit 111be88

Browse files
authored
Merge pull request #41903 from xenolinux/remediation
[BZ2047742]: Apply label to MCP
2 parents 20e92a8 + 2bd2739 commit 111be88

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
:_content-type: PROCEDURE
2+
[id="complianc-operator-apply-remediation-for-customized-mcp"]
3+
= Applying remediation when using customized machine config pools
4+
5+
When you create a custom `MachineConfigPool`, add a label to the `MachineConfigPool` so that `machineConfigPoolSelector` present in the `KubeletConfig` can match the label with `MachineConfigPool`.
6+
7+
.Procedure
8+
9+
. List the nodes.
10+
+
11+
[source,terminal]
12+
----
13+
$ oc get nodes
14+
----
15+
+
16+
.Example output
17+
+
18+
[source,terminal]
19+
----
20+
NAME STATUS ROLES AGE VERSION
21+
ip-10-0-128-92.us-east-2.compute.internal Ready master 5h21m v1.23.3+d99c04f
22+
ip-10-0-158-32.us-east-2.compute.internal Ready worker 5h17m v1.23.3+d99c04f
23+
ip-10-0-166-81.us-east-2.compute.internal Ready worker 5h17m v1.23.3+d99c04f
24+
ip-10-0-171-170.us-east-2.compute.internal Ready master 5h21m v1.23.3+d99c04f
25+
ip-10-0-197-35.us-east-2.compute.internal Ready master 5h22m v1.23.3+d99c04f
26+
----
27+
28+
. Add a label to nodes.
29+
+
30+
[source,terminal]
31+
----
32+
$ oc label node ip-10-0-166-81.us-east-2.compute.internal node-role.kubernetes.io/<machine_config_pool_name>=
33+
----
34+
+
35+
.Example output
36+
+
37+
[source,terminal]
38+
----
39+
node/ip-10-0-166-81.us-east-2.compute.internal labeled
40+
----
41+
42+
. Create custom `MachineConfigPool` CR.
43+
+
44+
[source,yaml]
45+
----
46+
apiVersion: machineconfiguration.openshift.io/v1
47+
kind: MachineConfigPool
48+
metadata:
49+
name: <machine_config_pool_name>
50+
labels:
51+
pools.operator.machineconfiguration.openshift.io/<machine_config_pool_name>: '' <1>
52+
spec:
53+
machineConfigSelector:
54+
matchExpressions:
55+
- {key: machineconfiguration.openshift.io/role, operator: In, values: [worker,<machine_config_pool_name>]}
56+
nodeSelector:
57+
matchLabels:
58+
node-role.kubernetes.io/<machine_config_pool_name>: ""
59+
----
60+
<1> The `labels` field defines label name to add for Machine config pool(MCP).
61+
62+
. Verify MCP created successfully.
63+
+
64+
[source,terminal]
65+
----
66+
$ oc get mcp -w
67+
----

security/compliance_operator/compliance-operator-remediation.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Each `ComplianceCheckResult` represents a result of one compliance rule check. I
1010

1111
include::modules/compliance-review.adoc[leveloffset=+1]
1212

13+
include::modules/compliance-apply-remediation-for-customized-mcp.adoc[leveloffset=+1]
14+
1315
include::modules/compliance-applying.adoc[leveloffset=+1]
1416

1517
include::modules/compliance-manual.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)