aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.terraform')
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/device-shim.hcl.tftpl78
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/vpp-device.hcl.tftpl188
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf11
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf12
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/main.tf23
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf4
6 files changed, 107 insertions, 209 deletions
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/device-shim.hcl.tftpl b/fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/device-shim.hcl.tftpl
new file mode 100644
index 0000000000..28e38a2d0b
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/device-shim.hcl.tftpl
@@ -0,0 +1,78 @@
+job "${job_name}" {
+ datacenters = ["${datacenters}"]
+ type = "system"
+ group "${job_name}-amd" {
+ count = ${group_count}
+ constraint {
+ attribute = "$${node.class}"
+ value = "csit"
+ }
+ restart {
+ interval = "1m"
+ attempts = 3
+ delay = "15s"
+ mode = "delay"
+ }
+ network {
+ port "ssh" {
+ static = 6022
+ }
+ port "ssh2" {
+ static = 6023
+ }
+ }
+ task "${job_name}-amd" {
+ driver = "docker"
+ config {
+ image = "${image_x86_64}"
+ network_mode = "host"
+ pid_mode = "host"
+ volumes = [
+ "/var/run/docker.sock:/var/run/docker.sock"
+ ]
+ privileged = true
+ }
+ resources {
+ cpu = ${cpu}
+ memory = ${memory}
+ }
+ }
+ }
+ group "${job_name}-arm" {
+ count = ${group_count}
+ constraint {
+ attribute = "$${node.class}"
+ value = "csitarm"
+ }
+ restart {
+ interval = "1m"
+ attempts = 3
+ delay = "15s"
+ mode = "delay"
+ }
+ network {
+ port "ssh" {
+ static = 6022
+ }
+ port "ssh2" {
+ static = 6023
+ }
+ }
+ task "${job_name}-arm" {
+ driver = "docker"
+ config {
+ image = "${image_aarch64}"
+ network_mode = "host"
+ pid_mode = "host"
+ volumes = [
+ "/var/run/docker.sock:/var/run/docker.sock"
+ ]
+ privileged = true
+ }
+ resources {
+ cpu = ${cpu}
+ memory = ${memory}
+ }
+ }
+ }
+}
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/vpp-device.hcl.tftpl b/fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/vpp-device.hcl.tftpl
deleted file mode 100644
index aac1a46165..0000000000
--- a/fdio.infra.terraform/terraform-nomad-vpp-device/conf/nomad/vpp-device.hcl.tftpl
+++ /dev/null
@@ -1,188 +0,0 @@
-job "${job_name}" {
- # The "region" parameter specifies the region in which to execute the job.
- # If omitted, this inherits the default region name of "global".
- # region = "global"
- #
- # The "datacenters" parameter specifies the list of datacenters which should
- # be considered when placing this task. This must be provided.
- datacenters = "${datacenters}"
-
- # The "type" parameter controls the type of job, which impacts the scheduler's
- # decision on placement. This configuration is optional and defaults to
- # "service". For a full list of job types and their differences, please see
- # the online documentation.
- #
- type = "system"
-
- # The "group" stanza defines a series of tasks that should be co-located on
- # the same Nomad client. Any task within a group will be placed on the same
- # client.
- #
- # https://www.nomadproject.io/docs/job-specification/group
- #
- group "csit-shim-amd-group-1" {
- # The "count" parameter specifies the number of the task groups that should
- # be running under this group. This value must be non-negative.
- count = ${group_count}
-
- # The constraint allows restricting the set of eligible nodes. Constraints
- # may filter on attributes or client metadata.
- #
- # https://www.nomadproject.io/docs/job-specification/constraint
- #
- constraint {
- attribute = "$${node.class}"
- value = "csit"
- }
-
- # The restart stanza configures a tasks's behavior on task failure. Restarts
- # happen on the client that is running the task.
- #
- # https://www.nomadproject.io/docs/job-specification/restart
- #
- restart {
- interval = "1m"
- attempts = 3
- delay = "15s"
- mode = "delay"
- }
-
- # The network stanza specifies the networking requirements for the task
- # group, including the network mode and port allocations. When scheduling
- # jobs in Nomad they are provisioned across your fleet of machines along
- # with other jobs and services. Because you don't know in advance what host
- # your job will be provisioned on, Nomad will provide your tasks with
- # network configuration when they start up.
- #
- # https://www.nomadproject.io/docs/job-specification/network
- #
- network {
- port "ssh" {
- static = 6022
- }
- port "ssh2" {
- static = 6023
- }
- }
-
- # The "task" stanza creates an individual unit of work, such as a Docker
- # container, web application, or batch processing.
- #
- # https://www.nomadproject.io/docs/job-specification/task
- #
- task "csit-shim-amd-task-1" {
- # The "driver" parameter specifies the task driver that should be used to
- # run the task.
- driver = "docker"
-
- # The "config" stanza specifies the driver configuration, which is passed
- # directly to the driver to start the task. The details of configurations
- # are specific to each driver, so please see specific driver
- # documentation for more information.
- config {
- image = "${image_x86_64}"
- network_mode = "host"
- pid_mode = "host"
- volumes = [
- "/var/run/docker.sock:/var/run/docker.sock"
- ]
- privileged = true
- }
-
- # The "resources" stanza describes the requirements a task needs to
- # execute. Resource requirements include memory, network, cpu, and more.
- # This ensures the task will execute on a machine that contains enough
- # resource capacity.
- #
- # https://www.nomadproject.io/docs/job-specification/resources
- #
- resources {
- cpu = ${cpu}
- memory = ${memory}
- }
- }
- }
-
- group "csit-shim-arm-group-1" {
- # The "count" parameter specifies the number of the task groups that should
- # be running under this group. This value must be non-negative.
- count = ${group_count}
-
- # The constraint allows restricting the set of eligible nodes. Constraints
- # may filter on attributes or client metadata.
- #
- # https://www.nomadproject.io/docs/job-specification/constraint
- #
- constraint {
- attribute = "$${node.class}"
- value = "csitarm"
- }
-
- # The restart stanza configures a tasks's behavior on task failure. Restarts
- # happen on the client that is running the task.
- #
- # https://www.nomadproject.io/docs/job-specification/restart
- #
- restart {
- interval = "1m"
- attempts = 3
- delay = "15s"
- mode = "delay"
- }
-
- # The network stanza specifies the networking requirements for the task
- # group, including the network mode and port allocations. When scheduling
- # jobs in Nomad they are provisioned across your fleet of machines along
- # with other jobs and services. Because you don't know in advance what host
- # your job will be provisioned on, Nomad will provide your tasks with
- # network configuration when they start up.
- #
- # https://www.nomadproject.io/docs/job-specification/network
- #
- network {
- port "ssh" {
- static = 6022
- }
- port "ssh2" {
- static = 6023
- }
- }
-
- # The "task" stanza creates an individual unit of work, such as a Docker
- # container, web application, or batch processing.
- #
- # https://www.nomadproject.io/docs/job-specification/task
- #
- task "csit-shim-arm-task-1" {
- # The "driver" parameter specifies the task driver that should be used to
- # run the task.
- driver = "docker"
-
- # The "config" stanza specifies the driver configuration, which is passed
- # directly to the driver to start the task. The details of configurations
- # are specific to each driver, so please see specific driver
- # documentation for more information.
- config {
- image = "${image_aarch64}"
- network_mode = "host"
- pid_mode = "host"
- volumes = [
- "/var/run/docker.sock:/var/run/docker.sock"
- ]
- privileged = true
- }
-
- # The "resources" stanza describes the requirements a task needs to
- # execute. Resource requirements include memory, network, cpu, and more.
- # This ensures the task will execute on a machine that contains enough
- # resource capacity.
- #
- # https://www.nomadproject.io/docs/job-specification/resources
- #
- resources {
- cpu = ${cpu}
- memory = ${memory}
- }
- }
- }
-} \ No newline at end of file
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf
index 96666e6e89..a6217d781f 100644
--- a/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf
@@ -6,10 +6,11 @@ module "vpp-device" {
# nomad
datacenters = ["yul1"]
- job_name = "prod-device-csit-shim"
- group_count = "1"
- cpu = "1500"
- memory = "4096"
+ job_name = "device-shim"
+ group_count = 1
+ cpu = 1500
+ memory = 4096
image_aarch64 = "fdiotools/csit_shim-ubuntu2004:2021_03_02_143938_UTC-aarch64"
image_x86_64 = "fdiotools/csit_shim-ubuntu2004:2021_03_04_142103_UTC-x86_64"
-} \ No newline at end of file
+}
+
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf
index 82b792fd72..fc5a3ab12d 100644
--- a/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf
@@ -1,9 +1,15 @@
terraform {
+ backend "consul" {
+ address = "10.30.51.23:8500"
+ scheme = "http"
+ path = "terraform/device-csit-shim"
+ }
required_providers {
nomad = {
source = "hashicorp/nomad"
- version = ">= 1.4.19"
+ version = ">= 1.4.20"
}
}
- required_version = ">= 1.3.7"
-} \ No newline at end of file
+ required_version = ">= 1.5.4"
+}
+
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/main.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/main.tf
index 2e67085714..b176172d00 100644
--- a/fdio.infra.terraform/terraform-nomad-vpp-device/main.tf
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/main.tf
@@ -2,18 +2,19 @@ locals {
datacenters = join(",", var.datacenters)
}
-resource "nomad_job" "nomad_job_csit_shim" {
+resource "nomad_job" "nomad_job" {
jobspec = templatefile(
- "${path.module}/conf/nomad/vpp-device.hcl.tftpl",
+ "${path.module}/conf/nomad/${var.job_name}.hcl.tftpl",
{
- datacenters = local.datacenters
- job_name = var.job_name
- group_count = var.group_count
- cpu = var.cpu
- mem = var.memory
- image_aarch64 = var.image_aarch64
- image_x86_64 = var.image_x86_64
+ datacenters = local.datacenters,
+ job_name = var.job_name,
+ group_count = var.group_count,
+ cpu = var.cpu,
+ memory = var.memory,
+ image_aarch64 = var.image_aarch64,
+ image_x86_64 = var.image_x86_64
}
)
- detach = false
-} \ No newline at end of file
+ detach = false
+}
+
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf
index a319c35908..f40435fe77 100644
--- a/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf
@@ -2,8 +2,8 @@ terraform {
required_providers {
nomad = {
source = "hashicorp/nomad"
- version = ">= 1.4.19"
+ version = ">= 1.4.20"
}
}
- required_version = ">= 1.3.7"
+ required_version = ">= 1.5.4"
}