Skip to content

Commit

Permalink
Merge branch 'main' into tallaxes/karpenter-bump-1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
tallaxes authored Jan 9, 2025
2 parents c795497 + a4c40b0 commit 237e559
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg/providers/instance/armutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ func deleteNicIfExists(ctx context.Context, client NetworkInterfacesAPI, rg, nic
func deleteVirtualMachineIfExists(ctx context.Context, client VirtualMachinesAPI, rg, vmName string) error {
_, err := client.Get(ctx, rg, vmName, nil)
if err != nil {
if sdkerrors.IsNotFoundErr(err) {
azErr := sdkerrors.IsResponseError(err)
if azErr != nil && (azErr.ErrorCode == "NotFound" || azErr.ErrorCode == "ResourceNotFound") {
return nil
}
return err
Expand Down
3 changes: 2 additions & 1 deletion pkg/providers/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ func (p *DefaultProvider) Get(ctx context.Context, vmName string) (*armcompute.V
var err error

if vm, err = p.azClient.virtualMachinesClient.Get(ctx, p.resourceGroup, vmName, nil); err != nil {
if sdkerrors.IsNotFoundErr(err) {
azErr := sdkerrors.IsResponseError(err)
if azErr != nil && (azErr.ErrorCode == "NotFound" || azErr.ErrorCode == "ResourceNotFound") {
return nil, corecloudprovider.NewNodeClaimNotFoundError(err)
}
return nil, fmt.Errorf("failed to get VM instance, %w", err)
Expand Down

0 comments on commit 237e559

Please sign in to comment.