From 6f7925b09c5479bf7f11b884ab02d7e823636b86 Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Mon, 18 Mar 2024 16:28:40 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9Bfix:=20s3:=20ignore=20"NotFound"=20?= =?UTF-8?q?errors?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `s3.HeadObject` API call can return "NotFound" when either the bucket or the object does not exist (as opposed to the more descriptive `s3.ErrCodeNoSuchKey` or `s3.ErrCodeNoSuchBucket`). This would cause the machine controller to loop indefinitely trying to delete an already deleted object but failing: ``` E0316 16:37:08.973942 366 awsmachine_controller.go:307] "unable to delete machine" err=< deleting bootstrap data object: deleting S3 object: NotFound: Not Found status code: 404, request id: 5Z101DW1KN380WTY, host id: tYlSi9K38lBkIsr2DNf/xFfgDuFaVfeUmpscXdljiMZC5iRxPIDuXSLwHJwdFnosYCfi7Bih25GaDpVAbSq4ZA== > ``` --- pkg/cloud/services/s3/s3.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cloud/services/s3/s3.go b/pkg/cloud/services/s3/s3.go index e3d38dbe5c..7cccebc0f7 100644 --- a/pkg/cloud/services/s3/s3.go +++ b/pkg/cloud/services/s3/s3.go @@ -204,6 +204,9 @@ func (s *Service) Delete(m *scope.MachineScope) error { s.scope.Debug("Delete object call succeeded despite missing GetObject permission", "bucket", bucket, "key", key) + return nil + case "NotFound": + s.scope.Debug("Either bucket or object does not exist", "bucket", bucket, "key", key) return nil case s3.ErrCodeNoSuchKey: s.scope.Debug("Object already deleted", "bucket", bucket, "key", key)