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

Bug 1898172: add tagging perms for aws shared networks #4384

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions pkg/asset/installconfig/aws/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ const (

// PermissionDeleteNetworking is a set of permissions required when the installer destroys networking resources.
PermissionDeleteNetworking PermissionGroup = "delete-networking"

// PermissionCreateSharedNetworking is a set of permissions required when the installer creates resources in a shared-network cluster.
PermissionCreateSharedNetworking PermissionGroup = "create-shared-networking"

// PermissionDeleteSharedNetworking is a set of permissions required when the installer destroys resources from a shared-network cluster.
PermissionDeleteSharedNetworking PermissionGroup = "delete-shared-networking"
)

var permissions = map[PermissionGroup][]string{
Expand Down Expand Up @@ -215,6 +221,14 @@ var permissions = map[PermissionGroup][]string{
"ec2:DisassociateRouteTable",
"ec2:ReplaceRouteTableAssociation",
},
// Permissions required for deleting a cluster with shared network resources
PermissionCreateSharedNetworking: {
"tag:TagResources",
},
// Permissions required for deleting a cluster with shared network resources
PermissionDeleteSharedNetworking: {
"tag:UnTagResources",
},
}

// ValidateCreds will try to create an AWS session, and also verify that the current credentials
Expand Down
7 changes: 5 additions & 2 deletions pkg/asset/installconfig/platformpermscheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ func (a *PlatformPermsCheck) Generate(dependencies asset.Parents) error {
switch platform {
case aws.Name:
permissionGroups := []awsconfig.PermissionGroup{awsconfig.PermissionCreateBase, awsconfig.PermissionDeleteBase}
// If subnets are not provided in install-config.yaml, include network permissions
if len(ic.Config.AWS.Subnets) == 0 {
usingExistingVPC := len(ic.Config.AWS.Subnets) != 0

if usingExistingVPC {
permissionGroups = append(permissionGroups, awsconfig.PermissionCreateSharedNetworking, awsconfig.PermissionDeleteSharedNetworking)
} else {
permissionGroups = append(permissionGroups, awsconfig.PermissionCreateNetworking, awsconfig.PermissionDeleteNetworking)
}

Expand Down