Skip to content

Commit 324519f

Browse files
Merge pull request #302 from RaphaelBut/osd-24458
Update security group and subnet tag filters for 4.16
2 parents c358e70 + 45ef38a commit 324519f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Example usage:`./test/generate_incident.sh ClusterHasGoneMissing 2b94brrrrrrrrrr
6565
```
6666
3) Run `cadctl` using the payload file
6767
```bash
68-
./cadctl/cadctl investigate --payload-path payload
68+
./bin/cadctl investigate --payload-path payload
6969
```
7070

7171
## Documentation

pkg/aws/aws.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,10 @@ func (c *SdkClient) GetSecurityGroupID(infraID string) (string, error) {
438438
in := &ec2.DescribeSecurityGroupsInput{
439439
Filters: []*ec2.Filter{
440440
{
441+
// Prior to 4.16: <infra_id>-master-sg
442+
// 4.16+: <infra_id>-controlplane
441443
Name: aws.String("tag:Name"),
442-
Values: []*string{aws.String(fmt.Sprintf("%s-worker-sg", infraID))},
444+
Values: []*string{aws.String(fmt.Sprintf("%s-master-sg", infraID)), aws.String(fmt.Sprintf("%s-controlplane", infraID))},
443445
},
444446
},
445447
}
@@ -451,7 +453,7 @@ func (c *SdkClient) GetSecurityGroupID(infraID string) (string, error) {
451453
return "", fmt.Errorf("security groups are empty")
452454
}
453455
if len(*out.SecurityGroups[0].GroupId) == 0 {
454-
return "", fmt.Errorf("failed to list security group %s-worker-sg", infraID)
456+
return "", fmt.Errorf("failed to list security groups: %s-master-sg, %s-controlplane", infraID, infraID)
455457
}
456458
return *out.SecurityGroups[0].GroupId, nil
457459
}
@@ -461,8 +463,8 @@ func (c *SdkClient) GetSubnetID(infraID string) ([]string, error) {
461463
in := &ec2.DescribeSubnetsInput{
462464
Filters: []*ec2.Filter{
463465
{
464-
Name: aws.String(fmt.Sprintf("tag:kubernetes.io/cluster/%s", infraID)),
465-
Values: []*string{aws.String("owned")},
466+
Name: aws.String("tag-key"),
467+
Values: []*string{aws.String(fmt.Sprintf("kubernetes.io/cluster/%s", infraID))},
466468
},
467469
{
468470
Name: aws.String("tag-key"),
@@ -475,7 +477,7 @@ func (c *SdkClient) GetSubnetID(infraID string) ([]string, error) {
475477
return nil, fmt.Errorf("failed to find private subnet for %s: %w", infraID, err)
476478
}
477479
if len(out.Subnets) == 0 {
478-
return nil, fmt.Errorf("found 0 subnets with kubernetes.io/cluster/%s=owned and kubernetes.io/role/internal-elb", infraID)
480+
return nil, fmt.Errorf("found 0 subnets with kubernetes.io/cluster/%s and kubernetes.io/role/internal-elb", infraID)
479481
}
480482
return []string{*out.Subnets[0].SubnetId}, nil
481483
}
@@ -633,4 +635,4 @@ func (c *SdkClient) getRouteTable(routeTableID string) (*ec2.RouteTable, error)
633635
return &ec2.RouteTable{}, fmt.Errorf("no route tables found for route table id %v", routeTableID)
634636
}
635637
return describeRouteTablesOutput.RouteTables[0], nil
636-
}
638+
}

0 commit comments

Comments
 (0)