Skip to content
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
8 changes: 4 additions & 4 deletions test/helper/cloud/aws/vpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"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"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
)

func CreateVPC(ctx context.Context, name, cidr, region string) (string, error) {
Expand All @@ -43,9 +43,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 @@ -22,6 +22,7 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2"

"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
)

func CreateVPC(ctx context.Context, vpcName, cidr, region string) (string, error) {
Expand All @@ -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 @@ -35,7 +35,7 @@ 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"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
)

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 @@ -26,6 +26,7 @@ import (
"github.com/onsi/ginkgo/v2/dsl/core"

"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
)

const (
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
10 changes: 5 additions & 5 deletions test/helper/e2e/actions/cloudaccess/aws_roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"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"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
)

type AssumeRolePolicyDocument struct {
Expand Down Expand Up @@ -113,10 +113,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
18 changes: 10 additions & 8 deletions test/helper/e2e/api/aws/aws_resources_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (
"github.com/aws/aws-sdk-go-v2/service/s3"
s3types "github.com/aws/aws-sdk-go-v2/service/s3/types"
"github.com/onsi/ginkgo/v2"

taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
)

type AwsResourcesGenerator struct {
Expand Down Expand Up @@ -108,10 +110,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 +196,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 @@ -26,6 +26,8 @@ import (
"github.com/Azure/go-autorest/autorest/azure/auth"
"github.com/Azure/go-autorest/autorest/to"

"github.com/mongodb/mongodb-atlas-kubernetes/v2/internal/pointer"
taghelper "github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper"
"github.com/mongodb/mongodb-atlas-kubernetes/v2/test/helper/e2e/config"
)

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.