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
+6
View File
@@ -130,6 +130,12 @@ class ClusterSettingsForm(forms.ModelForm):
cleaned_data = super().clean()
cluster_enabled = cleaned_data.get('enabled')
if not cleaned_data.get('primary_enable_wireguard') and cleaned_data.get('cluster_mode') in DISTRIBUTED_MODES:
self.add_error('primary_enable_wireguard', _(
'The primary server can only be disabled in mirror mode. In distributed mode, move its instances '
'to workers instead.'
))
if cluster_enabled and not settings.WIREGUARD_STATUS_CACHE_ENABLED:
raise ValidationError(_("Cluster mode requires WireGuard status cache to be enabled."))