gce: Only select forwardingRules for our cluster

Avoids issues when we have two clusters in the same GCP project.
This commit is contained in:
justinsb 2023-07-28 17:06:48 -04:00
parent 3cce79d4e4
commit 8765d73ed3
1 changed files with 7 additions and 0 deletions

View File

@ -327,10 +327,17 @@ func (c *gceCloudImplementation) GetApiIngressStatus(cluster *kops.Cluster) ([]f
}
}
clusterLabel := LabelForCluster(cluster.Name)
for _, forwardingRule := range forwardingRules {
if !strings.HasPrefix(forwardingRule.Name, "api-") {
continue
}
if clusterLabel.Value != forwardingRule.Labels[clusterLabel.Key] {
continue
}
if forwardingRule.IPAddress == "" {
return nil, fmt.Errorf("found forward rule %q, but it did not have an IPAddress", forwardingRule.Name)
}