Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 4 additions & 5 deletions test/helper/cloud/aws/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ package aws
import (
"context"
"fmt"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/ec2"
"github.com/aws/aws-sdk-go-v2/service/ec2/types"

awshelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/e2e/api/aws"
)

func CreateVPC(ctx context.Context, name, cidr, region string) (string, error) {
Expand All @@ -43,9 +42,9 @@ func CreateVPC(ctx context.Context, name, cidr, region string) (string, error) {
ResourceType: types.ResourceTypeVpc,
Tags: []types.Tag{
{Key: aws.String("Name"), Value: aws.String(name)},
{Key: aws.String(awshelper.OwnerEmailTag), Value: aws.String(awshelper.AKOEmail)},
{Key: aws.String(awshelper.CostCenterTag), Value: aws.String(awshelper.AKOCostCenter)},
{Key: aws.String(awshelper.EnvironmentTag), Value: aws.String(awshelper.AKOEnvTest)},
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
},
}},
})
Expand Down
6 changes: 5 additions & 1 deletion test/helper/cloud/azure/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"

Expand Down Expand Up @@ -45,7 +46,10 @@ func CreateVPC(ctx context.Context, vpcName, cidr, region string) (string, error
},
},
Tags: map[string]*string{
"Name": pointer.MakePtr(vpcName),
"Name": pointer.MakePtr(vpcName),
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
},
},
nil,
Expand Down
26 changes: 13 additions & 13 deletions test/helper/e2e/actions/cloud/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"encoding/json"
"errors"
"fmt"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
"os"
"strings"
"time"
Expand All @@ -35,7 +36,6 @@ import (
. "github.com/onsi/gomega"

"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
awshelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/e2e/api/aws"
)

type AwsAction struct {
Expand Down Expand Up @@ -91,10 +91,10 @@ func (a *AwsAction) CreateKMS(ctx context.Context, alias, region, atlasAccountAr
Origin: kmstypes.OriginTypeAwsKms,
Policy: aws.String(policyString),
Tags: []kmstypes.Tag{
{TagKey: aws.String(awshelper.OwnerTag), TagValue: aws.String(awshelper.AKOTeam)},
{TagKey: aws.String(awshelper.OwnerEmailTag), TagValue: aws.String(awshelper.AKOEmail)},
{TagKey: aws.String(awshelper.CostCenterTag), TagValue: aws.String(awshelper.AKOCostCenter)},
{TagKey: aws.String(awshelper.EnvironmentTag), TagValue: aws.String(awshelper.AKOEnvTest)},
{TagKey: aws.String(taghelper.OwnerTag), TagValue: aws.String(taghelper.AKOTeam)},
{TagKey: aws.String(taghelper.OwnerEmailTag), TagValue: aws.String(taghelper.AKOEmail)},
{TagKey: aws.String(taghelper.CostCenterTag), TagValue: aws.String(taghelper.AKOCostCenter)},
{TagKey: aws.String(taghelper.EnvironmentTag), TagValue: aws.String(taghelper.AKOEnvTest)},
},
})

Expand Down Expand Up @@ -406,10 +406,10 @@ func (a *AwsAction) createVPC(ctx context.Context, name, cidr, region string) (s
ResourceType: ec2types.ResourceTypeVpc,
Tags: []ec2types.Tag{
{Key: aws.String("Name"), Value: aws.String(name)},
{Key: aws.String(awshelper.OwnerTag), Value: aws.String(awshelper.AKOTeam)},
{Key: aws.String(awshelper.OwnerEmailTag), Value: aws.String(awshelper.AKOEmail)},
{Key: aws.String(awshelper.CostCenterTag), Value: aws.String(awshelper.AKOCostCenter)},
{Key: aws.String(awshelper.EnvironmentTag), Value: aws.String(awshelper.AKOEnvTest)},
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
},
}},
}
Expand Down Expand Up @@ -486,10 +486,10 @@ func (a *AwsAction) createSubnet(ctx context.Context, vpcID, name, cidr, region,
ResourceType: ec2types.ResourceTypeSubnet,
Tags: []ec2types.Tag{
{Key: aws.String("Name"), Value: aws.String(name)},
{Key: aws.String(awshelper.OwnerTag), Value: aws.String(awshelper.AKOTeam)},
{Key: aws.String(awshelper.OwnerEmailTag), Value: aws.String(awshelper.AKOEmail)},
{Key: aws.String(awshelper.CostCenterTag), Value: aws.String(awshelper.AKOCostCenter)},
{Key: aws.String(awshelper.EnvironmentTag), Value: aws.String(awshelper.AKOEnvTest)},
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
},
}},
VpcId: aws.String(vpcID),
Expand Down
16 changes: 15 additions & 1 deletion test/helper/e2e/actions/cloud/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"errors"
"fmt"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"

