diff --git a/go.mod b/go.mod index 347ba07bb9..98d0ebcbc2 100644 --- a/go.mod +++ b/go.mod @@ -19,7 +19,7 @@ require ( github.com/hashicorp/golang-lru v0.5.0 // indirect github.com/onsi/ginkgo v1.8.0 github.com/onsi/gomega v1.5.0 - github.com/openshift/cluster-api v0.0.0-20190820083002-b2bf995e2bba + github.com/openshift/cluster-api v0.0.0-20190829140302-072f7d777dc8 github.com/openshift/cluster-api-actuator-pkg v0.0.0-20190527090340-7628df78fb4c github.com/openshift/cluster-autoscaler-operator v0.0.0-20190521201101-62768a6ba480 // indirect github.com/openshift/machine-api-operator v0.0.0-20190312153711-9650e16c9880 // indirect diff --git a/go.sum b/go.sum index e64f6b8083..bcc89aa0ac 100644 --- a/go.sum +++ b/go.sum @@ -134,8 +134,8 @@ github.com/onsi/gomega v1.4.2 h1:3mYCb7aPxS/RU7TI1y4rkEn1oKmPRjNJLNEXgw7MH2I= github.com/onsi/gomega v1.4.2/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/openshift/cluster-api v0.0.0-20190820083002-b2bf995e2bba h1:4krj3ro7WpAdWiebb6PrAbG42/mnPWUyynYVVuriEpg= -github.com/openshift/cluster-api v0.0.0-20190820083002-b2bf995e2bba/go.mod h1:mNsD1dsD4T57kV4/C6zTHke/Ro166xgnyyRZqkamiEU= +github.com/openshift/cluster-api v0.0.0-20190829140302-072f7d777dc8 h1:L3tal3e86m4sx7BHr4m2xO4MA43clI52GBLurB/Vdl8= +github.com/openshift/cluster-api v0.0.0-20190829140302-072f7d777dc8/go.mod h1:mNsD1dsD4T57kV4/C6zTHke/Ro166xgnyyRZqkamiEU= github.com/openshift/cluster-api-actuator-pkg v0.0.0-20190527090340-7628df78fb4c h1:tXfKL0ifKs+3DZCBVkXQXcW9qRYuSm7LWCGGXkRreMk= github.com/openshift/cluster-api-actuator-pkg v0.0.0-20190527090340-7628df78fb4c/go.mod h1:KNPaA64x3Ok7z538kvS2acwC5fEwvPfF0RdTx2geQEE= github.com/openshift/cluster-autoscaler-operator v0.0.0-20190521201101-62768a6ba480 h1:iIrMvq8qRMfmuhw/TVB4usRN/BlH2huBKgtrRjucOU4= diff --git a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go index 11f1546461..6b54f552d5 100644 --- a/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go +++ b/vendor/github.com/openshift/cluster-api/pkg/controller/machine/controller.go @@ -24,9 +24,11 @@ import ( "github.com/go-log/log/info" clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" + commonerrors "github.com/openshift/cluster-api/pkg/apis/machine/common" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" controllerError "github.com/openshift/cluster-api/pkg/controller/error" kubedrain "github.com/openshift/cluster-api/pkg/drain" + clusterapiError "github.com/openshift/cluster-api/pkg/errors" "github.com/openshift/cluster-api/pkg/util" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -217,8 +219,16 @@ func (r *ReconcileMachine) Reconcile(request reconcile.Request) (reconcile.Resul } if err := r.actuator.Delete(ctx, cluster, m); err != nil { - klog.Errorf("Failed to delete machine %q: %v", name, err) - return delayIfRequeueAfterError(err) + // isInvalidMachineConfiguration will take care of the case where the + // configuration is invalid from the beginning. len(m.Status.Addresses) > 0 + // will handle the case when a machine configuration was invalidated + // after an instance was created. So only a small window is left when + // we can loose instances, e.g. right after request to create one + // was sent and before a list of node addresses was set. + if len(m.Status.Addresses) > 0 || !isInvalidMachineConfigurationError(err) { + klog.Errorf("Failed to delete machine %q: %v", name, err) + return delayIfRequeueAfterError(err) + } } if m.Status.NodeRef != nil { @@ -366,3 +376,14 @@ func delayIfRequeueAfterError(err error) (reconcile.Result, error) { } return reconcile.Result{}, err } + +func isInvalidMachineConfigurationError(err error) bool { + switch t := err.(type) { + case *clusterapiError.MachineError: + if t.Reason == commonerrors.InvalidConfigurationMachineError { + klog.Infof("Actuator returned invalid configuration error: %v", err) + return true + } + } + return false +} diff --git a/vendor/modules.txt b/vendor/modules.txt index c8d014596b..c6ce0a33a0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -167,7 +167,7 @@ github.com/onsi/gomega/matchers/support/goraph/bipartitegraph github.com/onsi/gomega/matchers/support/goraph/edge github.com/onsi/gomega/matchers/support/goraph/node github.com/onsi/gomega/matchers/support/goraph/util -# github.com/openshift/cluster-api v0.0.0-20190820083002-b2bf995e2bba +# github.com/openshift/cluster-api v0.0.0-20190829140302-072f7d777dc8 github.com/openshift/cluster-api/cmd/manager github.com/openshift/cluster-api/pkg/apis/machine/v1beta1 github.com/openshift/cluster-api/pkg/apis