Skip to content

Commit e83cea4

Browse files
robo-caphyder
authored andcommitted
Add support for burstable bastion and operator
1 parent 24c0f7d commit e83cea4

File tree

6 files changed

+42
-22
lines changed

6 files changed

+42
-22
lines changed

examples/bastion/vars-bastion.auto.tfvars

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ bastion_upgrade = false # true/*false
1515
bastion_user = "opc"
1616

1717
bastion_shape = {
18-
shape = "VM.Standard.E4.Flex",
19-
ocpus = 1,
20-
memory = 4,
21-
boot_volume_size = 50
18+
shape = "VM.Standard.E4.Flex",
19+
ocpus = 1,
20+
memory = 4,
21+
boot_volume_size = 50
22+
baseline_ocpu_utilization = "100" # accepted values: 100/50/12.5. Supported only with burstable shapes.
2223
}

examples/operator/vars-operator.auto.tfvars

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ operator_user = "opc"
1616
operator_volume_kms_key_id = null
1717

1818
operator_shape = {
19-
shape = "VM.Standard.E4.Flex",
20-
ocpus = 1,
21-
memory = 4,
22-
boot_volume_size = 50
19+
shape = "VM.Standard.E4.Flex",
20+
ocpus = 1,
21+
memory = 4,
22+
boot_volume_size = 50
23+
baseline_ocpu_utilization = "100" # accepted values: 100/50/12.5. Supported only with burstable shapes.
2324
}

modules/bastion/compute.tf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ locals {
66
memory = tonumber(lookup(var.shape, "memory", 4))
77
ocpus = max(1, tonumber(lookup(var.shape, "ocpus", 1)))
88
shape = lookup(var.shape, "shape", "VM.Standard.E4.Flex")
9+
10+
baseline_ocpu_utilization_map = {
11+
"12.5" = "BASELINE_1_8"
12+
"50" = "BASELINE_1_2"
13+
"100" = "BASELINE_1_1"
14+
}
15+
baseline_ocpu_utilization = lookup(local.baseline_ocpu_utilization_map, lookup(var.shape, "baseline_ocpu_utilization", "100"))
916
}
1017

1118
output "id" {
@@ -51,8 +58,9 @@ resource "oci_core_instance" "bastion" {
5158
dynamic "shape_config" {
5259
for_each = length(regexall("Flex", local.shape)) > 0 ? [1] : []
5360
content {
54-
ocpus = local.ocpus
55-
memory_in_gbs = (local.memory / local.ocpus) > 64 ? (local.ocpus * 4) : local.memory
61+
baseline_ocpu_utilization = local.baseline_ocpu_utilization
62+
ocpus = local.ocpus
63+
memory_in_gbs = (local.memory / local.ocpus) > 64 ? (local.ocpus * 4) : local.memory
5664
}
5765
}
5866

modules/operator/compute.tf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ locals {
66
memory = lookup(var.shape, "memory", 4)
77
ocpus = max(1, lookup(var.shape, "ocpus", 1))
88
shape = lookup(var.shape, "shape", "VM.Standard.E4.Flex")
9+
10+
baseline_ocpu_utilization_map = {
11+
"12.5" = "BASELINE_1_8"
12+
"50" = "BASELINE_1_2"
13+
"100" = "BASELINE_1_1"
14+
}
15+
baseline_ocpu_utilization = lookup(local.baseline_ocpu_utilization_map, lookup(var.shape, "baseline_ocpu_utilization", "100"))
916
}
1017

1118
output "id" {
@@ -61,8 +68,9 @@ resource "oci_core_instance" "operator" {
6168
dynamic "shape_config" {
6269
for_each = length(regexall("Flex", local.shape)) > 0 ? [1] : []
6370
content {
64-
ocpus = local.ocpus
65-
memory_in_gbs = (local.memory / local.ocpus) > 64 ? (local.ocpus * 4) : local.memory
71+
baseline_ocpu_utilization = local.baseline_ocpu_utilization
72+
ocpus = local.ocpus
73+
memory_in_gbs = (local.memory / local.ocpus) > 64 ? (local.ocpus * 4) : local.memory
6674
}
6775
}
6876

variables-bastion.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@ variable "bastion_image_os_version" {
6767

6868
variable "bastion_shape" {
6969
default = {
70-
shape = "VM.Standard.E4.Flex",
71-
ocpus = 1,
72-
memory = 4,
73-
boot_volume_size = 50
70+
shape = "VM.Standard.E4.Flex",
71+
ocpus = 1,
72+
memory = 4,
73+
boot_volume_size = 50,
74+
baseline_ocpu_utilization = 100
7475
}
75-
description = "The shape of bastion instance."
76+
description = "The shape of bastion instance. Baseline OCPU utilization can be used to provision <a href=https://docs.oracle.com/en-us/iaas/Content/Compute/References/burstable-instances.htm>burstable shapes.</a>"
7677
type = map(any)
7778
}
7879

variables-operator.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,13 @@ variable "operator_install_stern" {
115115

116116
variable "operator_shape" {
117117
default = {
118-
shape = "VM.Standard.E4.Flex",
119-
ocpus = 1,
120-
memory = 4,
121-
boot_volume_size = 50
118+
shape = "VM.Standard.E4.Flex",
119+
ocpus = 1,
120+
memory = 4,
121+
boot_volume_size = 50,
122+
baseline_ocpu_utilization = 100
122123
}
123-
description = "Shape of the created operator instance."
124+
description = "Shape of the created operator instance. Baseline OCPU utilization can be used to provision <a href=https://docs.oracle.com/en-us/iaas/Content/Compute/References/burstable-instances.htm>burstable shapes.</a>"
124125
type = map(any)
125126
}
126127

0 commit comments

Comments
 (0)