Skip to content

Commit 214361a

Browse files
authored
Merge pull request #81214 from slovern/OCPBUGS-30568-I
OCPBUGS-30568 Inheritance for Machine Config Pools
2 parents b28d1c4 + 09619bb commit 214361a

File tree

2 files changed

+247
-0
lines changed

2 files changed

+247
-0
lines changed
Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * updating/updating_a_cluster/update-using-custom-machine-config-pools.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="update-using-custom-machine-config-pools-mcp-inheritance_{context}"]
7+
= Managing machine configuration inheritance for a worker pool canary
8+
9+
10+
You can configure a machine config pool (MCP) canary to inherit any `MachineConfig` assigned to an existing MCP.
11+
This configuration is useful when you want to use an MCP canary to test as you update nodes one at a time for an existing MCP.
12+
13+
.Prerequisites
14+
15+
* You have created one or more MCPs.
16+
17+
.Procedure
18+
19+
. Create a secondary MCP as described in the following two steps:
20+
+
21+
.. Save the following configuration file as `machineConfigPool.yaml`.
22+
+
23+
.Example `machineConfigPool` YAML
24+
[source,yaml]
25+
----
26+
apiVersion: machineconfiguration.openshift.io/v1
27+
kind: MachineConfigPool
28+
metadata:
29+
name: worker-perf
30+
spec:
31+
machineConfigSelector:
32+
matchExpressions:
33+
- {
34+
key: machineconfiguration.openshift.io/role,
35+
operator: In,
36+
values: [worker,worker-perf]
37+
}
38+
nodeSelector:
39+
matchLabels:
40+
node-role.kubernetes.io/worker-perf: ""
41+
# ...
42+
----
43+
+
44+
.. Create the new machine config pool by running the following command:
45+
+
46+
[source,terminal]
47+
----
48+
$ oc create -f machineConfigPool.yaml
49+
----
50+
+
51+
.Example output
52+
+
53+
[source,terminal]
54+
----
55+
machineconfigpool.machineconfiguration.openshift.io/worker-perf created
56+
----
57+
58+
. Add some machines to the secondary MCP. The following example labels the worker nodes `worker-a`, `worker-b`, and `worker-c` to the MCP `worker-perf`:
59+
+
60+
[source,terminal]
61+
----
62+
$ oc label node worker-a node-role.kubernetes.io/worker-perf=''
63+
----
64+
+
65+
[source,terminal]
66+
----
67+
$ oc label node worker-b node-role.kubernetes.io/worker-perf=''
68+
----
69+
+
70+
[source,terminal]
71+
----
72+
$ oc label node worker-c node-role.kubernetes.io/worker-perf=''
73+
----
74+
75+
. Create a new `MachineConfig` for the MCP `worker-perf` as described in the following two steps:
76+
+
77+
.. Save the following `MachineConfig` example as a file called `new-machineconfig.yaml`:
78+
+
79+
.Example `MachineConfig` YAML
80+
[source,yaml]
81+
----
82+
apiVersion: machineconfiguration.openshift.io/v1
83+
kind: MachineConfig
84+
metadata:
85+
labels:
86+
machineconfiguration.openshift.io/role: worker-perf
87+
name: 06-kdump-enable-worker-perf
88+
spec:
89+
config:
90+
ignition:
91+
version: 3.2.0
92+
systemd:
93+
units:
94+
- enabled: true
95+
name: kdump.service
96+
kernelArguments:
97+
- crashkernel=512M
98+
# ...
99+
----
100+
+
101+
.. Apply the `MachineConfig` by running the following command:
102+
+
103+
[source,terminal]
104+
----
105+
$ oc create -f new-machineconfig.yaml
106+
----
107+
108+
. Create the new canary MCP and add machines from the MCP you created in the previous steps. The following example creates an MCP called `worker-perf-canary`, and adds machines from the `worker-perf` MCP that you previosuly created.
109+
+
110+
.. Label the canary worker node `worker-a` by running the following command:
111+
+
112+
[source,terminal]
113+
----
114+
$ oc label node worker-a node-role.kubernetes.io/worker-perf-canary=''
115+
----
116+
+
117+
.. Remove the canary worker node `worker-a` from the original MCP by running the following command:
118+
+
119+
[source,terminal]
120+
----
121+
$ oc label node worker-a node-role.kubernetes.io/worker-perf-
122+
----
123+
+
124+
.. Save the following file as `machineConfigPool-Canary.yaml`.
125+
+
126+
.Example `machineConfigPool-Canary.yaml` file
127+
[source,yaml]
128+
----
129+
apiVersion: machineconfiguration.openshift.io/v1
130+
kind: MachineConfigPool
131+
metadata:
132+
name: worker-perf-canary
133+
spec:
134+
machineConfigSelector:
135+
matchExpressions:
136+
- {
137+
key: machineconfiguration.openshift.io/role,
138+
operator: In,
139+
values: [worker,worker-perf,worker-perf-canary] <1>
140+
}
141+
nodeSelector:
142+
matchLabels:
143+
node-role.kubernetes.io/worker-perf-canary: ""
144+
----
145+
<1> Optional value. This example includes `worker-perf-canary` as an additional value. You can use a value in this way to configure members of an additional `MachineConfig`.
146+
+
147+
.. Create the new `worker-perf-canary` by running the following command:
148+
+
149+
[source,terminal]
150+
----
151+
$ oc create -f machineConfigPool-Canary.yaml
152+
----
153+
+
154+
.Example output
155+
[source,terminal]
156+
----
157+
machineconfigpool.machineconfiguration.openshift.io/worker-perf-canary created
158+
----
159+
160+
. Check if the `MachineConfig` is inherited in `worker-perf-canary`.
161+
+
162+
.. Verify that no MCP is degraded by running the following command:
163+
+
164+
[source,terminal]
165+
----
166+
$ oc get mcp
167+
----
168+
+
169+
.Example output
170+
[source,terminal]
171+
----
172+
NAME CONFIG UPDATED UPDATING DEGRADED MACHINECOUNT READYMACHINECOUNT UPDATEDMACHINECOUNT DEGRADEDMACHINECOUNT AGE
173+
master rendered-master-2bf1379b39e22bae858ea1a3ff54b2ac True False False 3 3 3 0 5d16h
174+
worker rendered-worker-b9576d51e030413cfab12eb5b9841f34 True False False 0 0 0 0 5d16h
175+
worker-perf rendered-worker-perf-b98a1f62485fa702c4329d17d9364f6a True False False 2 2 2 0 56m
176+
worker-perf-canary rendered-worker-perf-canary-b98a1f62485fa702c4329d17d9364f6a True False False 1 1 1 0 44m
177+
----
178+
+
179+
.. Verify that the machines are inherited from `worker-perf` into `worker-perf-canary`.
180+
+
181+
[source,terminal]
182+
----
183+
$ oc get nodes
184+
----
185+
+
186+
.Example output
187+
[source,terminal]
188+
----
189+
NAME STATUS ROLES AGE VERSION
190+
...
191+
worker-a Ready worker,worker-perf-canary 5d15h v1.27.13+e709aa5
192+
worker-b Ready worker,worker-perf 5d15h v1.27.13+e709aa5
193+
worker-c Ready worker,worker-perf 5d15h v1.27.13+e709aa5
194+
----
195+
+
196+
.. Verify that `kdump` service is enabled on `worker-a` by running the following command:
197+
+
198+
[source,terminal]
199+
----
200+
$ systemctl status kdump.service
201+
----
202+
+
203+
.Example output
204+
[source,terminal]
205+
----
206+
NAME STATUS ROLES AGE VERSION
207+
...
208+
kdump.service - Crash recovery kernel arming
209+
Loaded: loaded (/usr/lib/systemd/system/kdump.service; enabled; preset: disabled)
210+
Active: active (exited) since Tue 2024-09-03 12:44:43 UTC; 10s ago
211+
Process: 4151139 ExecStart=/usr/bin/kdumpctl start (code=exited, status=0/SUCCESS)
212+
Main PID: 4151139 (code=exited, status=0/SUCCESS)
213+
----
214+
+
215+
.. Verify that the MCP has updated the `crashkernel` by running the following command:
216+
+
217+
[source,terminal]
218+
----
219+
$ cat /proc/cmdline
220+
----
221+
+
222+
The output should include the updated `crashekernel` value, for example:
223+
+
224+
.Example output
225+
[source,terminal]
226+
----
227+
crashkernel=512M
228+
----
229+
230+
. Optional: If you are satisfied with the upgrade, you can return `worker-a` to `worker-perf`.
231+
+
232+
.. Return `worker-a` to `worker-perf` by running the following command:
233+
+
234+
[source,terminal]
235+
----
236+
$ oc label node worker-a node-role.kubernetes.io/worker-perf=''
237+
----
238+
+
239+
.. Remove `worker-a` from the canary MCP by running the following command:
240+
+
241+
[source,terminal]
242+
----
243+
$ oc label node worker-a node-role.kubernetes.io/worker-perf-canary-
244+
----

updating/updating_a_cluster/update-using-custom-machine-config-pools.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ include::modules/update-using-custom-machine-config-pools-about.adoc[leveloffset
135135
// Creating machine config pools to perform a canary rollout update
136136
include::modules/update-using-custom-machine-config-pools-mcp.adoc[leveloffset=+1]
137137

138+
// Managing machine configuration inheritance for a worker pool canary
139+
include::modules/update-using-custom-machine-config-pools-inheritance.adoc[leveloffset=+1]
140+
138141
// Pausing the machine config pools
139142
include::modules/update-using-custom-machine-config-pools-pause.adoc[leveloffset=+1]
140143

0 commit comments

Comments
 (0)