Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions pkg/destroy/aws/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ func (o *ClusterUninstaller) cleanSharedHostedZone(ctx context.Context, client *
if err != nil {
return err
}
logger = logger.WithField("id", publicZoneID)

var lastError error
err = client.ListResourceRecordSetsPagesWithContext(
Expand All @@ -218,21 +217,22 @@ func (o *ClusterUninstaller) cleanSharedHostedZone(ctx context.Context, client *
if len(name) == len(dottedClusterDomain) {
continue
}
recordSetLogger := logger.WithField(
"recordset",
fmt.Sprintf("%s (%s)", aws.StringValue(recordSet.Name), aws.StringValue(recordSet.Type)),
)
// delete any matching record sets in the public hosted zone
if publicZoneID != "" {
if err := deleteMatchingRecordSetInPublicZone(ctx, client, publicZoneID, recordSet, logger); err != nil {
publicZoneLogger := logger.WithField("id", id)
Comment thread
squidboylan marked this conversation as resolved.
Outdated
if err := deleteMatchingRecordSetInPublicZone(ctx, client, publicZoneID, recordSet, publicZoneLogger); err != nil {
if lastError != nil {
logger.Debug(lastError)
publicZoneLogger.Debug(lastError)
}
lastError = errors.Wrapf(err, "deleting record set matching %#v from public zone %s", recordSet, publicZoneID)
// do not delete the record set in the private zone if the delete failed in the public zone;
// otherwise the record set in the public zone will get leaked
continue
}
recordSetLogger := logger.WithField("id", publicZoneID).WithField(
"recordset",
fmt.Sprintf("%s (%s)", aws.StringValue(recordSet.Name), aws.StringValue(recordSet.Type)),
Comment thread
squidboylan marked this conversation as resolved.
Outdated
)
recordSetLogger.Debug("Deleted from public zone")
Comment thread
squidboylan marked this conversation as resolved.
Outdated
}
// delete the record set
Expand All @@ -242,6 +242,10 @@ func (o *ClusterUninstaller) cleanSharedHostedZone(ctx context.Context, client *
}
lastError = errors.Wrapf(err, "deleting record set %#v from zone %s", recordSet, id)
}
recordSetLogger := logger.WithField("id", id).WithField(
"recordset",
fmt.Sprintf("%s (%s)", aws.StringValue(recordSet.Name), aws.StringValue(recordSet.Type)),
)
recordSetLogger.Debug("Deleted")
Comment thread
squidboylan marked this conversation as resolved.
Outdated
}
return !lastPage
Expand Down