Skip to content

Commit

Permalink
fix: ignore k8s additional addresses if nil
Browse files Browse the repository at this point in the history
This fixes a potential panic which I found in the unit-tests logs.

The error 'not found' is ignored, so need an addiitonal check.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
  • Loading branch information
smira committed Dec 9, 2022
1 parent 63c1710 commit d04970d
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (ctrl *LocalAffiliateController) Run(ctx context.Context, r controller.Runt
spec.KubeSpan.Address = kubespanIdentity.(*kubespan.Identity).TypedSpec().Address.Addr()
spec.KubeSpan.PublicKey = kubespanIdentity.(*kubespan.Identity).TypedSpec().PublicKey

if kubespanConfig.TypedSpec().AdvertiseKubernetesNetworks {
if kubespanConfig.TypedSpec().AdvertiseKubernetesNetworks && ksAdditionalAddresses != nil {
spec.KubeSpan.AdditionalAddresses = append([]netip.Prefix(nil), ksAdditionalAddresses.(*network.NodeAddress).TypedSpec().Addresses...)
} else {
spec.KubeSpan.AdditionalAddresses = nil
Expand Down

0 comments on commit d04970d

Please sign in to comment.