diff --git a/image-builder/Makefile b/image-builder/Makefile index 2e4d951..d6c2fda 100644 --- a/image-builder/Makefile +++ b/image-builder/Makefile @@ -118,8 +118,9 @@ else export user_data=$(QCOW_BUNDLE)/$$subdir/user_data export network_config=$(QCOW_BUNDLE)/$$subdir/network_data.json # QCOW configs - export osconfig_params=$(QCOW_BUNDLE)/$$subdir/osconfig-*-vars.yaml - export qcow_params=$(QCOW_BUNDLE)/$$subdir/qcow-*-vars.yaml + qcow_type=$$(echo $$subdir | sed -e "s/^qcow-//") + export osconfig_params="$(QCOW_BUNDLE)/$$subdir/osconfig-$$qcow_type-vars.yaml" + export qcow_params="$(QCOW_BUNDLE)/$$subdir/qcow-$$qcow_type-vars.yaml" # Shared configs export img_name=$$(cat $(QCOW_BUNDLE)/$$subdir/img_name) sudo -E tools/cut_image.sh $(IMAGE_TYPE) $(QCOW_BUNDLE) $(IMAGE) "$(PROXY)" "$(NO_PROXY)" diff --git a/image-builder/assets/playbooks/roles/osconfig/tasks/grub.yaml b/image-builder/assets/playbooks/roles/osconfig/tasks/grub.yaml index 59b0858..74eea24 100644 --- a/image-builder/assets/playbooks/roles/osconfig/tasks/grub.yaml +++ b/image-builder/assets/playbooks/roles/osconfig/tasks/grub.yaml @@ -1,4 +1,7 @@ # Settings here will be applied to /boot/grub/grub.cfg when grub is installed +- name: "Append any user-defined grub cmdline linux default" + set_fact: + grub_cmdline_linux_default: "{% if grub_cmdline_linux_default_append is defined %}{{ grub.GRUB_CMDLINE_LINUX_DEFAULT + grub_cmdline_linux_default_append }}{% else %}{{ grub.GRUB_CMDLINE_LINUX_DEFAULT }}{% endif %}" - name: "Grub | Grub config" template: src: grub.j2 diff --git a/image-builder/assets/playbooks/roles/osconfig/tasks/main.yaml b/image-builder/assets/playbooks/roles/osconfig/tasks/main.yaml index 56f8e65..b6c488d 100644 --- a/image-builder/assets/playbooks/roles/osconfig/tasks/main.yaml +++ b/image-builder/assets/playbooks/roles/osconfig/tasks/main.yaml @@ -18,7 +18,7 @@ when: run_context == default_run_context - name: "configure grub" include_tasks: grub.yaml - when: run_context == default_run_context + when: run_context == default_run_context or run_context == qcow_run_context - name: "configure kdump-tools" include_tasks: kdump-tools.yaml when: run_context == default_run_context diff --git a/image-builder/assets/playbooks/roles/osconfig/templates/grub.j2 b/image-builder/assets/playbooks/roles/osconfig/templates/grub.j2 index 9e5dbbc..c40ac2e 100644 --- a/image-builder/assets/playbooks/roles/osconfig/templates/grub.j2 +++ b/image-builder/assets/playbooks/roles/osconfig/templates/grub.j2 @@ -9,7 +9,7 @@ GRUB_TIMEOUT_STYLE=menu GRUB_TIMEOUT={{ grub.GRUB_TIMEOUT }} GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` {% set ns = namespace (content = '') %} -{% for arg in grub.GRUB_CMDLINE_LINUX_DEFAULT %} +{% for arg in grub_cmdline_linux_default %} {% set ns.content = ns.content + ' ' + arg.name + '=' + arg.value %} {% endfor %} GRUB_CMDLINE_LINUX_DEFAULT="{{ ns.content }}" diff --git a/image-builder/config/qcow-bundle/qcow-control-plane/osconfig-control-plane-vars.yaml b/image-builder/config/qcow-bundle/qcow-control-plane/osconfig-control-plane-vars.yaml index 44736a3..5e3121a 100644 --- a/image-builder/config/qcow-bundle/qcow-control-plane/osconfig-control-plane-vars.yaml +++ b/image-builder/config/qcow-bundle/qcow-control-plane/osconfig-control-plane-vars.yaml @@ -1,5 +1,4 @@ # Custom user-defined overrides to the `osconfig` playbook can be placed here. # -# You would only use this if you needed to apply some settings uniques to this -# type of image (control-plane or data-plane). Ex: kernel boot params specific -# to workers vs non-worker nodes. +# You would only use this if you needed to apply some settings uniques to +# control-plane image. Ex: kernel boot params specific to non-worker nodes. diff --git a/image-builder/config/qcow-bundle/qcow-data-plane/osconfig-control-plane-vars.yaml b/image-builder/config/qcow-bundle/qcow-data-plane/osconfig-control-plane-vars.yaml deleted file mode 120000 index 20d876a..0000000 --- a/image-builder/config/qcow-bundle/qcow-data-plane/osconfig-control-plane-vars.yaml +++ /dev/null @@ -1 +0,0 @@ -../qcow-control-plane/osconfig-control-plane-vars.yaml \ No newline at end of file diff --git a/image-builder/config/qcow-bundle/qcow-data-plane/osconfig-data-plane-vars.yaml b/image-builder/config/qcow-bundle/qcow-data-plane/osconfig-data-plane-vars.yaml new file mode 100644 index 0000000..b0e50fa --- /dev/null +++ b/image-builder/config/qcow-bundle/qcow-data-plane/osconfig-data-plane-vars.yaml @@ -0,0 +1,18 @@ +# Custom user-defined overrides to the `osconfig` playbook can be placed here. +# +# You would only use this if you needed to apply some settings uniques to +# data-plane image. Ex: hugepages and cpu pinning configuration + +# grub_cmdline_linux_default_append: +# - name: hugepagesz +# value: "1G" +# - name: hugepages +# value: "100" +# - name: default_hugepagesz +# value: "1G" +# - name: isolcpus +# value: "4-43,48-87" +# - name: rcu_nocbs +# value: "4-43,48-87" +# - name: transparent_hugepage +# value: "never" diff --git a/image-builder/tools/cut_image.sh b/image-builder/tools/cut_image.sh index 530778e..6c212c9 100755 --- a/image-builder/tools/cut_image.sh +++ b/image-builder/tools/cut_image.sh @@ -25,8 +25,6 @@ workdir="$(realpath ${host_mount_directory})" # Overrides : ${user_data:=$workdir/user_data} : ${network_config:=$workdir/network_data.json} -: ${osconfig_params:=$workdir/qcow-control-plane/osconfig-control-plane-vars.yaml} -: ${qcow_params:=$workdir/qcow-control-plane/qcow-control-plane-vars.yaml} if [ -n "$proxy" ]; then export http_proxy=$proxy