Skip to content

Commit

Permalink
incorporate review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Ashutosh Kumar <[email protected]>
  • Loading branch information
sonasingh46 committed Nov 30, 2021
1 parent eac6d0a commit 08ba489
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions azure/services/privatedns/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ func newRecordSetsClient(subscriptionID string, baseURI string, authorizer autor
func (ac *azureClient) GetZone(ctx context.Context, resourceGroupName, zoneName string) (privatedns.PrivateZone, error) {
ctx, _, done := tele.StartSpanWithLogger(ctx, "privatedns.AzureClient.GetZone")
defer done()
gotZone, err := ac.privatezones.Get(ctx, resourceGroupName, zoneName)
zone, err := ac.privatezones.Get(ctx, resourceGroupName, zoneName)
if err != nil {
return privatedns.PrivateZone{}, err
}
return gotZone, nil
return zone, nil
}

// CreateOrUpdateZone creates or updates a private zone.
Expand Down Expand Up @@ -122,13 +122,13 @@ func (ac *azureClient) DeleteZone(ctx context.Context, resourceGroupName, name s

// GetLink returns a vnet link.
func (ac *azureClient) GetLink(ctx context.Context, resourceGroupName, zoneName, vnetLinkName string) (privatedns.VirtualNetworkLink, error) {
ctx, _, done := tele.StartSpanWithLogger(ctx, "privatedns.AzureClient.GetZone")
ctx, _, done := tele.StartSpanWithLogger(ctx, "privatedns.AzureClient.GetLink")
defer done()
gotVnetLink, err := ac.vnetlinks.Get(ctx, resourceGroupName, zoneName, vnetLinkName)
vnetLink, err := ac.vnetlinks.Get(ctx, resourceGroupName, zoneName, vnetLinkName)
if err != nil {
return privatedns.VirtualNetworkLink{}, err
}
return gotVnetLink, nil
return vnetLink, nil
}

// CreateOrUpdateLink creates or updates a virtual network link to the specified Private DNS zone.
Expand Down
8 changes: 4 additions & 4 deletions azure/services/privatedns/privatedns.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,21 @@ func (s *Service) Delete(ctx context.Context) error {
// isPrivateDNSManaged returns true if the private DNS has an owned tag with the cluster name as value,
// meaning that the DNS lifecycle is managed.
func (s *Service) isPrivateDNSManaged(ctx context.Context, resourceGroup, zoneName string) (bool, error) {
gotZone, err := s.client.GetZone(ctx, resourceGroup, zoneName)
zone, err := s.client.GetZone(ctx, resourceGroup, zoneName)
if err != nil {
return false, err
}
tags := converters.MapToTags(gotZone.Tags)
tags := converters.MapToTags(zone.Tags)
return tags.HasOwned(s.Scope.ClusterName()), nil
}

// isVnetLinkManaged returns true if the vnet link has an owned tag with the cluster name as value,
// meaning that the vnet link lifecycle is managed.
func (s *Service) isVnetLinkManaged(ctx context.Context, resourceGroupName, zoneName, vnetLinkName string) (bool, error) {
gotZone, err := s.client.GetLink(ctx, resourceGroupName, zoneName, vnetLinkName)
zone, err := s.client.GetLink(ctx, resourceGroupName, zoneName, vnetLinkName)
if err != nil {
return false, err
}
tags := converters.MapToTags(gotZone.Tags)
tags := converters.MapToTags(zone.Tags)
return tags.HasOwned(s.Scope.ClusterName()), nil
}

0 comments on commit 08ba489

Please sign in to comment.