forked from metal3-io/ironic-image
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow configuring CoreOS IPA as a new entrypoint
Adds a new entrypoint /bin/configure-coreos-ipa to be run as an init container after the images are downloaded.
- Loading branch information
Showing
8 changed files
with
108 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
{% set service %} | ||
[Unit] | ||
Description=Ironic Agent | ||
After=network-online.target | ||
Wants=network-online.target | ||
|
||
[Service] | ||
TimeoutStartSec=0 | ||
ExecStartPre=/bin/podman pull {{ env.IRONIC_AGENT_REGISTRY }}/ironic-agent --tls-verify=false | ||
ExecStart=/bin/podman run --privileged --network host --mount type=bind,src=/etc/ironic-python-agent.conf,dst=/etc/ironic-python-agent/ignition.conf --mount type=bind,src=/dev,dst=/dev --mount type=bind,src=/sys,dst=/sys --mount type=bind,src=/,dst=/mnt/coreos --name ironic-agent ironic-agent | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
{% endset -%} | ||
|
||
{% set ipa_config %} | ||
[DEFAULT] | ||
api_url = {{ env.IRONIC_BASE_URL }}:6385 | ||
inspection_callback_url = {{ env.IRONIC_BASE_URL }}:5050/v1/continue | ||
|
||
collect_lldp = True | ||
enable_vlan_interfaces = {{ env.IRONIC_INSPECTOR_VLAN_INTERFACES }} | ||
inspection_collectors = default,extra-hardware,logs | ||
inspection_dhcp_all_interfaces = True | ||
{% endset -%} | ||
|
||
|
||
{ | ||
"ignition": { | ||
"version": "3.0.0" | ||
}, | ||
{% if env.IRONIC_RAMDISK_SSH_KEY %} | ||
"passwd": { | ||
"users": [ | ||
{ | ||
"name": "core", | ||
"sshAuthorizedKeys": [ | ||
"{{ env.IRONIC_RAMDISK_SSH_KEY | trim }}" | ||
] | ||
} | ||
] | ||
}, | ||
{% endif -%} | ||
"storage": { | ||
"files": [{ | ||
"path": "/etc/ironic-python-agent.conf", | ||
"contents": {"source": "data:,{{ ipa_config | urlencode }}"} | ||
}] | ||
}, | ||
"systemd": { | ||
"units": [ | ||
{ | ||
"contents": "{{ service | trim | replace('\n', '\\n') }}", | ||
"enabled": true, | ||
"name": "ironic-agent.service" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/bash | ||
|
||
. /bin/ironic-common.sh | ||
. /bin/coreos-ipa-common.sh | ||
|
||
export IRONIC_INSPECTOR_VLAN_INTERFACES=${IRONIC_INSPECTOR_VLAN_INTERFACES:-all} | ||
|
||
IRONIC_CERT_FILE=/certs/ironic/tls.crt | ||
|
||
if [ -f "$IRONIC_CERT_FILE" ]; then | ||
export IRONIC_BASE_URL="https://${IRONIC_URL_HOST}" | ||
else | ||
export IRONIC_BASE_URL="http://${IRONIC_URL_HOST}" | ||
fi | ||
|
||
# FIXME(dtantsur): the default is most certainly undesired | ||
export IRONIC_AGENT_REGISTRY=${IRONIC_AGENT_REGISTRY:-quay.io/dtantsur/ironic-agent} | ||
|
||
render_j2_config /tmp/ironic-python-agent.ign.j2 "$IGNITION_FILE" | ||
coreos-installer iso ignition embed -i "$IGNITION_FILE" -f "$ISO_FILE" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/bash | ||
|
||
ROOTFS_FILE=/shared/html/images/ironic-python-agent.rootfs | ||
IGNITION_FILE=/shared/html/ironic-python-agent.ign | ||
ISO_FILE=/shared/html/images/ironic-python-agent.iso | ||
|
||
function coreos_kernel_params { | ||
echo -n "coreos.live.rootfs_url=http://$IRONIC_IP:$HTTP_PORT/images/ironic-python-agent.rootfs" | ||
echo -n " ignition.config.url=http://$IRONIC_IP:$HTTP_PORT/ironic-python-agent.ign" | ||
echo " ignition.firstboot ignition.platform.id=metal" | ||
} | ||
|
||
function use_coreos_ipa { | ||
[ -f "$ROOTFS_FILE" ] && [ -f "$IGNITION_FILE" ] && return 0 || return 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters