Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
d5a3db00
Unverified
Commit
d5a3db00
authored
Mar 14, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 14, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74311 from hpedrorodrigues/fix-lb-sg-deletion
Ensure ownership when deleting a load balancer security group
parents
dfa25fcc
eb4087d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
aws.go
pkg/cloudprovider/providers/aws/aws.go
+27
-6
No files found.
pkg/cloudprovider/providers/aws/aws.go
View file @
d5a3db00
...
@@ -4212,18 +4212,39 @@ func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName strin
...
@@ -4212,18 +4212,39 @@ func (c *Cloud) EnsureLoadBalancerDeleted(ctx context.Context, clusterName strin
// Note that this is annoying: the load balancer disappears from the API immediately, but it is still
// Note that this is annoying: the load balancer disappears from the API immediately, but it is still
// deleting in the background. We get a DependencyViolation until the load balancer has deleted itself
// deleting in the background. We get a DependencyViolation until the load balancer has deleted itself
var
loadBalancerSGs
=
aws
.
StringValueSlice
(
lb
.
SecurityGroups
)
describeRequest
:=
&
ec2
.
DescribeSecurityGroupsInput
{}
filters
:=
[]
*
ec2
.
Filter
{
newEc2Filter
(
"group-id"
,
loadBalancerSGs
...
),
}
describeRequest
.
Filters
=
c
.
tagging
.
addFilters
(
filters
)
response
,
err
:=
c
.
ec2
.
DescribeSecurityGroups
(
describeRequest
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error querying security groups for ELB: %q"
,
err
)
}
// Collect the security groups to delete
// Collect the security groups to delete
securityGroupIDs
:=
map
[
string
]
struct
{}{}
securityGroupIDs
:=
map
[
string
]
struct
{}{}
for
_
,
securityGroupID
:=
range
lb
.
SecurityGroups
{
if
*
securityGroupID
==
c
.
cfg
.
Global
.
ElbSecurityGroup
{
for
_
,
sg
:=
range
response
{
//We don't want to delete a security group that was defined in the Cloud Configurationn.
sgID
:=
aws
.
StringValue
(
sg
.
GroupId
)
if
sgID
==
c
.
cfg
.
Global
.
ElbSecurityGroup
{
//We don't want to delete a security group that was defined in the Cloud Configuration.
continue
continue
}
}
if
aws
.
StringValue
(
securityGroupID
)
==
""
{
if
sgID
==
""
{
klog
.
Warning
(
"Ignoring empty security group in
"
,
service
.
Name
)
klog
.
Warning
f
(
"Ignoring empty security group in %s
"
,
service
.
Name
)
continue
continue
}
}
securityGroupIDs
[
*
securityGroupID
]
=
struct
{}{}
if
!
c
.
tagging
.
hasClusterTag
(
sg
.
Tags
)
{
klog
.
Warningf
(
"Ignoring security group with no cluster tag in %s"
,
service
.
Name
)
continue
}
securityGroupIDs
[
sgID
]
=
struct
{}{}
}
}
// Loop through and try to delete them
// Loop through and try to delete them
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment