From 62cec793800556b80ee3dc8be5b707303b7010b3 Mon Sep 17 00:00:00 2001 From: faiq Date: Wed, 23 Oct 2024 13:33:40 -0700 Subject: [PATCH] fix: adds rhel 8.10 support to aws --- .github/workflows/aws-e2e.yaml | 13 +++ bundles/redhat8.10/bundle.sh.gotmpl | 86 +++++++++++++++++++ bundles/redhat8.10/packages.txt.gotmpl | 41 +++++++++ .../repo-templates/kubernetes.repo.gotmpl | 5 ++ images/ami/rhel-810.yaml | 14 +++ 5 files changed, 159 insertions(+) create mode 100755 bundles/redhat8.10/bundle.sh.gotmpl create mode 100644 bundles/redhat8.10/packages.txt.gotmpl create mode 100644 bundles/redhat8.10/repo-templates/kubernetes.repo.gotmpl create mode 100644 images/ami/rhel-810.yaml diff --git a/.github/workflows/aws-e2e.yaml b/.github/workflows/aws-e2e.yaml index 6464ad660..0bb2fda74 100644 --- a/.github/workflows/aws-e2e.yaml +++ b/.github/workflows/aws-e2e.yaml @@ -43,6 +43,19 @@ jobs: buildConfig: "offline-fips" - os: "redhat 8.8" buildConfig: "offline-nvidia" + #RHEL 8.10 + - os: "redhat 8.10" + buildConfig: "basic" + - os: "redhat 8.10" + buildConfig: "fips" + - os: "redhat 8.10" + buildConfig: "nvidia" + - os: "redhat 8.10" + buildConfig: "offline" + - os: "redhat 8.10" + buildConfig: "offline-fips" + - os: "redhat 8.10" + buildConfig: "offline-nvidia" # SLES 15 - os: "sles 15" buildConfig: "basic" diff --git a/bundles/redhat8.10/bundle.sh.gotmpl b/bundles/redhat8.10/bundle.sh.gotmpl new file mode 100755 index 000000000..3cdde032e --- /dev/null +++ b/bundles/redhat8.10/bundle.sh.gotmpl @@ -0,0 +1,86 @@ +#!/bin/bash +set -euo pipefail + +# When yum operates on multiple packages, it does not, by default, return an error if a subset +# of packages is not found. This makes yum return an error. +echo skip_missing_names_on_install=False >> /etc/yum.conf + +sed -i 's/\(def in_container():\)/\1\n return False/g' /usr/lib64/python*/*-packages/rhsm/config.py +FOUND=false + +RHSM_ORG_ID=${RHSM_ORG_ID:-""} +RHSM_ACTIVATION_KEY=${RHSM_ACTIVATION_KEY:-""} +RHSM_USER=${RHSM_USER:-""} +RHSM_PASS=${RHSM_PASS:-""} + +if [[ -n "${RHSM_ORG_ID}" && -n "${RHSM_ACTIVATION_KEY}" ]]; then + subscription-manager register --org="${RHSM_ORG_ID}" --activationkey="${RHSM_ACTIVATION_KEY}" --force + FOUND=true +fi + +if [[ -n "${RHSM_USER}" && -n "${RHSM_PASS}" && ${FOUND} == false ]]; then + subscription-manager register --username="${RHSM_USER}" --password="${RHSM_PASS}" --force + FOUND=true +fi + +if [[ ${FOUND} == false ]]; then + echo "You must use subscription manager to fetch packages for redhat" + exit 1 +fi + +subscription::unregister() { + subscription-manager unregister +} + +subscription::defer_unregister() { + trap subscription::unregister ABRT + trap subscription::unregister EXIT + trap subscription::unregister HUP + trap subscription::unregister INT + trap subscription::unregister TERM + trap subscription::unregister USR1 + trap subscription::unregister USR2 +} + +subscription-manager release --set=8.10 +subscription-manager refresh +subscription::defer_unregister + +ENABLED_REPOS="codeready-builder-for-rhel-8-x86_64-rpms,rhel-8-for-x86_64-appstream-rpms,rhel-8-for-x86_64-baseos-rpms" +subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms +subscription-manager repos --enable rhel-8-for-x86_64-appstream-rpms +subscription-manager repos --enable rhel-8-for-x86_64-baseos-rpms +subscription-manager repos --disable=rhel-8-for-x86_64-baseos-eus-rpms --disable=rhel-8-for-x86_64-appstream-eus-rpms + +KUBERNETES_REPOS=${KUBERNETES_REPOS:-""} +if [[ -n "${KUBERNETES_REPOS}" ]]; then + ENABLED_REPOS="${ENABLED_REPOS},kubernetes" +fi + +yum -y install gettext yum-utils createrepo dnf-utils modulemd-tools +yum clean all +TMP_DIR="$(mktemp -d repodata-XXXX)" +chmod 777 -R "${TMP_DIR}" +cp packages.txt "${TMP_DIR}" +pushd "${TMP_DIR}" +#shellcheck disable=SC2046,SC2062,SC2063,SC2035 +repoquery --archlist=x86_64,noarch --resolve --requires --recursive $(< packages.txt) | grep -v *.i686 >> reqs.txt +sed -i 1d reqs.txt # we need to get rid of the first line +#shellcheck disable=SC2046 +yumdownloader --archlist=x86_64,noarch \ + --setopt=skip_missing_names_on_install=False -x \*i686 $(< reqs.txt) || true +#shellcheck disable=SC2046 +yumdownloader --setopt=skip_missing_names_on_install=False -x \*i686 --archlist=x86_64,noarch \ + --resolve --disablerepo=* --enablerepo="${ENABLED_REPOS}" \ + $(< packages.txt) || true + +rm packages.txt reqs.txt +createrepo -v . +repo2module . --module-name offline +createrepo_mod . +#shellcheck disable=SC1083,SC2035 +tar -czf {{ .OutputDirectory }}/{{ .KubernetesVersion }}_redhat_8.10_x86_64{{ .FipsSuffix }}.tar.gz * +#shellcheck disable=SC1083 +chmod 777 {{ .OutputDirectory }}/{{ .KubernetesVersion }}_redhat_8.10_x86_64{{ .FipsSuffix }}.tar.gz +popd +rm -rf "${TMP_DIR}" diff --git a/bundles/redhat8.10/packages.txt.gotmpl b/bundles/redhat8.10/packages.txt.gotmpl new file mode 100644 index 000000000..2b9f00137 --- /dev/null +++ b/bundles/redhat8.10/packages.txt.gotmpl @@ -0,0 +1,41 @@ +audit +ca-certificates +conntrack-tools +chrony +ebtables +open-vm-tools +python2-pip +python3-pip +socat +yum-utils +yum-plugin-versionlock +NetworkManager +cloud-init +cloud-utils-growpart +container-selinux +{{ if .FetchKubernetesRPMs -}} +kubectl-{{ .KubernetesVersion }}-0 +kubelet-{{ .KubernetesVersion }}-0 +kubeadm-{{ .KubernetesVersion }}-0 +cri-tools +{{- end }} +conntrack +ebtables +ethtool +iproute +iptables +iscsi-initiator-utils +socat +gcc +glibc-devel +make +libseccomp +iproute-tc +gssproxy +libverto-module-base +libverto +nfs-utils +{{ if .FetchKernelHeaders -}} +kernel-headers +kernel-devel +{{- end }} diff --git a/bundles/redhat8.10/repo-templates/kubernetes.repo.gotmpl b/bundles/redhat8.10/repo-templates/kubernetes.repo.gotmpl new file mode 100644 index 000000000..3a03d7ef1 --- /dev/null +++ b/bundles/redhat8.10/repo-templates/kubernetes.repo.gotmpl @@ -0,0 +1,5 @@ +[kubernetes] +name=Konvoy Kubernetes package repository +baseurl=https://packages.d2iq.com/konvoy/stable/linux/repos/el/kubernetes-v{{ .KubernetesVersion }}-{{ .RepoSuffix }}/x86_64 +gpgcheck=1 +gpgkey=https://packages.d2iq.com/konvoy/stable/linux/repos/d2iq-sign-authority-gpg-public-key diff --git a/images/ami/rhel-810.yaml b/images/ami/rhel-810.yaml new file mode 100644 index 000000000..6eedbfa5d --- /dev/null +++ b/images/ami/rhel-810.yaml @@ -0,0 +1,14 @@ +--- +build_name: "rhel-8.10" +packer_builder_type: "amazon" +python_path: "" +packer: + ami_filter_name: "RHEL-8.10.0_HVM-*" + ami_filter_owners: "309956199498" + distribution: "RHEL" + distribution_version: "8.10" + source_ami: "" + ssh_username: "ec2-user" + root_device_name: "/dev/sda1" + volume_size: "15" +