Skip to content

Commit

Permalink
chore(openstack): add OVHcloud example
Browse files Browse the repository at this point in the history
  • Loading branch information
spnngl committed Aug 1, 2024
1 parent e0bc583 commit acfea89
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
10 changes: 1 addition & 9 deletions openstack/compute.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,12 @@ data "openstack_compute_flavor_v2" "flatcar" {
name = var.flavor_name
}

# We create the OpenStack image by importing directly from the release servers.
resource "openstack_images_image_v2" "flatcar" {
name = "${var.cluster_name}-${var.release_channel}"
image_source_url = "https://${var.release_channel}.release.flatcar-linux.net/amd64-usr/${var.flatcar_version}/flatcar_production_openstack_image.img.gz"
container_format = "bare"
disk_format = "qcow2"
web_download = true
}

# 'instance' are the OpenStack instances created from the 'flatcar' image
# using user data.
resource "openstack_compute_instance_v2" "instance" {
for_each = toset(var.machines)
name = "${var.cluster_name}-${each.key}"
# XXX See flatcar_ovhcloud if you work on OVHcloud provider
image_id = openstack_images_image_v2.flatcar.id
flavor_id = data.openstack_compute_flavor_v2.flatcar.id
key_pair = openstack_compute_keypair_v2.provisioning_keypair.name
Expand Down
49 changes: 49 additions & 0 deletions openstack/image.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# We create the OpenStack image by importing directly from the release servers.
resource "openstack_images_image_v2" "flatcar" {
name = "${var.cluster_name}-${var.release_channel}"
image_source_url = "https://${var.release_channel}.release.flatcar-linux.net/amd64-usr/${var.flatcar_version}/flatcar_production_openstack_image.img.gz"
container_format = "bare"
disk_format = "qcow2"
web_download = true
}

# OVHcloud version, not supporting web_download + specify properties (notably
# for block-storage to avoid using virtio-blk instead of SCSI)
resource "openstack_images_image_v2" "flatcar_ovhcloud" {
name = "${var.cluster_name}-${var.release_channel}.${var.flatcar_version}"
image_source_url = "https://${var.release_channel}.release.flatcar-linux.net/amd64-usr/${var.flatcar_version}/flatcar_production_openstack_image.img.gz"
# XXX do not use it, OVH openstack seems to not handle this well :(
# web_download = false
verify_checksum = true
decompress = true
container_format = "bare"
disk_format = "qcow2"
protected = false
# Use hidden for image retirement/promotion
hidden = false
visibility = "private"

# See: https://docs.openstack.org/glance/stein/admin/useful-image-properties.html
# See: https://wiki.openstack.org/wiki/VirtDriverImageProperties
properties = {
architecture = "x86_64"
image_original_user = "core"
distro_family = "gentoo"
os_distro = "gentoo"
os_version = var.flatcar_version
os_release_channel = var.release_channel
os_arch = "amd64"
os_type = "linux"
hw_disk_bus = "scsi"
hw_scsi_model = "virtio-scsi"
hypervisor_type = "qemu"
hw_qemu_guest_agent = true
hw_vif_model = "virtio"
hw_vif_multiqueue_enabled = true
hw_time_hpet = true
}

timeouts {
create = "5m"
}
}

0 comments on commit acfea89

Please sign in to comment.