Skip to content

Commit ee073d0

Browse files
authored
Merge pull request #83 from equinix/metros
add support for metros
2 parents c0fd522 + b70a853 commit ee073d0

22 files changed

+106
-48
lines changed

.github/workflows/integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
TF_VERSION: ${{ matrix.tf }}
1919
TF_VAR_control_plane_node_count: 0
2020
TF_VAR_count_x86: 1
21-
TF_VAR_count_arm: 1
21+
TF_VAR_count_arm: 0
2222
KUBERNETES_VERSION: 1.21.0
2323
TF_VAR_kubernetes_version: 1.21.0-00
2424
# TODO only provide this to terraform steps that need it
2525
TF_VAR_auth_token: ${{ secrets.METAL_AUTH_TOKEN }}
2626
strategy:
2727
matrix:
2828
os: [ubuntu-latest]
29-
tf: [0.13.2]
29+
tf: [0.14.10]
3030
steps:
3131
- name: Checkout from Github
3232
uses: actions/checkout@v2

.github/workflows/terraform.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
strategy:
2424
matrix:
2525
os: [ubuntu-latest]
26-
tf: [0.13.2]
26+
tf: [0.14.10]
2727
steps:
2828
- name: Checkout from Github
2929
uses: actions/checkout@v2

.terraform.lock.hcl

Lines changed: 34 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This project configures your cluster with:
1414

1515
The only required variables are `auth_token` (your [Equinix Metal API](https://metal.equinix.com/developers/api/) key), `count_x86` (the number of x86 devices), and `count_arm` (ARM devices).
1616

17-
Other options include `secrets_encryption` (`"yes"` configures your controller with encryption for secrets--this is disabled by default), and fields like `facility` (the Equinix Metal location to deploy to) and `plan_x86` or `plan_arm` (to determine the server type of these architectures) can be specified as well. Refer to `vars.tf` for a complete catalog of tunable options.
17+
Other options include `secrets_encryption` (`"yes"` configures your controller with encryption for secrets--this is disabled by default), and fields like `facility` and `metro` (the Equinix Metal location to deploy to) and `plan_x86` or `plan_arm` (to determine the server type of these architectures) can be specified as well. Refer to `vars.tf` for a complete catalog of tunable options.
1818

1919
## Getting Started
2020

examples/controller_pool.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module "controller_pool_primary" {
1010
count_gpu = var.count_gpu
1111
plan_primary = var.plan_primary
1212
facility = var.facility
13+
metro = var.metro
1314
cluster_name = var.cluster_name
1415
kubernetes_lb_block = metal_reserved_ip_block.kubernetes.cidr_notation
1516
project_id = var.project_id

examples/gpu-node_pool.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module "node_pool_gpu_green" {
77
count_gpu = var.count_gpu
88
plan_gpu = var.plan_gpu
99
facility = var.facility
10+
metro = var.metro
1011
cluster_name = var.cluster_name
1112
controller_address = metal_device.k8s_primary.network.0.address
1213
project_id = var.project_id

examples/new_node_pool.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module "node_pool_green" {
1212
plan_x86 = var.plan_x86
1313
plan_arm = var.plan_arm
1414
facility = var.facility
15+
metro = var.metro
1516
cluster_name = var.cluster_name
1617
controller_address = metal_device.k8s_primary.network.0.address
1718
project_id = metal_project.kubernetes_multiarch.id

kubernetes-controller-pool.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ resource "metal_ssh_key" "kubernetes-on-metal" {
3030

3131
resource "metal_reserved_ip_block" "kubernetes" {
3232
project_id = var.metal_create_project ? metal_project.new_project[0].id : var.project_id
33-
facility = var.facility
33+
facility = var.facility != "" ? var.facility : null
34+
metro = var.metro != "" ? var.metro : null
3435
quantity = 4
3536
}
3637

@@ -43,6 +44,7 @@ module "controllers" {
4344
count_gpu = var.count_gpu
4445
plan_primary = var.plan_primary
4546
facility = var.facility
47+
metro = var.metro
4648
cluster_name = var.cluster_name
4749
kubernetes_lb_block = metal_reserved_ip_block.kubernetes.cidr_notation
4850
project_id = var.metal_create_project ? metal_project.new_project[0].id : var.project_id
@@ -53,7 +55,7 @@ module "controllers" {
5355
workloads = var.workloads
5456
skip_workloads = var.skip_workloads
5557
control_plane_node_count = var.control_plane_node_count
56-
ssh_private_key_path = local_file.cluster_private_key_pem.filename
58+
ssh_private_key_path = abspath(local_file.cluster_private_key_pem.filename)
5759
ccm_enabled = var.ccm_enabled
5860
loadbalancer_type = var.loadbalancer_type
5961
}

kubernetes-node-pool.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ module "node_pool_blue" {
99
plan_x86 = var.plan_x86
1010
plan_arm = var.plan_arm
1111
facility = var.facility
12+
metro = var.metro
1213
cluster_name = var.cluster_name
1314
controller_address = module.controllers.controller_addresses
1415
project_id = var.metal_create_project ? metal_project.new_project[0].id : var.project_id
@@ -26,6 +27,7 @@ module "node_pool_gpu_green" {
2627
count_gpu = var.count_gpu
2728
plan_gpu = var.plan_gpu
2829
facility = var.facility
30+
metro = var.metro
2931
cluster_name = var.cluster_name
3032
controller_address = module.controllers.controller_addresses
3133
project_id = var.metal_create_project ? metal_project.new_project[0].id : var.project_id

modules/controller_pool/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ resource "metal_device" "k8s_primary" {
3030
hostname = "${var.cluster_name}-controller-primary"
3131
operating_system = "ubuntu_18_04"
3232
plan = var.plan_primary
33-
facilities = [var.facility]
33+
facilities = var.facility != "" ? [var.facility] : null
34+
metro = var.metro != "" ? var.metro : null
3435
user_data = data.template_file.controller-primary.rendered
3536
tags = ["kubernetes", "controller-${var.cluster_name}"]
3637

@@ -56,7 +57,8 @@ resource "metal_device" "k8s_controller_standby" {
5657
hostname = format("${var.cluster_name}-controller-standby-%02d", count.index)
5758
operating_system = "ubuntu_18_04"
5859
plan = var.plan_primary
59-
facilities = [var.facility]
60+
facilities = var.facility != "" ? [var.facility] : null
61+
metro = var.metro != "" ? var.metro : null
6062
user_data = data.template_file.controller-standby.rendered
6163
tags = ["kubernetes", "controller-${var.cluster_name}"]
6264
billing_cycle = "hourly"

0 commit comments

Comments
 (0)