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