aboutsummaryrefslogtreecommitdiffstats
path: root/fdio.infra.terraform/terraform-nomad-vpp-device
diff options
context:
space:
mode:
Diffstat (limited to 'fdio.infra.terraform/terraform-nomad-vpp-device')
-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/fdio/main.tf16
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/fdio/providers.tf13
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/fdio/variables.tf47
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf15
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/main.tf20
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/variables.tf43
-rw-r--r--fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf9
8 files changed, 241 insertions, 0 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/fdio/main.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf
new file mode 100644
index 0000000000..a6217d781f
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/main.tf
@@ -0,0 +1,16 @@
+module "vpp-device" {
+ providers = {
+ nomad = nomad.yul1
+ }
+ source = "../"
+
+ # nomad
+ datacenters = ["yul1"]
+ 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"
+}
+
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/providers.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/providers.tf
new file mode 100644
index 0000000000..42a6a45ce0
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/providers.tf
@@ -0,0 +1,13 @@
+provider "nomad" {
+ address = var.nomad_provider_address
+ alias = "yul1"
+ # ca_file = var.nomad_provider_ca_file
+ # cert_file = var.nomad_provider_cert_file
+ # key_file = var.nomad_provider_key_file
+}
+
+provider "vault" {
+ address = var.vault_provider_address
+ skip_tls_verify = var.vault_provider_skip_tls_verify
+ token = var.vault_provider_token
+} \ No newline at end of file
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/variables.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/variables.tf
new file mode 100644
index 0000000000..569ba29c87
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/variables.tf
@@ -0,0 +1,47 @@
+variable "nomad_acl" {
+ description = "Nomad ACLs enabled/disabled."
+ type = bool
+ default = false
+}
+
+variable "nomad_provider_address" {
+ description = "FD.io Nomad cluster address."
+ type = string
+ default = "http://10.30.51.23:4646"
+}
+
+variable "nomad_provider_ca_file" {
+ description = "A local file path to a PEM-encoded certificate authority."
+ type = string
+ default = "/etc/nomad.d/ssl/nomad-ca.pem"
+}
+
+variable "nomad_provider_cert_file" {
+ description = "A local file path to a PEM-encoded certificate."
+ type = string
+ default = "/etc/nomad.d/ssl/nomad-cli.pem"
+}
+
+variable "nomad_provider_key_file" {
+ description = "A local file path to a PEM-encoded private key."
+ type = string
+ default = "/etc/nomad.d/ssl/nomad-cli-key.pem"
+}
+
+variable "vault_provider_address" {
+ description = "Vault cluster address."
+ type = string
+ default = "http://10.30.51.23:8200"
+}
+
+variable "vault_provider_skip_tls_verify" {
+ description = "Verification of the Vault server's TLS certificate."
+ type = bool
+ default = false
+}
+
+variable "vault_provider_token" {
+ description = "Vault root token."
+ type = string
+ sensitive = true
+} \ 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
new file mode 100644
index 0000000000..fc5a3ab12d
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/fdio/versions.tf
@@ -0,0 +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.20"
+ }
+ }
+ 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
new file mode 100644
index 0000000000..b176172d00
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/main.tf
@@ -0,0 +1,20 @@
+locals {
+ datacenters = join(",", var.datacenters)
+}
+
+resource "nomad_job" "nomad_job" {
+ jobspec = templatefile(
+ "${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,
+ memory = var.memory,
+ image_aarch64 = var.image_aarch64,
+ image_x86_64 = var.image_x86_64
+ }
+ )
+ detach = false
+}
+
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/variables.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/variables.tf
new file mode 100644
index 0000000000..0a11e1da3b
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/variables.tf
@@ -0,0 +1,43 @@
+# Nomad
+variable "datacenters" {
+ description = "Specifies the list of DCs to be considered placing this task"
+ type = list(string)
+ default = ["dc1"]
+}
+
+# CSIT SHIM
+variable "job_name" {
+ description = "CSIT SHIM job name"
+ type = string
+ default = "prod-csit-shim"
+}
+
+variable "group_count" {
+ description = "Number of CSIT SHIM group instances"
+ type = number
+ default = 1
+}
+
+variable "cpu" {
+ description = "CSIT SHIM task CPU"
+ type = number
+ default = 2000
+}
+
+variable "memory" {
+ description = "CSIT SHIM task memory"
+ type = number
+ default = 10000
+}
+
+variable "image_aarch64" {
+ description = "CSIT SHIM AARCH64 docker image"
+ type = string
+ default = "fdiotools/csit_shim-ubuntu2004:prod-aarch64"
+}
+
+variable "image_x86_64" {
+ description = "CSIT SHIM X86_64 docker image"
+ type = string
+ default = "fdiotools/csit_shim-ubuntu2004:prod-x86_64"
+} \ No newline at end of file
diff --git a/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf b/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf
new file mode 100644
index 0000000000..f40435fe77
--- /dev/null
+++ b/fdio.infra.terraform/terraform-nomad-vpp-device/versions.tf
@@ -0,0 +1,9 @@
+terraform {
+ required_providers {
+ nomad = {
+ source = "hashicorp/nomad"
+ version = ">= 1.4.20"
+ }
+ }
+ required_version = ">= 1.5.4"
+}