Skip to content

Commit c9b5ce9

Browse files
Make sure PEs are always added to status (#773)
Co-authored-by: Timur_Akhmadiev <Timur_Akhmadiev@epam.com>
1 parent 6922406 commit c9b5ce9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pkg/controller/atlasproject/private_endpoint.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package atlasproject
33
import (
44
"context"
55
"errors"
6+
"net/http"
67

78
"go.mongodb.org/atlas/mongodbatlas"
89

@@ -245,12 +246,10 @@ func syncPeInterfaceInAtlas(ctx *workflow.Context, projectID string, endpointsTo
245246
interfaceConn, response, err := ctx.Client.PrivateEndpoints.AddOnePrivateEndpoint(context.Background(), projectID, string(specPeService.Provider), atlasPeService.ID, interfaceConn)
246247
ctx.Log.Debugw("AddOnePrivateEndpoint Reply", "interfaceConn", interfaceConn, "err", err)
247248
if err != nil {
248-
if response.StatusCode == 400 || response.StatusCode == 409 {
249-
ctx.Log.Debugw("failed to create PE Interface", "error", err)
250-
continue
249+
ctx.Log.Debugw("failed to create PE Interface", "error", err)
250+
if response.StatusCode == http.StatusBadRequest || response.StatusCode == http.StatusConflict {
251+
return syncedEndpoints, err
251252
}
252-
253-
return syncedEndpoints, err
254253
}
255254
}
256255

0 commit comments

Comments
 (0)