"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
Expand Down Expand Up @@ -141,6 +142,11 @@ func (a *AzureAction) CreatePrivateEndpoint(vpcName, subnetName, endpointName, s
},
},
},
Tags: map[string]*string{
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
},
},
nil,
)
Expand Down Expand Up @@ -246,7 +252,10 @@ func (a *AzureAction) createVpcWithSubnets(ctx context.Context, vpcName, cidr, r
Subnets: subnetsSpec,
},
Tags: map[string]*string{
"Name": pointer.MakePtr(vpcName),
"Name": pointer.MakePtr(vpcName),
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
},
},
nil,
Expand Down Expand Up @@ -421,6 +430,11 @@ func (a *AzureAction) CreateKeyVault(keyName string) (string, error) {
Properties: &armkeyvault.KeyProperties{
Kty: pointer.MakePtr(armkeyvault.JSONWebKeyTypeRSA),
},
Tags: map[string]*string{
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
},
}

r, err := a.keyVaultResourceFactory.NewKeysClient().CreateIfNotExist(ctx, a.resourceGroupName, AzureKeyVaultName, keyName, params, nil)
Expand Down
11 changes: 5 additions & 6 deletions test/helper/e2e/actions/cloudaccess/aws_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ import (
"context"
"encoding/json"
"fmt"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
"strings"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/iam"
"github.com/aws/aws-sdk-go-v2/service/iam/types"

awshelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/e2e/api/aws"
)

type AssumeRolePolicyDocument struct {
Expand Down Expand Up @@ -113,10 +112,10 @@ func CreateAWSIAMRole(ctx context.Context, roleName string) (string, error) {
AssumeRolePolicyDocument: &policy,
}
roleInput.Tags = []types.Tag{
{Key: aws.String(awshelper.OwnerTag), Value: aws.String(awshelper.AKOTeam)},
{Key: aws.String(awshelper.OwnerEmailTag), Value: aws.String(awshelper.AKOEmail)},
{Key: aws.String(awshelper.CostCenterTag), Value: aws.String(awshelper.AKOCostCenter)},
{Key: aws.String(awshelper.EnvironmentTag), Value: aws.String(awshelper.AKOEnvTest)},
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
}
role, err := IAMClient.CreateRole(ctx, &roleInput)
if err != nil {
Expand Down
17 changes: 9 additions & 8 deletions test/helper/e2e/api/aws/aws_resources_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"context"
"encoding/json"
"fmt"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
Expand Down Expand Up @@ -108,10 +109,10 @@ func (g *AwsResourcesGenerator) CreatePolicy(ctx context.Context, name string, p
PolicyDocument: policy(),
PolicyName: aws.String(name),
Tags: []iamtypes.Tag{
{Key: aws.String(OwnerTag), Value: aws.String(AKOTeam)},
{Key: aws.String(OwnerEmailTag), Value: aws.String(AKOEmail)},
{Key: aws.String(CostCenterTag), Value: aws.String(AKOCostCenter)},
{Key: aws.String(EnvironmentTag), Value: aws.String(AKOEnvTest)},
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
},
}

Expand Down Expand Up @@ -194,10 +195,10 @@ func (g *AwsResourcesGenerator) CreateBucket(ctx context.Context, name string) e

tagSet := &s3types.Tagging{
TagSet: []s3types.Tag{
{Key: aws.String(OwnerTag), Value: aws.String(AKOTeam)},
{Key: aws.String(OwnerEmailTag), Value: aws.String(AKOEmail)},
{Key: aws.String(CostCenterTag), Value: aws.String(AKOCostCenter)},
{Key: aws.String(EnvironmentTag), Value: aws.String(AKOEnvTest)},
{Key: aws.String(taghelper.OwnerTag), Value: aws.String(taghelper.AKOTeam)},
{Key: aws.String(taghelper.OwnerEmailTag), Value: aws.String(taghelper.AKOEmail)},
{Key: aws.String(taghelper.CostCenterTag), Value: aws.String(taghelper.AKOCostCenter)},
{Key: aws.String(taghelper.EnvironmentTag), Value: aws.String(taghelper.AKOEnvTest)},
},
}

Expand Down
9 changes: 7 additions & 2 deletions test/helper/e2e/api/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"context"
"errors"
"fmt"
"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
"path"
"time"

Expand Down Expand Up @@ -63,8 +65,11 @@ func SessionAzure(subscriptionID string, tagNameValue string) (sessionAzure, err
SubscriptionID: subscriptionID,
Authorizer: authorizer,
Tags: map[string]*string{
"name": to.StringPtr(tagNameValue),
config.TagForTestKey: to.StringPtr(config.TagForTestValue),
"name": to.StringPtr(tagNameValue),
config.TagForTestKey: to.StringPtr(config.TagForTestValue),
taghelper.OwnerEmailTag: pointer.MakePtr(taghelper.AKOEmail),
taghelper.CostCenterTag: pointer.MakePtr(taghelper.AKOCostCenter),
taghelper.EnvironmentTag: pointer.MakePtr(taghelper.AKOEnvTest),
},
}, nil
}
Expand Down
File renamed without changes.
Loading