mirror of https://github.com/kubernetes/kops.git
Merge pull request #13907 from hakman/gce_fix_cleanup_by_hash
Fix cleanup of firewall rules that contain targets with the cluster name hash
This commit is contained in:
commit
36aa0920df
|
|
@ -540,7 +540,7 @@ nextFirewallRule:
|
||||||
|
|
||||||
// We consider only firewall rules that target our cluster tags, which include the cluster name or hash
|
// We consider only firewall rules that target our cluster tags, which include the cluster name or hash
|
||||||
tagPrefix := gce.SafeClusterName(d.clusterName) + "-"
|
tagPrefix := gce.SafeClusterName(d.clusterName) + "-"
|
||||||
clusterNameHash := truncate.HashString(d.clusterName, 6)
|
clusterNameHash := truncate.HashString(gce.SafeClusterName(d.clusterName), 6)
|
||||||
if len(firewallRule.TargetTags) != 0 {
|
if len(firewallRule.TargetTags) != 0 {
|
||||||
tagMatchCount := 0
|
tagMatchCount := 0
|
||||||
for _, target := range firewallRule.TargetTags {
|
for _, target := range firewallRule.TargetTags {
|
||||||
|
|
@ -1241,12 +1241,9 @@ func (d *clusterDiscoveryGCE) matchesClusterNameMultipart(name string, maxParts
|
||||||
}
|
}
|
||||||
|
|
||||||
safeName := gce.SafeObjectName(id, d.clusterName)
|
safeName := gce.SafeObjectName(id, d.clusterName)
|
||||||
suffixedName, err := gce.ClusterSuffixedName(id, d.clusterName, 63)
|
clusterNameHash := truncate.HashString(gce.SafeClusterName(d.clusterName), 6)
|
||||||
if err != nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if name == safeName || name == suffixedName {
|
if name == safeName || strings.Contains(name, clusterNameHash) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue