diff --git a/failover.ps1 b/failover.ps1 index 4f6f190..3e12f79 100644 --- a/failover.ps1 +++ b/failover.ps1 @@ -3,12 +3,9 @@ $hetznerCredentials = Get-Credential $nodeList = docker node ls --format '{{json .}}'| ConvertFrom-Json | ForEach-Object { docker node inspect $_.ID | ConvertFrom-Json } - $onlineNodeList = $nodeList | Where-Object {$_.Spec.Availability -eq 'active'} -$offlineNodeList = $nodeList | Where-Object {$_.Spec.Availability -ne 'active'} $failoverAddressList = (Invoke-RestMethod -Uri 'https://robot-ws.your-server.de/failover' -Authentication Basic -Credential $hetznerCredentials).failover - $offlineAddressList = $failoverAddressList | Where-Object active_server_ip -notin $onlineNodeList.Status.Addr $maximumAddressCount = [Math]::Ceiling($failoverAddressList.Count / $onlineNodeList.Count) @@ -36,15 +33,6 @@ $distributionTarget = :distribution foreach ($addressGroup in $addressGroupList) } } -#$offlineNodeList | Where-Object {$_. $distributionTarget.ip} -#$offlineNodeList.Spec.Labels ` -#| Get-Member ` -#| Select-Object -ExpandProperty Name ` -#| Where-Object {$_ -like 'link.lubi.ip.*'} ` -#| ForEach-Object { -# $_.Replace('link.lubi.ip.','') -#} - # docker label updates must not run in parallel to prevent out-of-sequence errors $distributionTarget | ForEach-Object { # first add the new labels and afterwards remove the old ones