AB#2439 Containerized libvirt (#191)

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2022-10-05 09:11:30 +02:00 committed by GitHub
parent abe40de3e5
commit 2ea695896f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 746 additions and 50 deletions

View file

@ -12,7 +12,7 @@ terraform {
}
provider "libvirt" {
uri = "qemu:///session"
uri = var.libvirt_uri
}
provider "docker" {
@ -24,22 +24,24 @@ provider "docker" {
}
}
resource "docker_image" "qemu-metadata" {
resource "docker_image" "qemu_metadata" {
name = var.metadata_api_image
keep_locally = true
}
resource "docker_container" "qemu-metadata" {
resource "docker_container" "qemu_metadata" {
name = "${var.name}-qemu-metadata"
image = docker_image.qemu-metadata.latest
image = docker_image.qemu_metadata.latest
network_mode = "host"
rm = true
command = [
"--network",
"${var.name}-network",
"--libvirt-uri",
"${var.metadata_libvirt_uri}",
]
mounts {
source = "/var/run/libvirt/libvirt-sock"
source = abspath(var.libvirt_socket_path)
target = "/var/run/libvirt/libvirt-sock"
type = "bind"
}

View file

@ -1,3 +1,8 @@
variable "libvirt_uri" {
type = string
description = "libvirt socket uri"
}
variable "constellation_coreos_image" {
type = string
description = "constellation OS file path"
@ -45,6 +50,16 @@ variable "metadata_api_image" {
description = "container image of the QEMU metadata api server"
}
variable "metadata_libvirt_uri" {
type = string
description = "libvirt uri for the metadata api server"
}
variable "libvirt_socket_path" {
type = string
description = "path to libvirt socket in case of unix socket"
}
variable "name" {
type = string
default = "constellation"