Skip to content

Commit ee0b7d9

Browse files
committed
nw-cluster-mtu-change: generate MachineConfigs with Butane
In recent OpenShift versions, we generally recommend Butane for preprocessing configs, rather than manually base64-encoding files and inserting them inline. Since the procedure involves extracting and modifying a file, use Butane's local file inclusion rather than inlining the file into the Butane config.
1 parent df5986d commit ee0b7d9

File tree

1 file changed

+33
-67
lines changed

1 file changed

+33
-67
lines changed

modules/nw-cluster-mtu-change.adoc

Lines changed: 33 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -212,90 +212,56 @@ interface-name=enp1s0
212212
mtu=8051
213213
----
214214

215-
... To base64 encode the NetworkManager configuration for inclusion in a `MachineConfig` object, enter the following command:
216-
+
217-
[source,terminal]
218-
----
219-
$ cat config.nmconnection | base64 -w0
220-
----
221-
222215
... Create two `MachineConfig` objects, one for the control plane nodes and another for the worker nodes in your cluster:
223216

224-
.... Create the following `MachineConfig` object in the `machine-config-control-plane.yaml` file:
217+
.... Create the following Butane config in the `control-plane-interface.bu` file:
225218
+
226219
[source,yaml]
227220
----
228-
apiVersion: machineconfiguration.openshift.io/v1
229-
kind: MachineConfig
221+
variant: openshift
222+
version: 4.11.0
230223
metadata:
224+
name: 01-control-plane-interface
231225
labels:
232226
machineconfiguration.openshift.io/role: master
233-
name: 01-control-plane-interface
234-
spec:
235-
config:
236-
ignition:
237-
config: {}
238-
security:
239-
tls: {}
240-
timeouts: {}
241-
version: 2.2.0
242-
networkd: {}
243-
passwd: {}
244-
storage:
245-
files:
246-
- contents:
247-
source: data:text/plain;charset=utf-8;base64,<encoded_config>
248-
verification: {}
249-
filesystem: root
250-
mode: 420
251-
path: /etc/NetworkManager/system-connections/<connection_name>
252-
systemd: {}
227+
storage:
228+
files:
229+
- path: /etc/NetworkManager/system-connections/<connection_name> <1>
230+
contents:
231+
local: config.nmconnection <2>
232+
mode: 0644
253233
----
254-
+
255-
--
256-
where:
257-
258-
`<encoded_config>`:: Specifies the base64 encoding for the updated NetworkManager configuration.
259-
`<connection_name>`:: Specifies the NetworkManager connection name for the primary network interface.
260-
--
234+
<1> Specify the NetworkManager connection name for the primary network interface.
235+
<2> Specify the local filename for the updated NetworkManager configuration file from the previous step.
261236

262-
.... Create the following MachineConfig object in the `machine-config-worker.yaml` file:
237+
.... Create the following Butane config in the `worker-interface.bu` file:
263238
+
264239
[source,yaml]
265240
----
266-
apiVersion: machineconfiguration.openshift.io/v1
267-
kind: MachineConfig
241+
variant: openshift
242+
version: 4.11.0
268243
metadata:
244+
name: 01-worker-interface
269245
labels:
270246
machineconfiguration.openshift.io/role: worker
271-
name: 01-worker-interface
272-
spec:
273-
config:
274-
ignition:
275-
config: {}
276-
security:
277-
tls: {}
278-
timeouts: {}
279-
version: 2.2.0
280-
networkd: {}
281-
passwd: {}
282-
storage:
283-
files:
284-
- contents:
285-
source: data:text/plain;charset=utf-8;base64,<encoded_config>
286-
verification: {}
287-
filesystem: root
288-
mode: 420
289-
path: /etc/NetworkManager/system-connections/<connection_name>
290-
systemd: {}
247+
storage:
248+
files:
249+
- path: /etc/NetworkManager/system-connections/<connection_name> <1>
250+
contents:
251+
local: config.nmconnection <2>
252+
mode: 0644
291253
----
292-
+
293-
--
294-
where:
254+
<1> Specify the NetworkManager connection name for the primary network interface.
255+
<2> Specify the local filename for the updated NetworkManager configuration file from the previous step.
295256

296-
`<encoded_config>`:: Specifies the base64 encoding for the updated NetworkManager configuration.
297-
`<connection_name>`:: Specifies the NetworkManager connection name for the primary network interface.
298-
--
257+
.... Create `MachineConfig` objects from the Butane configs by running the following command:
258+
+
259+
[source,terminal]
260+
----
261+
$ for manifest in control-plane-interface worker-interface; do
262+
butane --files-dir . $manifest.bu > $manifest.yaml
263+
done
264+
----
299265

300266
. To begin the MTU migration, specify the migration configuration by entering the following command. The Machine Config Operator performs a rolling reboot of the nodes in the cluster in preparation for the MTU change.
301267
+
@@ -382,7 +348,7 @@ ExecStart=/usr/local/bin/mtu-migration.sh
382348
+
383349
[source,terminal]
384350
----
385-
$ for manifest in machine-config-control-plane machine-config-worker; do
351+
$ for manifest in control-plane-interface worker-interface; do
386352
oc create -f $manifest.yaml
387353
done
388354
----

0 commit comments

Comments
 (0)