Skip to content

Commit 22e464b

Browse files
authored
Merge pull request openshift-metal3#841 from hardys/ignition_extra
Add IGNITION_EXTRA for testing ignition customization
2 parents 1cd0498 + 32e6534 commit 22e464b

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ DNS_VIP="1.1.1.1"
6767
NETWORK_TYPE="OpenShiftSDN"
6868
# Set to the subnet in use on the external (baremetal) network
6969
EXTERNAL_SUBNET="192.168.111.0/24"
70+
# Provide additional master/worker ignition configuration, will be
71+
# merged with the installer provided config, can be used to modify
72+
# the default nic configuration etc
73+
export IGNITION_EXTRA=extra.ign
7074
```
7175

7276
## Installation
@@ -266,3 +270,17 @@ Custom MAO image name is a mandatory parameter but the others are optional with
266270

267271
Alternatively, all input parameters can be set via `CUSTOM_MAO_IMAGE`, `REPO_NAME` and `MAO_BRANCH` variables respectively,
268272
and `run-custom-mao.sh` can be run automatically if you set `TEST_CUSTOM_MAO` to true.
273+
274+
### Testing a customizations to the deployed OS
275+
276+
It is possible to pass additional ignition configuration which will be merged with the installer generated files
277+
prior to deployment. This can be useful for debug/testing during development, and potentially also for configuration
278+
of networking or storage on baremetal nodes needed before cluster configuration starts (most machine configuration
279+
should use the machine-config-operator, but for changes required before that starts, ignition may be an option).
280+
281+
The following adds an additional file `/etc/test` as an example:
282+
283+
```
284+
export IGNITION_EXTRA="ignition/file_example.ign"
285+
```
286+

ignition/file_example.ign

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ignition": {"version": "2.3.0"}, "storage": {"files": [{"path": "/etc/test", "filesystem": "root", "mode": 436, "contents": {"source": "data:,test-foo%0A"}}]}}

utils.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,17 @@ function create_cluster() {
5151
cp -rf assets/generated/*.yaml ${assets_dir}/openshift
5252

5353
cp ${assets_dir}/install-config.yaml{.tmp,}
54+
if [ ! -z "${IGNITION_EXTRA:-}" ]; then
55+
$OPENSHIFT_INSTALLER --dir "${assets_dir}" --log-level=debug create ignition-configs
56+
if ! jq . ${IGNITION_EXTRA}; then
57+
echo "Error ${IGNITION_EXTRA} not valid json"
58+
exit 1
59+
fi
60+
mv ${assets_dir}/master.ign ${assets_dir}/master.ign.orig
61+
jq -s '.[0] * .[1]' ${IGNITION_EXTRA} ${assets_dir}/master.ign.orig | tee ${assets_dir}/master.ign
62+
mv ${assets_dir}/worker.ign ${assets_dir}/worker.ign.orig
63+
jq -s '.[0] * .[1]' ${IGNITION_EXTRA} ${assets_dir}/worker.ign.orig | tee ${assets_dir}/worker.ign
64+
fi
5465
$OPENSHIFT_INSTALLER --dir "${assets_dir}" --log-level=debug create cluster
5566
}
5667

0 commit comments

Comments
 (0)