Make the cluster's primary WireGuard option stop the primary server and its gateway in mirror mode

This commit is contained in:
Eduardo Silva
2026-11-23 14:00:35 -03:00
parent 1c3e162b5c
commit 2aa740eaaf
11 changed files with 196 additions and 7 deletions
+10
View File
@@ -31,6 +31,16 @@ class ClusterSettings(models.Model):
def cluster_enabled(cls):
return cls.objects.filter(name='cluster_settings', enabled=True).exists()
@classmethod
def primary_serves_clients(cls):
"""
False when the primary server neither runs WireGuard nor publishes App Gateway applications, which is only
possible in mirror mode: the workers serve every client.
"""
return not cls.objects.filter(
name='cluster_settings', enabled=True, primary_enable_wireguard=False
).exclude(cluster_mode__in=DISTRIBUTED_MODES).exists()
@classmethod
def is_distributed(cls):
"""Each WireGuard instance runs on a single server. Only applies while the cluster is enabled."""