Skip to content

Commit bf2157b

Browse files
committed
GRPA-3100: Convert kmod instructions from filetranspiler to Butane
The current RHCOS systemd can now enable instantiated services via Ignition. The embedded SSH key was apparently inherited from the instructions in https://github.com/kmods-via-containers/kmods-via-containers#testing-it-out-on-an-ostree-based-host-provisioned-via-ignition and shouldn't be needed on OCP. Drop it.
1 parent 45e0a38 commit bf2157b

File tree

1 file changed

+28
-87
lines changed

1 file changed

+28
-87
lines changed

modules/installation-special-config-kmod.adoc

Lines changed: 28 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -292,21 +292,7 @@ By packaging kernel module software with a `MachineConfig` object, you can
292292
deliver that software to worker or master nodes at installation time
293293
or via the Machine Config Operator.
294294

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
310296

311297
. Register a RHEL 8 system:
312298
+
@@ -329,74 +315,13 @@ on boot:
329315
# yum install podman make git -y
330316
----
331317

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:
334319
+
335320
[source,terminal]
336321
----
337322
$ mkdir kmods; cd kmods
338323
----
339324

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-
400325
. Get the `kmods-via-containers` software:
401326

402327
.. Clone the `kmods-via-containers` repository:
@@ -413,7 +338,7 @@ $ git clone https://github.com/kmods-via-containers/kmods-via-containers
413338
$ git clone https://github.com/kmods-via-containers/kvc-simple-kmod
414339
----
415340

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.
417342

418343
. Create a fakeroot directory and populate it with files that you want to
419344
deliver via Ignition, using the repositories cloned earlier:
@@ -453,23 +378,39 @@ $ cd ../kvc-simple-kmod
453378
$ make install DESTDIR=${FAKEROOT}/usr/local CONFDIR=${FAKEROOT}/etc/
454379
----
455380

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:
457382
+
458383
[source,terminal]
459384
----
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
462386
----
463387

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:
467410
+
468411
[source,terminal]
469412
----
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
473414
----
474415

475416
. If the cluster is not up yet, generate manifest files and add this file to the

0 commit comments

Comments
 (0)