Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLOUDP-194441: Manually bump Atlas client to version 0.32 #1077

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/pborman/uuid v1.2.1
github.com/sethvargo/go-password v0.2.0
github.com/stretchr/testify v1.8.4
go.mongodb.org/atlas v0.31.0
go.mongodb.org/atlas v0.32.0
go.mongodb.org/mongo-driver v1.12.1
go.uber.org/zap v1.25.0
golang.org/x/sync v0.3.0
Expand All @@ -42,7 +42,6 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.1.1 // indirect
github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect
github.com/benbjohnson/clock v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/s2a-go v0.1.4 // indirect
Expand Down
5 changes: 2 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ github.com/aws/aws-sdk-go v1.44.318 h1:Yl66rpbQHFUbxe9JBKLcvOvRivhVgP6+zH0b9KzAR
github.com/aws/aws-sdk-go v1.44.318/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -400,8 +399,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/atlas v0.31.0 h1:NgLqsNYm6wDYeDUO90etw1sl8T1U2DUKu36eUdnrFSI=
go.mongodb.org/atlas v0.31.0/go.mod h1:L4BKwVx/OeEhOVjCSdgo90KJm4469iv7ZLzQms/EPTg=
go.mongodb.org/atlas v0.32.0 h1:6uHwus8Bz+h1Ax75Pf3qo3kWCwnaUYav+SxSMU2RGiQ=
go.mongodb.org/atlas v0.32.0/go.mod h1:L4BKwVx/OeEhOVjCSdgo90KJm4469iv7ZLzQms/EPTg=
go.mongodb.org/mongo-driver v1.12.1 h1:nLkghSU8fQNaK7oUmDhQFsnrtcoNy7Z6LVFKsEecqgE=
go.mongodb.org/mongo-driver v1.12.1/go.mod h1:/rGBTebI3XYboVmgz+Wv3Bcbl3aD0QF9zl6kDDw18rQ=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/v1/status/cloud_provider_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (c *CloudProviderAccessRole) FailedToAuthorise(errorMessage string) {
c.ErrorMessage = errorMessage
}

