Closed wkleinhenz closed 1 month ago
Hey @wkleinhenz,
thanks for your feature request (and also thanks for the link if that project, I wasn't aware of that one!)! Proxmox is a multi-master setup and unless we're running Proxmox HA features (see also the related API https://pve.proxmox.com/pve-docs/api-viewer/#/cluster/ha/status/current), it's a little bit tricky to integrate this. I don't want to force people into enabling HA feature (I also run most of my clusters without enabled HA feature), but I see some possibilities, if a potential option has been defined:
So, I could imagine something like the following config options:
master_only: True
This enables the feature for auto-detection and tries to get the status from the HA feature. If this isn't available, it falls back to a sorted list of nodes that are online and reachable and picks the first one.
master_only: True
master_node: hypervisor01
This simply defines a static node as the master.
Maybe I've overseen some other possibilities. Happy to hear your (or anyones) feedback. At least, this should be easy to integrate.
Cheers, gyptazy
I think what you proposed in option 1 makes sense to me
Ok, cool. I'll try to integrate it in the next (two) weeks. Unfortunately, I do not have that much time for spare projects next week.
Hey @wkleinhenz,
I had some time this morning and implemented this in PR #43. Looks like I had it wrong in my mind and the API HA status is always present in a cluster even without activated HA features which makes it a lot easier to implement.
You can give it a try from PR #43 or the feature branch feature/40-option-run-only-on-master-node
. You can find my tests in the PR.
Let me know if this fits your needs.
Thanks, gyptazy
As noted in the reddit this service/container should only be run against a single node to prevent constant migration, while this works it would be nice to have the option to run the service on all nodes in case a node needs to be offline for some reason. If possible could you implement a setting similar to the
only_on_master
from https://github.com/cvk98/Proxmox-load-balancer.This would allow the service to be run on all cluster nodes but it would only take action if the targeted node was marked as the master
I really like this project so far, let me know if theres any clarification needed