Model server groups and add anti-affinity for vms not being scheduled on the same host.
This commit is contained in:
parent
1a2a483336
commit
4ab30f3fa6
19
main.tf
19
main.tf
|
@ -13,6 +13,16 @@ required_version = ">= 0.14.0"
|
|||
provider "openstack" {
|
||||
cloud = "sto4-rut"
|
||||
}
|
||||
resource "openstack_compute_servergroup_v2" "workers" {
|
||||
name = "workers"
|
||||
policies = ["anti-affinity"]
|
||||
}
|
||||
resource "openstack_compute_servergroup_v2" "controllers" {
|
||||
name = "controllers"
|
||||
policies = ["anti-affinity"]
|
||||
}
|
||||
|
||||
|
||||
resource "openstack_networking_secgroup_v2" "microk8s" {
|
||||
name = "microk8s"
|
||||
description = "Traffic to allow between microk8s hosts"
|
||||
|
@ -189,6 +199,7 @@ resource "openstack_compute_instance_v2" "controller-nodes" {
|
|||
flavor_name = "${var.controller_instance_type}"
|
||||
key_pair = "mifr-yubi"
|
||||
security_groups = ["microk8s", "Allow SSH from SUNET jumphosts", "Allow ssh from the world"]
|
||||
|
||||
|
||||
block_device {
|
||||
uuid = "5d24aca9-11be-4de1-9770-4a097d68f361"
|
||||
|
@ -198,7 +209,9 @@ resource "openstack_compute_instance_v2" "controller-nodes" {
|
|||
destination_type = "volume"
|
||||
delete_on_termination = true
|
||||
}
|
||||
|
||||
scheduler_hints {
|
||||
group = openstack_compute_servergroup_v2.controllers.id
|
||||
}
|
||||
network {
|
||||
name = "public"
|
||||
}
|
||||
|
@ -218,7 +231,9 @@ resource "openstack_compute_instance_v2" "worker-nodes" {
|
|||
destination_type = "volume"
|
||||
delete_on_termination = true
|
||||
}
|
||||
|
||||
scheduler_hints {
|
||||
group = openstack_compute_servergroup_v2.workers.id
|
||||
}
|
||||
network {
|
||||
name = "public"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue