dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.59k stars 458 forks source link

Support for Fedora CoreOS #701

Closed sylflo closed 4 years ago

sylflo commented 4 years ago

Description of Issue/Question

CoreOS will be deprecated very soon https://coreos.com/os/eol/. For now it's possible to use this plugin with the ignition of coreOS. I know for coreOS replacement there is Flatcar which is working for this provider https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/examples/v0.12/flatcar-linux, it's pretty awesome :D.

I was wondering if this provider works with Fedora CoreOS, I found this plugin provider https://github.com/poseidon/terraform-provider-ct, I was wondering if I could mix the libvirt provider and flatcar together ?

MalloZup commented 4 years ago

@sylflo hi . @tormath1 did the flatcar example.

Regarding the question, can you be more precise? I didn't get your question :grin:

The libvirt provider is a golang binary. If you build it on X Distro it will work using libvirt.

So I guess even in this X distro should work. Feel free to ask any other question . :rose:

sylflo commented 4 years ago

Since CoreOS will be deprecated and officialy replace by Fedora CoreOS, I was wondering:

My first guess is that it is not possible since for Fedora CoreOS, we apparently need yaml and the properties changed https://github.com/coreos/fcct/blob/master/docs/configuration-v1_0.md

And do something like this

data "ct_config" "worker" {
  content      = file("worker.yaml")
  pretty_print = false
  strict       = true
}

resource "libvirt_domain" "node" {
  coreos_ignition = data.ct_config.worker.rendered
}

For now, I will stick with Flatcar since it's easy to migrate from CoreOS, but I would prefer to use Fedora CoreOS since it's the "official" replacement.

ingobecker commented 4 years ago

Using the terraform-provider-ct works fine. There are no changes of the terraform-provider-libvirt needed. Have a look at my gitlab-runner example which shows how to use it in combination with terraform-provider-ct.

MalloZup commented 4 years ago

thx @ingobecker . I will close then. thx!

ingobecker commented 4 years ago

I'm wondering if it might be useful, if i contribute a fedora coreos example to the examples folder of this repo? The only problem is, that it depends on the terraform-provider-ct which needs to be installed manually in order for someone to tryout such an example.

MalloZup commented 4 years ago

@ingobecker I would not mind if you want to add the example here:

https://github.com/dmacvicar/terraform-provider-libvirt/tree/master/contrib

the file would be need to be changed containing an index etc.

see my comments on this pr https://github.com/dmacvicar/terraform-provider-libvirt/pull/712

remoe commented 4 years ago

I try to port some coreos configurations to Fedora CoreOS. I don't know where I should post my findings. So I post it here :) One need to change mounts here:

https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/examples/v0.12/coreos/qemu-agent/docker-images.mount#L1

On FCOS one can't it use this mount point. Here is one that works (not tested with sample):

    - name: var-mnt-images.mount
      enabled: true
      contents: |
        [Unit]
        Before=local-fs.target
        [Mount]
        What=qemu_docker_images
        Where=/var/mnt/images
        Options=ro,trans=virtio,version=9p2000.L
        Type=9p
        [Install]
        WantedBy=local-fs.target
ingobecker commented 4 years ago

@remoe Thanks. I haven't used qemu-agent because i used libvirt managed networks all the time. And since the qemu-agent part was commented out, i never look at it in detail. But you are right, that's the way to use the qemu-agent systemd units in FCOS.

@MalloZup I had a look at the discussion around the pr you mentioned. According to this statement Fedora CoreOS is the official successor of CoreOS and on May 26, 2020 CoreOS will reach its end of life(there will be no more updates). Since the examples for CoreOS are included in the examples directory i initially thought it would make sense to replace it with a Fedora CoreOS example. I would just port the already existing one including the changes @remoe proposed. It's not about showcasing a more complex usecase, i just wanted to make sure there is an usable example for Fedora CoreOS. On the other hand, i'm totally fine just contributing it to the contrib directory if this is a more appropriate location.