From cbe72fdbae64106c573586e1ce577925a7760075 Mon Sep 17 00:00:00 2001 From: Balazs Nemeth Date: Wed, 26 Jan 2022 11:38:02 +0100 Subject: [PATCH] Add ARM support --- 01_install_requirements.sh | 15 ++++++++++++--- 02_configure_host.sh | 8 ++++++++ common.sh | 6 +++--- ocp_install_env.sh | 16 +++++++++++++++- rhcos.sh | 10 +++++----- 5 files changed, 43 insertions(+), 12 deletions(-) diff --git a/01_install_requirements.sh b/01_install_requirements.sh index ff850fe11..29e174ae3 100755 --- a/01_install_requirements.sh +++ b/01_install_requirements.sh @@ -19,7 +19,7 @@ if [ -z "${METAL3_DEV_ENV}" ]; then # TODO -- come up with a plan for continuously updating this # Note we only do this in the case where METAL3_DEV_ENV is # unset, to enable developer testing of local checkouts - git reset ee1b2fec44e22700c8d250d5e0e371e3fd0aba17 --hard + git reset 37c2f30b84776841f24a59ed23c040fcb3b4aaa2 --hard popd fi @@ -41,10 +41,10 @@ elif [[ $DISTRO == "rhel8" ]]; then # Enable EPEL for python3-passlib and python3-bcrypt required by metal3-dev-env sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm - if sudo subscription-manager repos --list-enabled 2>&1 | grep "ansible-2-for-rhel-8-x86_64-rpms"; then + if sudo subscription-manager repos --list-enabled 2>&1 | grep "ansible-2-for-rhel-8-$(uname -m)-rpms"; then # The packaged 2.x ansible is too old for compatibility with metal3-dev-env sudo dnf erase -y ansible - sudo subscription-manager repos --disable=ansible-2-for-rhel-8-x86_64-rpms + sudo subscription-manager repos --disable=ansible-2-for-rhel-8-$(uname -m)-rpms fi fi @@ -60,6 +60,14 @@ sudo pip3 install ansible=="${ANSIBLE_VERSION}" # and lxml for the pyxpath script sudo pip3 install netaddr lxml + +GOARCH=$(uname -m) +if [[ $GOARCH == "aarch64" ]]; then + GOARCH="arm64" +elif [[ $GOARCH == "x86_64" ]]; then + GOARCH="amd64" +fi + pushd ${METAL3_DEV_ENV_PATH} ansible-galaxy install -r vm-setup/requirements.yml # NOTE(elfosardo): ansible.netcommon v2.6.0 broke compatibility with filters @@ -73,6 +81,7 @@ ANSIBLE_FORCE_COLOR=true ansible-playbook \ -e "working_dir=$WORKING_DIR" \ -e "virthost=$HOSTNAME" \ -e "go_version=1.17.1" \ + -e "GOARCH=$GOARCH" \ -i vm-setup/inventory.ini \ -b -vvv vm-setup/install-package-playbook.yml popd diff --git a/02_configure_host.sh b/02_configure_host.sh index 776b81048..376d6ae91 100755 --- a/02_configure_host.sh +++ b/02_configure_host.sh @@ -73,6 +73,12 @@ sudo systemctl enable --now firewalld # access. configure_chronyd +export VNC_CONSOLE=true +if [[ $(uname -m) == "aarch64" ]]; then + VNC_CONSOLE=false +fi + + ansible-playbook \ -e @vm_setup_vars.yml \ -e "ironic_prefix=${CLUSTER_NAME}_" \ @@ -93,6 +99,8 @@ ansible-playbook \ -e "virtualbmc_base_port=$VBMC_BASE_PORT" \ -e "master_hostname_format=$MASTER_HOSTNAME_FORMAT" \ -e "worker_hostname_format=$WORKER_HOSTNAME_FORMAT" \ + -e "libvirt_arch=$(uname -m)" \ + -e "enable_vnc_console=$VNC_CONSOLE" \ -i ${VM_SETUP_PATH}/inventory.ini \ -b -vvv ${VM_SETUP_PATH}/setup-playbook.yml diff --git a/common.sh b/common.sh index 1c5cdb24b..d3ad96658 100644 --- a/common.sh +++ b/common.sh @@ -97,7 +97,7 @@ export REGISTRY_CRT=registry.2.crt # Set this variable to build the installer from source export KNI_INSTALL_FROM_GIT=${KNI_INSTALL_FROM_GIT:-} -export OPENSHIFT_CLIENT_TOOLS_URL=https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz +export OPENSHIFT_CLIENT_TOOLS_URL=https://mirror.openshift.com/pub/openshift-v4/$(uname -m)/clients/ocp/stable/openshift-client-linux.tar.gz export OPENSHIFT_RELEASE_TYPE=${OPENSHIFT_RELEASE_TYPE:-nightly} export OPENSHIFT_RELEASE_STREAM=${OPENSHIFT_RELEASE_STREAM:-4.11} @@ -137,7 +137,7 @@ if [ -z "${OPENSHIFT_RELEASE_IMAGE:-}" ]; then fi fi export OPENSHIFT_RELEASE_IMAGE="${OPENSHIFT_RELEASE_IMAGE:-$LATEST_CI_IMAGE}" -export OPENSHIFT_INSTALL_PATH="$GOPATH/src/github.com/openshift/installer" +export OPENSHIFT_INSTALL_PATH="${OPENSHIFT_INSTALL_PATH:-$GOPATH/src/github.com/openshift/installer}" # Override the image to use for installing hive export HIVE_DEPLOY_IMAGE="${HIVE_DEPLOY_IMAGE:-registry.ci.openshift.org/openshift/hive-v4.0:hive}" @@ -265,7 +265,7 @@ export EXTRA_WORKER_DISK=${EXTRA_WORKER_DISK:-${WORKER_DISK}} export EXTRA_WORKER_VCPU=${EXTRA_WORKER_VCPU:-${WORKER_VCPU}} # Ironic vars (Image can be use _LOCAL_IMAGE to override) -export IRONIC_IMAGE="quay.io/metal3-io/ironic:main" +export IRONIC_IMAGE=${IRONIC_IMAGE:-"quay.io/metal3-io/ironic:main"} export IRONIC_DATA_DIR="${WORKING_DIR}/ironic" export IRONIC_IMAGES_DIR="${IRONIC_DATA_DIR}/html/images" diff --git a/ocp_install_env.sh b/ocp_install_env.sh index b1b145bc9..333d3dad7 100644 --- a/ocp_install_env.sh +++ b/ocp_install_env.sh @@ -1,5 +1,17 @@ eval "$(go env)" +function get_arch() { + ARCH=$(uname -m) + if [[ $ARCH == "aarch64" ]]; then + ARCH="arm64" + elif [[ $ARCH == "x86_64" ]]; then + if [[ "$1" == "install_config" ]]; then + ARCH="amd64" + fi + fi + echo $ARCH +} + function extract_command() { local release_image local cmd @@ -85,7 +97,7 @@ function build_installer() { # Build installer pushd . cd $OPENSHIFT_INSTALL_PATH - TAGS="libvirt baremetal" hack/build.sh + TAGS="libvirt baremetal" DEFAULT_ARCH=$(get_arch) hack/build.sh popd # This is only needed in rhcos.sh for old versions which lack the # openshift-install coreos-print-stream-json option @@ -230,9 +242,11 @@ metadata: compute: - name: worker replicas: $NUM_WORKERS + architecture: $(get_arch install_config) controlPlane: name: master replicas: ${NUM_MASTERS} + architecture: $(get_arch install_config) platform: baremetal: {} platform: diff --git a/rhcos.sh b/rhcos.sh index bf465cc21..30c0def34 100644 --- a/rhcos.sh +++ b/rhcos.sh @@ -1,19 +1,19 @@ if $OPENSHIFT_INSTALLER coreos print-stream-json >/dev/null 2>&1; then $OPENSHIFT_INSTALLER coreos print-stream-json > $OCP_DIR/rhcos.json - export MACHINE_OS_INSTALLER_IMAGE_URL=$(jq -r '.architectures.x86_64.artifacts.openstack.formats["qcow2.gz"].disk.location' $OCP_DIR/rhcos.json) - export MACHINE_OS_INSTALLER_IMAGE_SHA256=$(jq -r '.architectures.x86_64.artifacts.openstack.formats["qcow2.gz"].disk["sha256"]' $OCP_DIR/rhcos.json) + export MACHINE_OS_INSTALLER_IMAGE_URL=$(jq -r .architectures.$(uname -m).artifacts.openstack.formats[\"qcow2.gz\"].disk.location $OCP_DIR/rhcos.json) + export MACHINE_OS_INSTALLER_IMAGE_SHA256=$(jq -r .architectures.$(uname -m).artifacts.openstack.formats[\"qcow2.gz\"].disk[\"sha256\"] $OCP_DIR/rhcos.json) export MACHINE_OS_IMAGE_URL=${MACHINE_OS_IMAGE_URL:-${MACHINE_OS_INSTALLER_IMAGE_URL}} export MACHINE_OS_IMAGE_NAME=$(basename ${MACHINE_OS_IMAGE_URL}) export MACHINE_OS_IMAGE_SHA256=${MACHINE_OS_IMAGE_SHA256:-${MACHINE_OS_INSTALLER_IMAGE_SHA256}} - export MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_URL=$(jq -r '.architectures.x86_64.artifacts.qemu.formats["qcow2.gz"].disk.location' $OCP_DIR/rhcos.json) - export MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_SHA256=$(jq -r '.architectures.x86_64.artifacts.qemu.formats["qcow2.gz"].disk["sha256"]' $OCP_DIR/rhcos.json) + export MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_URL=$(jq -r .architectures.$(uname -m).artifacts.qemu.formats[\"qcow2.gz\"].disk.location $OCP_DIR/rhcos.json) + export MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_SHA256=$(jq -r .architectures.$(uname -m).artifacts.qemu.formats[\"qcow2.gz\"].disk[\"sha256\"] $OCP_DIR/rhcos.json) export MACHINE_OS_BOOTSTRAP_IMAGE_URL=${MACHINE_OS_BOOTSTRAP_IMAGE_URL:-${MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_URL}} export MACHINE_OS_BOOTSTRAP_IMAGE_NAME=$(basename ${MACHINE_OS_BOOTSTRAP_IMAGE_URL}) export MACHINE_OS_BOOTSTRAP_IMAGE_URL=${MACHINE_OS_BOOTSTRAP_IMAGE_URL:-${MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_URL}} export MACHINE_OS_BOOTSTRAP_IMAGE_SHA256=${MACHINE_OS_BOOTSTRAP_IMAGE_SHA256:-${MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_SHA256}} - export MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_UNCOMPRESSED_SHA256=$(jq -r '.architectures.x86_64.artifacts.qemu.formats["qcow2.gz"].disk["uncompressed-sha256"]' $OCP_DIR/rhcos.json) + export MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_UNCOMPRESSED_SHA256=$(jq -r .architectures.$(uname -m).artifacts.qemu.formats[\"qcow2.gz\"].disk[\"uncompressed-sha256\"] $OCP_DIR/rhcos.json) export MACHINE_OS_BOOTSTRAP_IMAGE_UNCOMPRESSED_SHA256=${MACHINE_OS_BOOTSTRAP_IMAGE_UNCOMPRESSED_SHA256:-${MACHINE_OS_INSTALLER_BOOTSTRAP_IMAGE_UNCOMPRESSED_SHA256}} else if [[ ! -f "$OCP_DIR/rhcos.json" ]]; then