Skip to content

Commit

Permalink
Add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jont828 committed Dec 17, 2024
1 parent 0940f06 commit 069daac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion azure/services/subnets/subnets.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"sigs.k8s.io/cluster-api-provider-azure/azure/converters"
"sigs.k8s.io/cluster-api-provider-azure/azure/services/aso"
"sigs.k8s.io/cluster-api-provider-azure/util/slice"
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
)

const serviceName = "subnets"
Expand All @@ -50,14 +51,20 @@ func New(scope SubnetScope) *aso.Service[*asonetworkv1.VirtualNetworksSubnet, Su
return svc
}

func postCreateOrUpdateResourceHook(_ context.Context, scope SubnetScope, subnet *asonetworkv1.VirtualNetworksSubnet, err error) error {
func postCreateOrUpdateResourceHook(ctx context.Context, scope SubnetScope, subnet *asonetworkv1.VirtualNetworksSubnet, err error) error {
ctx, log, done := tele.StartSpanWithLogger(ctx, "subnets.Service.postCreateOrUpdateResourceHook")

Check failure on line 55 in azure/services/subnets/subnets.go

View workflow job for this annotation

GitHub Actions / lint

ineffectual assignment to ctx (ineffassign)
defer done()

if err != nil {
return err
}

name := subnet.AzureName()
log.Info("Got subnet", "name", name, "subnet", subnet)
scope.UpdateSubnetID(name, ptr.Deref(subnet.Status.Id, ""))
log.Info("Subnet ID is updated", "name", name, "id", ptr.Deref(subnet.Status.Id, ""))
scope.UpdateSubnetCIDRs(name, converters.GetSubnetAddresses(*subnet))
log.Info("Subnet CIDRs are updated", "name", name, "cidrs", converters.GetSubnetAddresses(*subnet))

return nil
}
Expand Down

0 comments on commit 069daac

Please sign in to comment.