From 2a2607b688b1b76f49c6abcb8b2c605afd8be444 Mon Sep 17 00:00:00 2001 From: Jonathan Innis Date: Wed, 10 Jul 2024 00:15:39 -0700 Subject: [PATCH] Fix spurious discovered lines in logging --- pkg/providers/securitygroup/securitygroup.go | 7 +++---- pkg/providers/subnet/subnet.go | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/providers/securitygroup/securitygroup.go b/pkg/providers/securitygroup/securitygroup.go index db955dde3e12..6ebb6a83f69b 100644 --- a/pkg/providers/securitygroup/securitygroup.go +++ b/pkg/providers/securitygroup/securitygroup.go @@ -62,11 +62,10 @@ func (p *DefaultProvider) List(ctx context.Context, nodeClass *v1beta1.EC2NodeCl if err != nil { return nil, err } - if p.cm.HasChanged(fmt.Sprintf("security-groups/%s", nodeClass.Name), securityGroups) { + securityGroupIDs := lo.Map(securityGroups, func(s *ec2.SecurityGroup, _ int) string { return aws.StringValue(s.GroupId) }) + if p.cm.HasChanged(fmt.Sprintf("security-groups/%s", nodeClass.Name), securityGroupIDs) { log.FromContext(ctx). - WithValues("security-groups", lo.Map(securityGroups, func(s *ec2.SecurityGroup, _ int) string { - return aws.StringValue(s.GroupId) - })). + WithValues("security-groups", securityGroupIDs). V(1).Info("discovered security groups") } return securityGroups, nil diff --git a/pkg/providers/subnet/subnet.go b/pkg/providers/subnet/subnet.go index 510c9fd2c92f..c80be9c07b59 100644 --- a/pkg/providers/subnet/subnet.go +++ b/pkg/providers/subnet/subnet.go @@ -109,7 +109,7 @@ func (p *DefaultProvider) List(ctx context.Context, nodeClass *v1beta1.EC2NodeCl } } p.cache.SetDefault(fmt.Sprint(hash), lo.Values(subnets)) - if p.cm.HasChanged(fmt.Sprintf("subnets/%s", nodeClass.Name), subnets) { + if p.cm.HasChanged(fmt.Sprintf("subnets/%s", nodeClass.Name), lo.Keys(subnets)) { log.FromContext(ctx). WithValues("subnets", lo.Map(lo.Values(subnets), func(s *ec2.Subnet, _ int) v1beta1.Subnet { return v1beta1.Subnet{