Skip to content

Commit cda7418

Browse files
authored
Merge pull request #821 from shyamradhakrishnan/task/oci_arm_support
Add support for Arm based images in OCI
2 parents a4b1c8e + 0f79ce4 commit cda7418

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

docs/book/src/capi/providers/oci.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## Building Images
1010

1111
The build [prerequisites](../capi.md#prerequisites) for using `image-builder` for
12-
building OCI images are managed by running:
12+
building OCI images are managed by running the following command from images/capi directory.
1313

1414
```bash
1515
make deps-oci
@@ -52,7 +52,7 @@ Create a file with the following contents and name it as `oci.json`
5252
{
5353
"compartment_ocid": "Fill compartment OCID here",
5454
"subnet_ocid": "Fill Subnet OCID here",
55-
"availability_domain": "Fill Availbility Domain here"
55+
"availability_domain": "Fill Availability Domain here"
5656
}
5757
```
5858

@@ -61,3 +61,23 @@ Create a file with the following contents and name it as `oci.json`
6161
```bash
6262
PACKER_VAR_FILES=oci.json make build-oci-oracle-linux-8
6363
```
64+
65+
#### Build an Arm based image
66+
67+
Building an Arm based image requires some overrides to use the correct installation files . An example for an
68+
`oci.json` file for Arm is shown below. The parameters for containerd, crictl and kubernetes
69+
has to point to the corresponding URL for Arm. The containerd SHA can be changed appropriately, the containerd version
70+
is defined in images/capi/packer/config/containerd.json.
71+
72+
```json
73+
{
74+
"compartment_ocid": "Fill compartment OCID here",
75+
"subnet_ocid": "Fill Subnet OCID here",
76+
"availability_domain": "Fill Availability Domain here",
77+
"shape": "VM.Standard.A1.Flex",
78+
"containerd_url": "https://github.com/containerd/containerd/releases/download/v{{user `containerd_version`}}/cri-containerd-cni-{{user `containerd_version`}}-linux-arm64.tar.gz",
79+
"crictl_url": "https://github.com/kubernetes-sigs/cri-tools/releases/download/v{{user `crictl_version`}}/crictl-v{{user `crictl_version`}}-linux-arm64.tar.gz",
80+
"kubernetes_rpm_repo": "https://packages.cloud.google.com/yum/repos/kubernetes-el7-aarch64",
81+
"containerd_sha256": "9ac616b5f23c1d10353bd45b26cb736efa75dfef31a2113baff2435dbc7becb8"
82+
}
83+
```

images/capi/ansible/roles/node/meta/main.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ dependencies:
1919
debs: "{{ common_debs }}"
2020
when: ansible_distribution == "Amazon"
2121

22+
- role: setup
23+
vars:
24+
rpms: "{{ common_rpms }}"
25+
debs: "{{ common_debs }}"
26+
when: packer_builder_type == "oracle-oci" and ansible_architecture == "aarch64"
27+
2228
- role: setup
2329
vars:
2430
rpms: "{{ ( common_photon_rpms + lookup('vars', 'common_' + build_target + '_photon_rpms') ) if ansible_os_family == 'VMware Photon OS' else ( ( common_rpms + rh7_rpms + lookup('vars', 'common_' + build_target + '_rpms') ) if (ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7') else ( common_rpms + rh8_rpms + lookup('vars', 'common_' + build_target + '_rpms') ) ) }}"
2531
debs: "{{ common_debs + lookup('vars', 'common_' + build_target + '_debs') }}"
26-
when: ansible_distribution != "Amazon"
32+
when: ansible_distribution != "Amazon" and not (packer_builder_type == "oracle-oci" and ansible_architecture == "aarch64")

images/capi/ansible/roles/setup/tasks/debian.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
src: etc/apt/sources.list.j2
1818
dest: /etc/apt/sources.list
1919
mode: 0644
20+
# OCI Base images have the required apt sources list embedded inside the image, adding the sources list
21+
# from this repo leads to build failures(especially in Arm), hence ignoring the step.
22+
when: packer_builder_type != "oracle-oci"
2023

2124
- name: Put templated apt.conf.d/90proxy in place when defined
2225
template:

0 commit comments

Comments
 (0)