|
| 1 | +<!-- |
| 2 | + This work is licensed under a Creative Commons Attribution 3.0 |
| 3 | + Unported License. |
| 4 | +
|
| 5 | + http://creativecommons.org/licenses/by/3.0/legalcode |
| 6 | +--> |
| 7 | + |
| 8 | +# pre-provisioning kernel argument support |
| 9 | + |
| 10 | +## Status |
| 11 | + |
| 12 | +planned |
| 13 | + |
| 14 | +## Summary |
| 15 | + |
| 16 | +This document proposes a new BareMetalHost spec attribute intended for |
| 17 | +configuring the pre-provisioning image's (usually IPA) kernel arguments. |
| 18 | + |
| 19 | +## Motivation |
| 20 | + |
| 21 | +There are situations where a user would need node specific kernel arguments |
| 22 | +for the pre-provisioning image. The reason could be the use of a mixed set of |
| 23 | +hardware, troubleshooting provisioning or boot issues, selectively configuring |
| 24 | +custom logic e.g. enabling IPA plugins or other services embedded in the |
| 25 | +pre-provisioning image. |
| 26 | + |
| 27 | +### Goals |
| 28 | + |
| 29 | +1. Implement a string array type optional spec field named |
| 30 | + `preProvisionKernelArgs` |
| 31 | +2. Extend the generic `Provisioner` interface to support the new optional field |
| 32 | +3. Implement support for the `preProvisionKernelArgs` in the Ironic provisioner |
| 33 | + |
| 34 | +### Non-Goals |
| 35 | + |
| 36 | +1. To implement any sort value check for the new optional spec |
| 37 | +2. Providing a default value for the new spec field |
| 38 | + |
| 39 | +## Proposal |
| 40 | + |
| 41 | +This document proposes a new BareMetalHost spec attribute intended for |
| 42 | +configuring the pre-provisioning image's (usually IPA) kernel arguments. |
| 43 | + |
| 44 | +The proposal involves the introduction of a new spec field thus a modification |
| 45 | +to the BMO API. The API change is intended to be backward compatible as the |
| 46 | +new `preProvisionKernelArgs` field intended to be optional. |
| 47 | + |
| 48 | +### Implementation Details/Notes/Constraints |
| 49 | + |
| 50 | +The `preProvisionKernelArgs` field would be located directly under `spec` |
| 51 | +section. The format of the new field would be a list/array of individual |
| 52 | +strings. The new field would be optional and it would be considered |
| 53 | +either a NOOP or a cleaning operation depending on the previous value of the |
| 54 | +field in case it would be not present or have no value or would have an empty |
| 55 | +array as a value. |
| 56 | + |
| 57 | +The proposed BMH looks like the following: |
| 58 | + |
| 59 | +```yaml |
| 60 | +apiVersion: metal3.io/v1alpha1 |
| 61 | +kind: BareMetalHost |
| 62 | +metadata: |
| 63 | + name: bm0 |
| 64 | +spec: |
| 65 | + online: true |
| 66 | + bmc: |
| 67 | + address: idrac://192.168.122.1:6230/ |
| 68 | + credentialsName: bm0-bmc-secret |
| 69 | + preProvisionKernelArgs: |
| 70 | + - --timeout |
| 71 | + - 60000 |
| 72 | + - systemd.journald.forward_to_console=yes |
| 73 | + - ipa-debug=1 |
| 74 | + ... |
| 75 | + ... |
| 76 | + ... |
| 77 | + bootMACAddress: 52:54:00:b7:b2:6f |
| 78 | +... |
| 79 | +... |
| 80 | +... |
| 81 | + |
| 82 | +``` |
| 83 | + |
| 84 | +The example contains a snippet of a common IPA kernel argument list. |
| 85 | +The `preProvisionKernelArgs` list would be received by the `Provisioner` |
| 86 | +interface as is. The handling of the list would be up to the particular |
| 87 | +implementations of the `Provisioner` interface. In case of the `Ironic` |
| 88 | +provisioner the elements from the `preProvisionKernelArgs` would be |
| 89 | +concatenated into a single string such that the string would start with the |
| 90 | +first element (lowest index) from the list and would end with the last |
| 91 | +(highest index) element. The elements between the first and last element would |
| 92 | +be concatenated in an ascending order based on their index number in the array. |
| 93 | + |
| 94 | +Taken the BMH snippet from above the kernel argument list generated by |
| 95 | +the `Ironic provisioner` and posted to the Ironic Node API would look like |
| 96 | +`--timeout 60000 systemd.journald.forward_to_console=yes ipa-debug=1 ...`. |
| 97 | + |
| 98 | +### Risks and Mitigations |
| 99 | + |
| 100 | +Providing a faulty list kernel arguments might result in boot issues |
| 101 | +or unexpected behavior during the life cycle of the pre-provisioning image. |
| 102 | + |
| 103 | +The user has to be aware that the kernel arguments supplied here will fully or |
| 104 | +partially overwrite the default arguments depending on how the particular |
| 105 | +`Provisioner` is handling the argument list. In case of Ironic provisioner |
| 106 | +the `preProvisionKernelArgs` will completely replace the default argument |
| 107 | +list used by Ironic. |
| 108 | + |
| 109 | +## Design Details |
| 110 | + |
| 111 | +Most of the design is very straightforward an easy to combine with the |
| 112 | +reconcile logic, the support for node specific pre-provisioning kernel args |
| 113 | +also already exist in Ironic, so right after the feature is implemented in BMO |
| 114 | +it can be used. |
| 115 | + |
| 116 | +The only challenge is the process of updating/cleaning the previously applied |
| 117 | +kernel argument list, this cleanup/update process highly depends on the |
| 118 | +particular provisioner but we might be able to leverage the |
| 119 | +`kubectl.kubernetes.io/last-applied-configuration` annotation or some other |
| 120 | +method to avoid initiating redundant kernel argument update,sync or cleaning |
| 121 | +operations. |
| 122 | + |
| 123 | +### Work Items |
| 124 | + |
| 125 | +- Implement a string array type optional spec field named |
| 126 | + `preProvisionKernelArgs` |
| 127 | +- Extend the generic `Provisioner` interface to support the new optional field |
| 128 | +- Implement support for the `preProvisionKernelArgs` in the Ironic driver |
| 129 | +- Implement unit tests |
| 130 | +- Add a check to the existing BMO e2e workflow that logs in to an active IPA |
| 131 | + via ssh or serial console and checks whether the custom kernel args were |
| 132 | + propagated properly or not. |
| 133 | + |
| 134 | +### Dependencies |
| 135 | + |
| 136 | +- Ironic in case of the `Ironic Provisioner` |
| 137 | + |
| 138 | +### Test Plan |
| 139 | + |
| 140 | +- Unit tests for the functions |
| 141 | + |
| 142 | +- Integration testing with VMs, most likely as part of the existing |
| 143 | + e2e workflow |
| 144 | + |
| 145 | +### Upgrade / Downgrade Strategy |
| 146 | + |
| 147 | +- In case of upgrade user would not need to do anything |
| 148 | +- In case of downgrade the user has to remove the field from the BMH |
| 149 | + to both make the BMH compatible with the older API and to allow the |
| 150 | + particular provisioner in use to return using the defaults arguments list. |
| 151 | + |
| 152 | +### Version Skew Strategy |
| 153 | + |
| 154 | +None |
| 155 | + |
| 156 | +## Drawbacks |
| 157 | + |
| 158 | +None |
| 159 | + |
| 160 | +## Alternatives |
| 161 | + |
| 162 | +None |
| 163 | + |
| 164 | +## Reference |
| 165 | + |
| 166 | +None |
0 commit comments