From 7a2d4f6f423cd6a38b44ee7ee3882a44f903d4a3 Mon Sep 17 00:00:00 2001 From: Alexander Demichev Date: Mon, 3 Aug 2020 12:54:20 +0200 Subject: [PATCH] UPSTREAM: : openshift: Fail machine if create request doesn't succeed --- pkg/cloud/azure/actuators/machine/reconciler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/cloud/azure/actuators/machine/reconciler.go b/pkg/cloud/azure/actuators/machine/reconciler.go index 1b80fad1dc0..c92c5e9734a 100644 --- a/pkg/cloud/azure/actuators/machine/reconciler.go +++ b/pkg/cloud/azure/actuators/machine/reconciler.go @@ -28,6 +28,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-12-01/compute" "github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-12-01/network" + "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/to" machinev1 "github.com/openshift/machine-api-operator/pkg/apis/machine/v1beta1" machinecontroller "github.com/openshift/machine-api-operator/pkg/controller/machine" @@ -607,6 +608,11 @@ func (s *Reconciler) createVirtualMachine(ctx context.Context, nicName string) e Namespace: s.scope.Machine.Namespace, Reason: err.Error(), }) + + var detailedError autorest.DetailedError + if errors.As(err, &detailedError) && detailedError.Message == "Failure sending request" { + return machinecontroller.InvalidMachineConfiguration("failure sending request for machine %s", s.scope.Machine.Name) + } return fmt.Errorf("failed to create or get machine: %w", err) } } else if err != nil {