Skip to content

Commit

Permalink
fix: filter out SideroLink address from Machine addresses
Browse files Browse the repository at this point in the history
This address is only useful within the context of the Sidero pod, and
e.g. control plane provider can't talk over it, so excluding the address
helps to avoid additional failures in the CP provider.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
(cherry picked from commit 824d059)
  • Loading branch information
smira committed Jul 22, 2022
1 parent 0008b0d commit df1d0c2
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion app/sidero-controller-manager/cmd/events-manager/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,22 @@ func (a *Adapter) HandleEvent(ctx context.Context, event events.Event) error {
case *machine.AddressEvent:
fields = append(fields, zap.String("hostname", event.GetHostname()), zap.String("addresses", strings.Join(event.GetAddresses(), ",")))

// filter out SideroLink address from the list
addresses := event.Addresses

n := 0

for _, addr := range addresses {
if addr != ip {
addresses[n] = addr
n++
}
}

addresses = addresses[:n]

err = a.patchServerBinding(ctx, ip, func(serverbinding *sidero.ServerBinding) {
serverbinding.Spec.Addresses = event.Addresses
serverbinding.Spec.Addresses = addresses
serverbinding.Spec.Hostname = event.Hostname
})

Expand Down

0 comments on commit df1d0c2

Please sign in to comment.