diff --git a/bundles/oracle9.4/bundle.sh.gotmpl b/bundles/oracle9.4/bundle.sh.gotmpl new file mode 100755 index 000000000..387ebcf15 --- /dev/null +++ b/bundles/oracle9.4/bundle.sh.gotmpl @@ -0,0 +1,54 @@ +#!/bin/bash +set -x +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 + +# Check for Oracle Linux repositories +ORACLE_REPOS=${ORACLE_REPOS:-"ol9_baseos_latest,ol9_appstream"} + +KUBERNETES_REPOS=${KUBERNETES_REPOS:-""} +if [[ -n "${KUBERNETES_REPOS}" ]]; then + ORACLE_REPOS="${ORACLE_REPOS},kubernetes" +fi + +# Install required tools for repository creation +yum -y install dnf-utils createrepo modulemd-tools yum-utils +yum clean all +TMP_DIR="$(mktemp -d repodata-XXXX)" +chmod 777 -R "${TMP_DIR}" +cp packages.txt "${TMP_DIR}" +pushd "${TMP_DIR}" + +# Download package dependencies +# 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 # Remove the first line from the requirements file + +# Download packages and dependencies +# shellcheck disable=SC2046 +yumdownloader --archlist=x86_64,noarch \ + --setopt=skip_missing_names_on_install=False -x \*i686 $(< reqs.txt) + +yumdownloader --setopt=skip_missing_names_on_install=False -x \*i686 --archlist=x86_64,noarch \ + --resolve --disablerepo=* --enablerepo="${ORACLE_REPOS}" \ + $(< packages.txt) + +# Clean up package and requirements files +rm packages.txt reqs.txt + +# Create repository metadata and module information +createrepo -v . +repo2module . --module-name offline +createrepo_mod . + +# Package the repository into a tarball with proper permissions +# shellcheck disable=SC1083,SC2035 +tar -czf {{ .OutputDirectory }}/{{ .KubernetesVersion }}_oracle_9.4_x86_64{{ .FipsSuffix }}.tar.gz * +chmod 777 {{ .OutputDirectory }}/{{ .KubernetesVersion }}_oracle_9.4_x86_64{{ .FipsSuffix }}.tar.gz + +# Return to the original directory and clean up +popd +rm -rf "${TMP_DIR}" diff --git a/bundles/oracle9.4/packages.txt.gotmpl b/bundles/oracle9.4/packages.txt.gotmpl new file mode 100644 index 000000000..eeddd4aa1 --- /dev/null +++ b/bundles/oracle9.4/packages.txt.gotmpl @@ -0,0 +1,29 @@ +audit +ca-certificates +conntrack-tools +chrony +open-vm-tools +python3-pip +socat +sysstat +dnf-utils +dnf-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 +socat +gcc +libseccomp +nfs-utils diff --git a/bundles/oracle9.4/repo-templates/kubernetes.repo.gotmpl b/bundles/oracle9.4/repo-templates/kubernetes.repo.gotmpl new file mode 100644 index 000000000..3a03d7ef1 --- /dev/null +++ b/bundles/oracle9.4/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/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go b/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go index 76218b716..549cab284 100644 --- a/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go +++ b/cmd/konvoy-image-wrapper/cmd/create-package-bundle.go @@ -47,6 +47,10 @@ var osToConfig = map[string]OSConfig{ configDir: "bundles/ubuntu20.04", containerImage: "docker.io/library/ubuntu:20.04", }, + "oracle-9.4": { + configDir: "bundles/oracle9.4", + containerImage: "docker.io/library/oraclelinux:9", + }, } func getKubernetesVerisonFromAnsible() (string, error) { @@ -346,6 +350,7 @@ func startContainer(containerEngine, containerImage, cmd := exec.Command( containerEngine, "run", "--interactive", + // "--platform linux/amd64", "--tty="+strconv.FormatBool(tty), "--rm", "-v", fmt.Sprintf("%s:/%s", outputDir, outputBaseName),