func (c *CloudProviderAccessRole) Update(role mongodbatlas.AWSIAMRole, isEmptyArn bool) {
func (c *CloudProviderAccessRole) Update(role mongodbatlas.CloudProviderAccessRole, isEmptyArn bool) {
c.RoleID = role.RoleID
c.AtlasAssumedRoleExternalID = role.AtlasAssumedRoleExternalID
c.AtlasAWSAccountArn = role.AtlasAWSAccountARN
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/atlasproject/cloud_provider_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ func syncProviderAccessStatus(ctx context.Context, customContext *workflow.Conte
func tryToAuthorize(ctx context.Context, access mongodbatlas.CloudProviderAccessService, logger *zap.SugaredLogger, statusMap map[v1.CloudProviderAccessRole]status.CloudProviderAccessRole, groupID string) {
for spec, roleStatus := range statusMap {
if roleStatus.Status == status.StatusCreated {
request := mongodbatlas.CloudProviderAuthorizationRequest{
request := mongodbatlas.CloudProviderAccessRoleRequest{
ProviderName: spec.ProviderName,
IAMAssumedRoleARN: spec.IamAssumedRoleArn,
IAMAssumedRoleARN: &spec.IamAssumedRoleArn,
}
role, _, err := access.AuthorizeRole(ctx, groupID, roleStatus.RoleID, &request)
if err != nil {
Expand Down Expand Up @@ -109,7 +109,7 @@ func ensureCloudProviderAccessStatus(statusMap map[v1.CloudProviderAccessRole]st
return workflow.OK(), status.CloudProviderAccessReadyType
}

func updateAccessRoles(toUpdate []mongodbatlas.AWSIAMRole, specToStatus map[v1.CloudProviderAccessRole]status.CloudProviderAccessRole) {
func updateAccessRoles(toUpdate []mongodbatlas.CloudProviderAccessRole, specToStatus map[v1.CloudProviderAccessRole]status.CloudProviderAccessRole) {
for _, role := range toUpdate {
for spec, roleStatus := range specToStatus {
if role.RoleID == roleStatus.RoleID {
Expand Down Expand Up @@ -212,7 +212,7 @@ func checkStatuses(specs []v1.CloudProviderAccessRole, statuses []status.CloudPr

type accessRoleDiff struct {
toCreate []v1.CloudProviderAccessRole
toUpdate []mongodbatlas.AWSIAMRole
toUpdate []mongodbatlas.CloudProviderAccessRole
toDelete map[string]string // roleId -> providerName
}

Expand Down
8 changes: 4 additions & 4 deletions test/e2e/api/atlas/atlas.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ func ginkgoPrettyPrintf(obj interface{}, msg string, formatArgs ...interface{})
ginkgo.GinkgoWriter.Println(debug.PrettyString(obj))
}

func (a *Atlas) GetIntegrationbyType(projectId, iType string) (*mongodbatlas.ThirdPartyIntegration, error) {
integraion, _, err := a.Client.Integrations.Get(context.Background(), projectId, iType)
func (a *Atlas) GetIntegrationByType(projectId, iType string) (*mongodbatlas.ThirdPartyIntegration, error) {
integration, _, err := a.Client.Integrations.Get(context.Background(), projectId, iType)
if err != nil {
return nil, err
}
return integraion, nil
return integration, nil
}

func (a *Atlas) GetUserByName(database, projectID, username string) (*mongodbatlas.DatabaseUser, error) {
Expand All @@ -190,7 +190,7 @@ func (a *Atlas) DeleteGlobalKey(key mongodbatlas.APIKey) error {
return nil
}

func (a *Atlas) GetEncryptioAtRest(projectID string) (*mongodbatlas.EncryptionAtRest, error) {
func (a *Atlas) GetEncryptionAtRest(projectID string) (*mongodbatlas.EncryptionAtRest, error) {
encryptionAtRest, _, err := a.Client.EncryptionsAtRest.Get(context.Background(), projectID)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/encryption_at_rest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func removeAllEncryptionsSeparately(encAtRest *v1.EncryptionAtRest) {

func checkIfEncryptionsAreDisabled(projectID string) (areEmpty bool, err error) {
atlasClient := atlas.GetClientOrFail()
encryptionAtRest, err := atlasClient.GetEncryptioAtRest(projectID)
encryptionAtRest, err := atlasClient.GetEncryptionAtRest(projectID)
if err != nil {
return false, err
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var _ = Describe("Configuration namespaced. Deploy deployment", Label("integrati
func integrationCycle(data *model.TestDataProvider, key string) {
integrationType := "DATADOG"

By("Deploy User Resouces", func() {
By("Deploy User Resources", func() {
projectStatus := GetProjectIntegrationStatus(data)
Expect(projectStatus).Should(BeEmpty())
})
Expand Down Expand Up @@ -94,7 +94,7 @@ func integrationCycle(data *model.TestDataProvider, key string) {

Expect(err).ShouldNot(HaveOccurred())

dog, err := atlasClient.GetIntegrationbyType(data.Project.ID(), integrationType)
dog, err := atlasClient.GetIntegrationByType(data.Project.ID(), integrationType)
Expect(err).ShouldNot(HaveOccurred())
Expect(strings.HasSuffix(key, removeStarsFromString(dog.APIKey))).Should(BeTrue())
})
Expand All @@ -108,7 +108,7 @@ func integrationCycle(data *model.TestDataProvider, key string) {
})

By("Delete integration check", func() {
integration, err := atlasClient.GetIntegrationbyType(data.Project.ID(), integrationType)
integration, err := atlasClient.GetIntegrationByType(data.Project.ID(), integrationType)
Expect(err).Should(HaveOccurred())
Expect(integration).To(BeNil())

Expand Down
Loading