Skip to content

Commit 184d264

Browse files
committed
OCPBUGS-27156: GCP Destroy cleanup only records/zones created by the installer
** The cluster domain was added to the metadata previously to find private zones that were not created by the installer. The records were added to a private zone in this domain. The problem occurs when clusters with the same name are used for installation. The infra ID is not used during the zone creation or zone lookup. The same zone (with the same domain) is assumed to be the one the installer (destroyer) is looking for. The fix includes skipping the addition of the domain to the metadata so that it is not used for comparison on destroy.
1 parent 341c6ad commit 184d264

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/asset/cluster/gcp/gcp.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ import (
1010

1111
// Metadata converts an install configuration to GCP metadata.
1212
func Metadata(config *types.InstallConfig) *gcp.Metadata {
13+
// leave the private zone domain blank when not using a pre-created private zone
14+
privateZoneDomain := fmt.Sprintf("%s.", config.ClusterDomain())
15+
if config.GCP.Network == "" || config.GCP.NetworkProjectID == "" {
16+
privateZoneDomain = ""
17+
}
18+
1319
return &gcp.Metadata{
1420
Region: config.Platform.GCP.Region,
1521
ProjectID: config.Platform.GCP.ProjectID,
1622
NetworkProjectID: config.Platform.GCP.NetworkProjectID,
17-
PrivateZoneDomain: fmt.Sprintf("%s.", config.ClusterDomain()),
23+
PrivateZoneDomain: privateZoneDomain,
1824
}
1925
}

0 commit comments

Comments
 (0)