Build and test NCN images locally by using the following procedure. This procedure can be done on any x86
machine with the following prerequisites.
The listed software below will equip a local machine or build server to build for any medium (.squashfs
, .vbox
, .qcow2
, .iso
).
.iso
, .ovf
, or .qcow2
) (depending on the layer)packer
qemu
envsubst
packer
can intake any ISO, the sections below detail utilized base ISOs in CRAY HPCaaS.
For any ISO, copy it into the iso
directory.
The file name is either:
SLE-15-SP2-Full-x86_64-GM-Media1.iso
SLE-15-SP3-Full-x86_64-GM-Media1.iso
Access is required to the appropriate SLES repositories in the form of official access, self-hosted access, or the provided Nexus access.
To build locally, an administrator must provide their own repositories file and the custom_repos_file
variable must be passed with the packer
command.
The custom_repos_file
variable is a filename that is placed into the custom
folder of the project.
The file must be formatted with the following fields: url name flags
-var 'custom_repos_file=custom.repos'
And example entry for a custom repository:
https://myserver.net/sles-mirror/Products/SLE-Module-Basesystem/15-SP3/x86_64/product SUSE-SLE-Module-Basesystem-15-SP3-x86_64-Pool -g -p 99 suse/SLE-Module-Basesystem/15-SP3/x86_64/product
initrd
, and SquashFS required to boot nodes.packer
from a reputable source, like packer.io
.If building QEMU images in MacOS, then specific QEMU options must be adjusted:
-var 'qemu_display=cocoa' -var 'qemu_accelerator=hvf'
scripts/environment.template
to scripts/environment
and modifying the values for the specific environment.SLE-15-SP3-Full-x86_64-GM-Media1.iso
is in the iso/
foldercsm-rpms
repository and create a symlink to it in the root directory of the project.source scripts/environment
./scripts/setup.sh
autoinst
templategit clone <csm-rpms-repo>
git clone https://github.com/Cray-HPE/node-image-build.git
cd node-image-build
ln -s ../csm-rpms/ csm-rpms
cp scripts/environment.template scripts/environment
vim scripts/environment
source scripts/environment
mkdir -p iso
wget https://<somepath>/SLE-15-SP3-Full-x86_64-GM-Media1.iso -O iso/SLE-15-SP3-Full-x86_64-GM-Media1.iso
./scripts/setup.sh
The base layer will install SLES 15 and prepare the image for the installation of Kubernetes and Ceph.
Execute the following commands from the top level of the project
To build with QEMU, run the following command.
packer build -only=qemu.sles15-base -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' boxes/sles15-base/
To build with VirtualBox, run the following command.
packer build -only=virtualbox-iso.sles15-base -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' boxes/sles15-base/
In order to view the output of the build, disable headless
mode:
packer build -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' -var 'headless=false' boxes/sles15-base/
Once the images are built, the output will be placed in the output-sles15-base
directory in the root of the project.
The common layer starts from the output of the base layer. As such the base layer must be created before building common.
To build with QEMU, run the following command.
packer build -only=qemu.ncn-common -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' boxes/ncn-common/
To build with VirtualBox, run the following command.
packer build -only=virtualbox-ovf.ncn-common -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' boxes/ncn-common/
Once the image is built, the output will be placed in the output-ncn-common
directory in the root of the project.
The ncn-node-images
stage builds on top of the common layer to create functional images for Kubernetes and Ceph.
To build with QEMU, run the following command.
packer build -only=qemu.* -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' boxes/ncn-node-images/
To build with VirtualBox, run the following command.
packer build -only=virtualbox-ovf.* -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' boxes/ncn-node-images/
Once the images are built, the output will be placed in the output-sles15-images
directory in the root of the project.
Each layer creates a certain set of artifacts that can be used in different ways.
sles15-base
creates a list of packages and repos.ncn-common
creates kernel and initrd
artifacts.ncn-node-images
creates kernel, initrd
, and SquashFS artifacts.packer build
command as the artifact_version
var:packer build -only=qemu.sles15-base -var "artifact_version=`git rev-parse --short HEAD`" -var 'ssh_password=$SLES15_INITIAL_ROOT_PASSWORD' -var 'headless=false' boxes/sles15-base/
none
is used when generating the archive.