Skip to content

Commit

Permalink
feat: Support creating ubuntu 22.04 AMI for AWS (#1244)
Browse files Browse the repository at this point in the history
* feat: Support creating ubuntu 22.04 AMI for AWS

* Update .github/workflows/aws-e2e.yaml

Co-authored-by: Dimitri Koshkin <[email protected]>

* fix: ubuntu 22.04 gpu support (#1246)

* fix: ubuntu 22.04 gpu support

* fix: set gcc 12 for ubuntu 22

---------

Co-authored-by: Dimitri Koshkin <[email protected]>
Co-authored-by: Faiq <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2025
1 parent 35a7a87 commit 105d58e
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/aws-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ jobs:
buildConfig: "nvidia"
- os: "ubuntu 20.04"
buildConfig: "offline"
# Ubuntu 22.04
- os: "ubuntu 22.04"
buildConfig: "basic"
- os: "ubuntu 22.04"
buildConfig: "nvidia"
# Rocky 9.1
- os: "rocky 9.1"
buildConfig: "basic"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release-ami.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ jobs:
buildConfig: "nvidia"
- os: "ubuntu 20.04"
buildConfig: "basic"
- os: "ubuntu 22.04"
buildConfig: "basic"
- os: "ubuntu 22.04"
buildConfig: "nvidia"
- os: "flatcar"
buildConfig: "basic"

Expand Down
42 changes: 42 additions & 0 deletions ansible/roles/gpu/tasks/nvidia-gpu-Ubuntu.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
# Implements the NVIDIA Driver Installation Quickstart Guide for Ubuntu LTS - see
# https://docs.nvidia.com/datacenter/tesla/tesla-installation-notes/index.html#ubuntu-lts

- name: install runfile prereqs
apt:
name:
- linux-headers-{{ ansible_kernel }}
- build-essential
state: present
update_cache: true
retries: 3
delay: 4

- name: configure ubuntu 22.04
block:
- name: install runfile prereqs for ubuntu 22.04
apt:
name:
- gcc-12
- g++-12
state: present
update_cache: true
retries: 3
delay: 4
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == '22'

- name: configure update-alternatives for gcc
ansible.builtin.command:
cmd: "{{ item }}"
with_items:
- "update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 12"
- "update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 12"
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == '22'

- name: set gcc 12 as default
ansible.builtin.command:
cmd: "{{ item }}"
with_items:
- "update-alternatives --set gcc /usr/bin/gcc-12"
- "update-alternatives --set cc /usr/bin/gcc-12"
when: ansible_distribution == "Ubuntu" and ansible_distribution_major_version == '22'
13 changes: 0 additions & 13 deletions ansible/roles/gpu/tasks/nvidia-gpu-Ubuntu20.yaml

This file was deleted.

5 changes: 3 additions & 2 deletions ansible/roles/gpu/tasks/nvidia-gpu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
include_tasks: nvidia-gpu-Flatcar.yaml
when: ansible_distribution == "Flatcar"

- name: "NVIDIA Gpu - Ubuntu 20"
include_tasks: nvidia-gpu-Ubuntu20.yaml
- name: "NVIDIA Gpu - Ubuntu"
include_tasks: nvidia-gpu-Ubuntu.yaml
when: ansible_distribution == "Ubuntu"

# disable with these instructions https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#runfile-nouveau
Expand Down Expand Up @@ -117,6 +117,7 @@
--no-cc-version-check
args:
chdir: "{{ nvidia_remote_bundle_path }}/NVIDIA-Linux-x86_64-{{ nvidia_driver_version }}"
become: yes # solves for this ERROR: nvidia-installer must be run as root

- name: Create ld.so conf dir
file:
Expand Down
17 changes: 17 additions & 0 deletions images/ami/ubuntu-2204.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
build_name: "ubuntu-22"
packer_builder_type: "amazon"
python_path: ""
# The latest cloud-init version is unable to run #boothook created by CAPA https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/5115
# This is a workaround to downgrade to older cloud-init version.
# https://github.com/kubernetes-sigs/image-builder/pull/1590/files
pinned_debs: ["cloud-init=23.1.2-0ubuntu0~22.04.1"]
packer:
ami_filter_name: "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*"
ami_filter_owners: "099720109477"
source_ami: ""
distribution: "Ubuntu"
distribution_version: "22.04"
ssh_username: "ubuntu"
root_device_name: "/dev/sda1"
volume_size: "15"

0 comments on commit 105d58e

Please sign in to comment.