@@ -284,21 +284,7 @@ By packaging kernel module software with a `MachineConfig` object, you can
284
284
deliver that software to worker or master nodes at installation time
285
285
or via the Machine Config Operator.
286
286
287
- First create a base Ignition config that you would like to use.
288
- At installation time, the Ignition config will
289
- contain the ssh public key to add to the `authorized_keys` file for
290
- the `core` user on the cluster.
291
- To add the `MachineConfig` object later via the MCO instead, the SSH public key is not required.
292
- For both type, the example simple-kmod service creates a systemd unit file,
293
- which requires a `
[email protected] `.
294
-
295
- [NOTE]
296
- ====
297
- The systemd unit is a workaround for an
298
- link:https://github.com/coreos/ignition/issues/586[upstream bug]
299
- and makes sure that the `[email protected] ` gets started
300
- on boot:
301
- ====
287
+ .Procedure
302
288
303
289
. Register a RHEL 8 system:
304
290
+
@@ -321,74 +307,13 @@ on boot:
321
307
# yum install podman make git -y
322
308
----
323
309
324
- . Create an Ignition config file that creates a systemd unit file:
325
- .. Create a directory to host the Ignition config file:
310
+ . Create a directory to host the kernel module and tooling:
326
311
+
327
312
[source,terminal]
328
313
----
329
314
$ mkdir kmods; cd kmods
330
315
----
331
316
332
- .. Create the Ignition config file that creates a systemd unit file:
333
- +
334
- [source,terminal]
335
- ----
336
- $ cat <<EOF > ./baseconfig.ign
337
- {
338
- "ignition": { "version": "3.2.0" },
339
- "passwd": {
340
- "users": [
341
- {
342
- "name": "core",
343
- "groups": ["sudo"],
344
- "sshAuthorizedKeys": [
345
- "ssh-rsa AAAA"
346
- ]
347
- }
348
- ]
349
- },
350
- "systemd": {
351
- "units": [{
352
- "name": "require-kvc-simple-kmod.service",
353
- "enabled": true,
354
- "contents": "[Unit]\[email protected] \n[Service]\nType=oneshot\nExecStart=/usr/bin/true\n\n[Install]\nWantedBy=multi-user.target"
355
- }]
356
- }
357
- }
358
- EOF
359
- ----
360
- +
361
- [NOTE]
362
- ====
363
- You must add your public SSH key to the `baseconfig.ign` file
364
- to use the file during `openshift-install`.
365
- The public SSH key is not needed if you create the `MachineConfig` object using the MCO.
366
- ====
367
-
368
- . Create a base MCO YAML snippet that uses the following configuration:
369
- +
370
- [source,terminal]
371
- ----
372
- $ cat <<EOF > mc-base.yaml
373
- apiVersion: machineconfiguration.openshift.io/v1
374
- kind: MachineConfig
375
- metadata:
376
- labels:
377
- machineconfiguration.openshift.io/role: worker
378
- name: 10-kvc-simple-kmod
379
- spec:
380
- config:
381
- EOF
382
- ----
383
- +
384
- [NOTE]
385
- ====
386
- The `mc-base.yaml` is set to deploy the kernel module on `worker` nodes.
387
- To deploy on master nodes, change the role from `worker` to `master`.
388
- To do both, you could repeat the whole procedure using different file names
389
- for the two types of deployments.
390
- ====
391
-
392
317
. Get the `kmods-via-containers` software:
393
318
394
319
.. Clone the `kmods-via-containers` repository:
@@ -405,7 +330,7 @@ $ git clone https://github.com/kmods-via-containers/kmods-via-containers
405
330
$ git clone https://github.com/kmods-via-containers/kvc-simple-kmod
406
331
----
407
332
408
- . Get your module software. In this example, `kvc-simple-kmod` is used:
333
+ . Get your module software. In this example, `kvc-simple-kmod` is used.
409
334
410
335
. Create a fakeroot directory and populate it with files that you want to
411
336
deliver via Ignition, using the repositories cloned earlier:
@@ -445,23 +370,39 @@ $ cd ../kvc-simple-kmod
445
370
$ make install DESTDIR=${FAKEROOT}/usr/local CONFDIR=${FAKEROOT}/etc/
446
371
----
447
372
448
- . Get a tool called `filetranspiler` and dependent software :
373
+ . Clone the fakeroot directory, replacing any symbolic links with copies of their targets, by running the following command :
449
374
+
450
375
[source,terminal]
451
376
----
452
- $ cd .. ; sudo yum install -y python3
453
- git clone https://github.com/ashcrow/filetranspiler.git
377
+ $ cd .. && rm -rf kmod-tree && cp -Lpr ${FAKEROOT} kmod-tree
454
378
----
455
379
456
- . Generate a final machine config YAML (`mc.yaml`)
457
- and have it include the base Ignition config, base machine config, and the fakeroot directory
458
- with files you would like to deliver:
380
+ . Create a Butane config file, `99-simple-kmod.bu`, that embeds the kernel module tree and enables the systemd service:
381
+ +
382
+ [source,yaml]
383
+ ----
384
+ variant: openshift
385
+ version: 4.8.0
386
+ metadata:
387
+ name: 99-simple-kmod
388
+ labels:
389
+ machineconfiguration.openshift.io/role: worker <1>
390
+ storage:
391
+ trees:
392
+ - local: kmod-tree
393
+ systemd:
394
+ units:
395
+
396
+ enabled: true
397
+ ----
398
+ +
399
+ <1> To deploy on master nodes, change `worker` to `master`. To deploy on both master and worker nodes, perform the remainder of these instructions once for each node type.
400
+
401
+ . Use Butane to generate a machine config YAML file, `99-simple-kmod.yaml`, containing the files and configuration to be delivered:
459
402
+
460
403
[source,terminal]
461
404
----
462
- $ ./filetranspiler/filetranspile -i ./baseconfig.ign \
463
- -f ${FAKEROOT} --format=yaml --dereference-symlinks \
464
- | sed 's/^/ /' | (cat mc-base.yaml -) > 99-simple-kmod.yaml
405
+ $ butane 99-simple-kmod.bu --files-dir . -o 99-simple-kmod.yaml
465
406
----
466
407
467
408
. If the cluster is not up yet, generate manifest files and add this file to the
0 commit comments