dmacvicar / terraform-provider-libvirt

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

Manage cluster #938

Closed raspbeguy closed 2 years ago

raspbeguy commented 2 years ago

Hello,

This issue is more a discussion on how to achieve the goal rather than a feature request. If it appears that it belongs to this provider scope, we could then discuss about the way to implement it. If that is irrelevant, well, sorry for the noise, however what result of this discussion will hopefully be useful to other people.

I am looking for a way to manage a libvirt cluster with Terraform. For me, and I think this a good enough use case simplification, a cluster is simply a group of hypervisors that share a domains list, meaning that we don't care on which hosts each domains is running (except maybe following some affinity rules).

Ultimately I wish to find a way to tell to Terraform "Make sure those domains are running on the cluster, and if they aren't, just choose the right nodes to pop them on".

Libvirt has no complete cluster management, but it enables live and offline migrations and datastore sharing. All that it lack to manage a cluser is how the domains are dispatched. I am relatively new to Terraform, but I don't think you could manage that through a simple module. If you can, I would be glad to learn about it. I'm opening an issue on this project because I think this is a quite frequent use case.

So that said, what do we need to efficiently manage a libvirt cluster?

A few things to think about:

I'm sure there is more, but that's all I can come up with for now.

PS: this is a different use case than #909: if I understood correctly, this MR aimed to provide a way to populate a domain on multiple nodes at the same time, and was introducing too much notions which were way too much inspired from AWS and wasn't agnostic enough to fit a majority use case.

dmacvicar commented 2 years ago

Thanks for the feedback. I think the provider already struggles with the complexity of having to support libvirt low level features.

I'd explore the functionality you describe in a separate layer. Either a proxy to libvirt hypervisors implementing the same API, or something like Harvester. Even terraform modules could be a path to explore.

What is certain, I will not add this functionality to the provider, because then I'd be unable to maintain it.