Skip to content

Commit

Permalink
OCPBUGS-27156: GCP Destroy cleanup only records/zones created by the …
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
barbacbd committed Jan 19, 2024
1 parent 341c6ad commit 184d264
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/asset/cluster/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,16 @@ import (

// Metadata converts an install configuration to GCP metadata.
func Metadata(config *types.InstallConfig) *gcp.Metadata {
// leave the private zone domain blank when not using a pre-created private zone
privateZoneDomain := fmt.Sprintf("%s.", config.ClusterDomain())
if config.GCP.Network == "" || config.GCP.NetworkProjectID == "" {
privateZoneDomain = ""
}

return &gcp.Metadata{
Region: config.Platform.GCP.Region,
ProjectID: config.Platform.GCP.ProjectID,
NetworkProjectID: config.Platform.GCP.NetworkProjectID,
PrivateZoneDomain: fmt.Sprintf("%s.", config.ClusterDomain()),
PrivateZoneDomain: privateZoneDomain,
}
}

0 comments on commit 184d264

Please sign in to comment.