Skip to content

Commit 6ed70f4

Browse files
authored
aarch64 support (#239)
* aarch64 support
1 parent 0ecaec7 commit 6ed70f4

File tree

12 files changed

+48
-20
lines changed

12 files changed

+48
-20
lines changed

opentofu/locals.tf

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ locals {
88
label_prefix = var.label_prefix != "" ? lower(var.label_prefix) : lower(random_pet.label.id)
99
}
1010

11-
// Autonomous Database
12-
locals {
13-
adb_name = format("%sDB", upper(local.label_prefix))
14-
adb_whitelist_cidrs = concat(
15-
var.adb_whitelist_cidrs != "" ? split(",", replace(var.adb_whitelist_cidrs, "/\\s+/", "")) : [],
16-
[module.network.vcn_ocid]
17-
)
18-
adb_password = sensitive(format("%s%s", random_password.adb_char.result, random_password.adb_rest.result))
19-
}
20-
2111
// Availability Domains
2212
locals {
2313
ads = data.oci_identity_availability_domains.all.availability_domains
@@ -37,6 +27,25 @@ locals {
3727
])
3828
}
3929

30+
// Autonomous Database
31+
locals {
32+
adb_name = format("%sDB", upper(local.label_prefix))
33+
adb_whitelist_cidrs = concat(
34+
var.adb_whitelist_cidrs != "" ? split(",", replace(var.adb_whitelist_cidrs, "/\\s+/", "")) : [],
35+
[module.network.vcn_ocid]
36+
)
37+
adb_password = sensitive(format("%s%s", random_password.adb_char.result, random_password.adb_rest.result))
38+
}
39+
40+
// Compute
41+
locals {
42+
compute_cpu_arch = (
43+
can(regex("^VM\\.Standard\\.A[0-9]+\\.Flex$", var.compute_cpu_shape))
44+
? "aarch64"
45+
: "x86_64"
46+
)
47+
}
48+
4049
// Network
4150
locals {
4251
streamlit_client_port = 8501

opentofu/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ module "kubernetes" {
124124
k8s_cpu_node_pool_size = var.k8s_cpu_node_pool_size
125125
k8s_api_endpoint_allowed_cidrs = var.k8s_api_endpoint_allowed_cidrs
126126
k8s_run_cfgmgt = var.k8s_run_cfgmgt
127+
compute_cpu_arch = local.compute_cpu_arch
127128
compute_os_ver = local.compute_os_ver
128129
compute_cpu_ocpu = var.compute_cpu_ocpu
129130
compute_gpu_shape = var.compute_gpu_shape

opentofu/modules/kubernetes/cfgmgt.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ resource "null_resource" "apply" {
6666
local_sensitive_file.kubeconfig,
6767
local_sensitive_file.helm_values,
6868
local_sensitive_file.k8s_manifest,
69-
oci_containerengine_node_pool.default_node_pool_details,
69+
oci_containerengine_node_pool.cpu_node_pool_details,
7070
oci_containerengine_node_pool.gpu_node_pool_details,
7171
oci_containerengine_addon.oraoper_addon,
7272
oci_containerengine_addon.certmgr_addon,

opentofu/modules/kubernetes/iam.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ resource "oci_identity_dynamic_group" "workers_dynamic_group" {
88
description = format("%s Workers Dynamic Group", var.label_prefix)
99
matching_rule = format(
1010
"ALL {instance.compartment.id = '%s', tag.Oracle-Tags.CreatedBy.value = '%s'}",
11-
var.compartment_id, oci_containerengine_node_pool.default_node_pool_details.id)
11+
var.compartment_id, oci_containerengine_node_pool.cpu_node_pool_details.id)
1212
provider = oci.home_region
1313
}
1414

opentofu/modules/kubernetes/locals.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ locals {
3232
oke_worker_cpu_image = length(local.oke_worker_images) > 0 ? [
3333
for key, value in local.oke_worker_images : key if
3434
value["image_type"] == "oke" &&
35-
value["arch"] == "x86_64" &&
35+
value["arch"] == var.compute_cpu_arch &&
3636
value["os_version"] == var.compute_os_ver &&
3737
value["k8s_version"] == var.k8s_version &&
3838
!value["is_gpu"]

opentofu/modules/kubernetes/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ resource "oci_containerengine_addon" "ingress_addon" {
104104
}
105105
}
106106

107-
resource "oci_containerengine_node_pool" "default_node_pool_details" {
107+
resource "oci_containerengine_node_pool" "cpu_node_pool_details" {
108108
cluster_id = oci_containerengine_cluster.default_cluster.id
109109
compartment_id = var.compartment_id
110110
kubernetes_version = format("v%s", var.k8s_version)
111-
name = format("%s-np-default", var.label_prefix)
111+
name = format("%s-np-cpu", var.label_prefix)
112112
initial_node_labels {
113113
key = "name"
114114
value = local.k8s_cluster_name

opentofu/modules/kubernetes/templates/cloudinit-oke.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,17 @@
66
## https://docs.oracle.com/en-us/iaas/Content/Compute/Tasks/gettingmetadata.htm
77
oke_init_url='http://169.254.169.254/opc/v2/instance/metadata/oke_init_script'
88
curl --fail -H "Authorization: Bearer Oracle" -L0 "${oke_init_url}" | base64 --decode >/var/run/oke-init.sh
9+
10+
# detect architecture
11+
arch=$(uname -m)
12+
if [ "$arch" = "aarch64" ]; then
13+
binary_url="https://github.com/oracle-devrel/oke-credential-provider-for-ocir/releases/latest/download/oke-credential-provider-for-ocir-linux-arm64"
14+
else
15+
binary_url="https://github.com/oracle-devrel/oke-credential-provider-for-ocir/releases/latest/download/oke-credential-provider-for-ocir-linux-amd64"
16+
fi
17+
918
# download OCIR Access binaries on the worker node
10-
wget https://github.com/oracle-devrel/oke-credential-provider-for-ocir/releases/latest/download/oke-credential-provider-for-ocir-linux-amd64 -O /usr/local/bin/credential-provider-oke
19+
wget "$binary_url" -O /usr/local/bin/credential-provider-oke
1120
wget https://github.com/oracle-devrel/oke-credential-provider-for-ocir/releases/latest/download/credential-provider-config.yaml -P /etc/kubernetes/
1221
# add permission to execute
1322
sudo chmod 755 /usr/local/bin/credential-provider-oke

opentofu/modules/kubernetes/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,15 @@ variable "k8s_gpu_node_pool_size" {
8282
variable "compute_gpu_shape" {
8383
type = string
8484
}
85+
8586
variable "compute_os_ver" {
8687
type = string
8788
}
8889

90+
variable "compute_cpu_arch" {
91+
type = string
92+
}
93+
8994
variable "compute_cpu_shape" {
9095
type = string
9196
}

opentofu/modules/vm/templates/cloudinit-compute.tpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ package_update: false
1313
packages:
1414
- python36-oci-cli
1515
- python3.11
16+
- jre
1617
- sqlcl
1718

1819
write_files:

opentofu/schema.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,12 @@ variables:
170170
type: enum
171171
title: "CPU Worker Shape"
172172
required: true
173+
default: "VM.Standard.E5.Flex"
173174
enum:
174-
- "VM.Standard.E5.Flex"
175175
- "VM.Standard.E4.Flex"
176+
- "VM.Standard.E5.Flex"
177+
- "VM.Standard.A1.Flex"
178+
- "VM.Standard.A2.Flex"
176179
visible:
177180
or:
178181
- and:

0 commit comments

Comments
 (0)