|
|
@ -3,12 +3,9 @@ $hetznerCredentials = Get-Credential
|
|
|
|
$nodeList = docker node ls --format '{{json .}}'| ConvertFrom-Json | ForEach-Object {
|
|
|
|
$nodeList = docker node ls --format '{{json .}}'| ConvertFrom-Json | ForEach-Object {
|
|
|
|
docker node inspect $_.ID | ConvertFrom-Json
|
|
|
|
docker node inspect $_.ID | ConvertFrom-Json
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$onlineNodeList = $nodeList | Where-Object {$_.Spec.Availability -eq 'active'}
|
|
|
|
$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
|
|
|
|
$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
|
|
|
|
$offlineAddressList = $failoverAddressList | Where-Object active_server_ip -notin $onlineNodeList.Status.Addr
|
|
|
|
|
|
|
|
|
|
|
|
$maximumAddressCount = [Math]::Ceiling($failoverAddressList.Count / $onlineNodeList.Count)
|
|
|
|
$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
|
|
|
|
# docker label updates must not run in parallel to prevent out-of-sequence errors
|
|
|
|
$distributionTarget | ForEach-Object {
|
|
|
|
$distributionTarget | ForEach-Object {
|
|
|
|
# first add the new labels and afterwards remove the old ones
|
|
|
|
# first add the new labels and afterwards remove the old ones
|
|
|
|