Skip to content

Commit 2c96ce1

Browse files
authored
add support for image family (#54)
Problem: the user wants to use a custom image family, and currently the families are hard coded. Solution: add the family name as a variable. Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
1 parent 272d989 commit 2c96ce1

File tree

8 files changed

+60
-4
lines changed

8 files changed

+60
-4
lines changed

fluxfw-gcp/tf/main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
module "management_node" {
1616
source = "./modules/management"
1717
name_prefix = var.manager_name_prefix
18+
family = var.manager_family
1819

1920
project_id = var.project_id
2021
region = var.region
@@ -44,6 +45,8 @@ module "login_nodes" {
4445
region = var.region
4546

4647
name_prefix = each.value.name_prefix
48+
family = var.login_family
49+
4750
subnetwork = var.subnetwork
4851
machine_arch = each.value.machine_arch
4952
machine_type = each.value.machine_type
@@ -69,6 +72,9 @@ module "compute_nodes" {
6972
project_id = var.project_id
7073
region = var.region
7174

75+
family = var.compute_family
76+
arm_family = var.compute_arm_family
77+
7278
name_prefix = each.value.name_prefix
7379
subnetwork = var.subnetwork
7480
machine_arch = each.value.machine_arch

fluxfw-gcp/tf/modules/compute/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
data "google_compute_image" "fluxfw_compute_arm64_image" {
1616
project = var.project_id
17-
family = "flux-fw-compute-arm64"
17+
family = var.arm_family
1818
}
1919

2020
data "google_compute_image" "fluxfw_compute_x86_64_image" {
2121
project = var.project_id
22-
family = "flux-fw-compute-x86-64"
22+
family = var.family
2323
}
2424

2525
data "google_compute_zones" "available" {

fluxfw-gcp/tf/modules/compute/variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
variable "arm_family" {
16+
description = "The source arm image family prefix to use"
17+
type = string
18+
default = "flux-fw-compute-arm64"
19+
}
20+
1521
variable "automatic_restart" {
1622
type = bool
1723
description = "(Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user)."
@@ -30,6 +36,12 @@ variable "compact_placement" {
3036
default = false
3137
}
3238

39+
variable "family" {
40+
description = "The source X86 image family prefix to use"
41+
type = string
42+
default = "flux-fw-compute-x86-64"
43+
}
44+
3345
variable "gpu" {
3446
description = "The type and count of GPU(s) to attach to a compute node"
3547
type = object({

fluxfw-gcp/tf/modules/login/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
data "google_compute_image" "fluxfw_login_x86_64_image" {
1616
project = var.project_id
17-
family = "flux-fw-login-x86-64"
17+
family = var.family
1818
}
1919

2020
data "google_compute_zones" "available" {

fluxfw-gcp/tf/modules/login/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ variable "boot_script" {
1818
default = null
1919
}
2020

21+
variable "family" {
22+
description = "The source image family prefix to use"
23+
type = string
24+
default = "flux-fw-login-x86-64"
25+
}
26+
2127
variable "machine_arch" {
2228
description = "The instruction set architecture, ARM64 or x86_64, used by the login node"
2329
type = string

fluxfw-gcp/tf/modules/management/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
data "google_compute_image" "fluxfw_manager_image" {
1616
project = var.project_id
17-
family = "flux-fw-manager"
17+
family = var.family
1818
}
1919

2020
module "flux_manager_instance_template" {

fluxfw-gcp/tf/modules/management/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ variable "compute_node_specs" {
1717
type = string
1818
}
1919

20+
variable "family" {
21+
description = "The source image family prefix to use"
22+
type = string
23+
default = "flux-fw-manager"
24+
}
25+
2026
variable "login_node_specs" {
2127
description = "A JSON encoded list of maps each with the keys: 'name_prefix', 'machin_arch', 'machine_type', and 'instances' which describe the login node instances to create"
2228
type = string

fluxfw-gcp/tf/variables.tf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ variable "cluster_storage" {
1717
type = map(string)
1818
}
1919

20+
variable "compute_arm_family" {
21+
description = "The source arm image family prefix to be used by the compute node(s)"
22+
type = string
23+
default = "flux-fw-compute-arm64"
24+
}
25+
26+
variable "compute_family" {
27+
description = "The source image x86 prefix to be used by the compute node(s)"
28+
type = string
29+
default = "flux-fw-compute-x86-64"
30+
}
31+
2032
variable "compute_node_specs" {
2133
description = "A list of compute node specifications"
2234
type = list(object({
@@ -39,6 +51,14 @@ variable "compute_scopes" {
3951
type = set(string)
4052
}
4153

54+
55+
variable "login_family" {
56+
description = "The source image prefix to be used by the login node"
57+
type = string
58+
default = "flux-fw-login-x86-64"
59+
}
60+
61+
4262
variable "login_node_specs" {
4363
description = "A list of login node specifications"
4464
type = list(object({
@@ -58,6 +78,12 @@ variable "login_scopes" {
5878
type = set(string)
5979
}
6080

81+
variable "manager_family" {
82+
description = "The source image prefix to be used by the manager"
83+
type = string
84+
default = "flux-fw-manager"
85+
}
86+
6187
variable "manager_machine_type" {
6288
description = "The Compute Engine machine type to be used for the management node [note: must be an x86_64 or AMD machine type]"
6389
type = string

0 commit comments

Comments
 (0)