Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting sshkey and kernel params for debugging IPA #226

Merged
merged 2 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ COPY ./runlogwatch.sh /bin/runlogwatch.sh
COPY ./runironic.sh /bin/runironic

COPY ./dnsmasq.conf.j2 /etc/dnsmasq.conf.j2
COPY ./inspector.ipxe /tmp/inspector.ipxe
COPY ./inspector.ipxe.j2 /tmp/inspector.ipxe.j2
COPY ./dualboot.ipxe /tmp/dualboot.ipxe

# Custom httpd config, removes all but the bare minimum needed modules
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ The following environment variables can be passed in to customize run-time funct
- DHCP_RANGE - dhcp range to use for provisioning (default 172.22.0.10-172.22.0.100)
- MARIADB_PASSWORD - The database password
- OS_<section>_\_<name>=<value> - This format can be used to set arbitary ironic config options
- IRONIC_RAMDISK_SSH_KEY - A public key to allow ssh access to nodes running IPA, takes the format "ssh-rsa AAAAB3....."
- IRONIC_KERNEL_PARAMS - This parameter can be used to add additional kernel parameters to nodes running IPA

The ironic configuration can be overridden by various environment variables. The following can serve as an example:
- OS_CONDUCTOR__DEPLOY_CALLBACK_TIMEOUT=4800 - timeout (seconds) to wait for a callback from a deploy ramdisk
Expand Down
6 changes: 1 addition & 5 deletions configure-ironic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,8 @@ EOF
fi
fi

function render_j2_config () {
python3 -c 'import os; import sys; import jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read()).render(env=os.environ))' < /etc/ironic/ironic.conf.j2
}

# The original ironic.conf is empty, and can be found in ironic.conf_orig
render_j2_config > /etc/ironic/ironic.conf
render_j2_config /etc/ironic/ironic.conf.j2 /etc/ironic/ironic.conf

# Configure auth for clients
IRONIC_CONFIG_OPTIONS="--config-file /etc/ironic/ironic.conf"
Expand Down
10 changes: 0 additions & 10 deletions inspector.ipxe

This file was deleted.

10 changes: 10 additions & 0 deletions inspector.ipxe.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!ipxe

:retry_boot
echo In inspector.ipxe
imgfree
# NOTE(dtantsur): keep inspection kernel params in [mdns]params in
# ironic-inspector-image and configuration in configure-ironic.sh
kernel --timeout 60000 http://IRONIC_IP:HTTP_PORT/images/ironic-python-agent.kernel ipa-insecure=1 ipa-inspection-collectors=default,extra-hardware,logs systemd.journald.forward_to_console=yes BOOTIF=${mac} ipa-debug=1 ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 EXTRA_ARGS initrd=ironic-python-agent.initramfs {% if env.IRONIC_RAMDISK_SSH_KEY %}sshkey="{{ env.IRONIC_RAMDISK_SSH_KEY|trim }}"{% endif %} {{ env.IRONIC_KERNEL_PARAMS|trim }} || goto retry_boot
initrd --timeout 60000 http://IRONIC_IP:HTTP_PORT/images/ironic-python-agent.initramfs || goto retry_boot
boot
4 changes: 4 additions & 0 deletions ironic-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ function wait_for_interface_or_ip() {
export IRONIC_URL_HOST=$IRONIC_IP
fi
}

function render_j2_config () {
python3 -c 'import os; import sys; import jinja2; sys.stdout.write(jinja2.Template(sys.stdin.read()).render(env=os.environ))' < $1 > $2
}
6 changes: 3 additions & 3 deletions ironic.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ insecure = {{ env.IRONIC_INSPECTOR_INSECURE }}
# TODO(dtantsur): ipa-api-url should be populated by ironic itself, but it's
# not, so working around here.
# NOTE(dtantsur): keep inspection arguments synchronized with inspector.ipxe
extra_kernel_params = console=ttyS0 ipa-insecure=1 ipa-inspection-collectors=default,extra-hardware,logs ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 {% if env.IRONIC_FAST_TRACK == "true" %} ipa-api-url={{ env.IRONIC_BASE_URL }} {% endif %}
extra_kernel_params = ipa-insecure=1 ipa-inspection-collectors=default,extra-hardware,logs ipa-inspection-dhcp-all-interfaces=1 ipa-collect-lldp=1 {% if env.IRONIC_FAST_TRACK == "true" %} ipa-api-url={{ env.IRONIC_BASE_URL }} {% endif %}{% if env.IRONIC_RAMDISK_SSH_KEY %} sshkey="{{ env.IRONIC_RAMDISK_SSH_KEY|trim }}"{% endif %} {{ env.IRONIC_KERNEL_PARAMS|trim }}

[ipmi]
# use_ipmitool_retries transfers the responsibility of retrying to ipmitool
Expand Down Expand Up @@ -156,15 +156,15 @@ pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template
tftp_master_path = /shared/tftpboot
tftp_root = /shared/tftpboot
uefi_pxe_config_template = $pybasedir/drivers/modules/ipxe_config.template
pxe_append_params = nofb nomodeset vga=normal ipa-insecure=1
pxe_append_params = nofb nomodeset vga=normal ipa-insecure=1 {% if env.IRONIC_RAMDISK_SSH_KEY %}sshkey="{{ env.IRONIC_RAMDISK_SSH_KEY|trim }}"{% endif %} {{ env.IRONIC_KERNEL_PARAMS|trim }}
# This makes networking boot templates generated even for nodes using local
# boot (the default), ensuring that they boot correctly even if they start
# netbooting for some reason (e.g. with the noop management interface).
enable_netboot_fallback = true

[redfish]
use_swift = false
kernel_append_params = console=ttyS0 nofb nomodeset vga=normal ipa-insecure=1
kernel_append_params = nofb nomodeset vga=normal ipa-insecure=1 {% if env.IRONIC_RAMDISK_SSH_KEY %}sshkey="{{ env.IRONIC_RAMDISK_SSH_KEY|trim }}"{% endif %} {{ env.IRONIC_KERNEL_PARAMS|trim }}

[service_catalog]
endpoint_override = {{ env.IRONIC_BASE_URL }}
Expand Down
2 changes: 1 addition & 1 deletion runhttpd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ else
fi

# Copy files to shared mount
cp /tmp/inspector.ipxe /shared/html/inspector.ipxe
render_j2_config /tmp/inspector.ipxe.j2 /shared/html/inspector.ipxe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling of options below should be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate on this, I'm not sure what you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, github does not allow me to comment on the code a bit below. It has the remaining bits of the old approach to templating, they should be removed.

Copy link
Member Author

@derekhiggins derekhiggins Dec 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cp /tmp/dualboot.ipxe /shared/html/dualboot.ipxe
cp /tmp/uefi_esp.img /shared/html/uefi_esp.img

these lines? Those aren't templates

cp /tmp/dualboot.ipxe /shared/html/dualboot.ipxe
cp /tmp/uefi_esp.img /shared/html/uefi_esp.img

Expand Down