Remove exposure of qemu ip_range_start value

This commit is contained in:
katexochen 2022-09-27 10:47:45 +02:00 committed by Paul Meyer
parent ed78c48ed4
commit ccbc3d9123
9 changed files with 17 additions and 42 deletions

View file

@ -25,7 +25,7 @@ provider "docker" {
}
resource "docker_image" "qemu-metadata" {
name = "${var.metadata_api_image}"
name = var.metadata_api_image
keep_locally = true
}
@ -34,7 +34,7 @@ resource "docker_container" "qemu-metadata" {
image = docker_image.qemu-metadata.latest
network_mode = "host"
rm = true
command = [
command = [
"--network",
"${var.name}-network",
]
@ -52,7 +52,6 @@ module "control_plane" {
vcpus = var.vcpus
memory = var.memory
state_disk_size = var.state_disk_size
ip_range_start = var.ip_range_start
cidr = "10.42.1.0/24"
network_id = libvirt_network.constellation.id
pool = libvirt_pool.cluster.name
@ -68,7 +67,6 @@ module "worker" {
vcpus = var.vcpus
memory = var.memory
state_disk_size = var.state_disk_size
ip_range_start = var.ip_range_start
cidr = "10.42.2.0/24"
network_id = libvirt_network.constellation.id
pool = libvirt_pool.cluster.name

View file

@ -9,6 +9,7 @@ terraform {
locals {
state_disk_size_byte = 1073741824 * var.state_disk_size
ip_range_start = 100
}
resource "libvirt_domain" "instance_group" {
@ -44,7 +45,7 @@ resource "libvirt_domain" "instance_group" {
network_interface {
network_id = var.network_id
hostname = "${var.role}-${count.index}"
addresses = [cidrhost(var.cidr, var.ip_range_start + count.index)]
addresses = [cidrhost(var.cidr, local.ip_range_start + count.index)]
wait_for_lease = true
}
console {

View file

@ -18,11 +18,6 @@ variable "state_disk_size" {
description = "size of state disk (GiB)"
}
variable "ip_range_start" {
type = number
description = "first ip address to use within subnet"
}
variable "cidr" {
type = string
description = "subnet to use for dhcp"

View file

@ -34,11 +34,6 @@ variable "state_disk_size" {
description = "size of state disk (GiB)"
}
variable "ip_range_start" {
type = number
description = "first ip address to use within subnet"
}
variable "machine" {
type = string
default = "q35"

View file

@ -45,7 +45,6 @@ func TestCreateCluster(t *testing.T) {
},
CPUCount: 1,
MemorySizeMiB: 1024,
IPRangeStart: 100,
ImagePath: "path",
ImageFormat: "format",
MetadataAPIImage: "api",

View file

@ -88,8 +88,6 @@ type QEMUVariables struct {
// MemorySizeMiB is the amount of memory to allocate to each node, in MiB.
MemorySizeMiB int
// IPRangeStart is the first IP address in the IP range to allocate to the cluster.
IPRangeStart int
// ImagePath is the path to the image to use for the nodes.
ImagePath string
// ImageFormat is the format of the image from ImagePath.
ImageFormat string
@ -105,7 +103,6 @@ func (v *QEMUVariables) String() string {
writeLinef(b, "image_format = %q", v.ImageFormat)
writeLinef(b, "vcpus = %d", v.CPUCount)
writeLinef(b, "memory = %d", v.MemorySizeMiB)
writeLinef(b, "ip_range_start = %d", v.IPRangeStart)
writeLinef(b, "metadata_api_image = %q", v.MetadataAPIImage)
return b.String()