Skip to content

Commit 90c4de3

Browse files
authored
Merge pull request #2409 from shiftstack/port-0.12
[release-0.12] port/cleanup: support old bastion port name
2 parents 15ff31e + 861f1ac commit 90c4de3

File tree

1 file changed

+4
-1
lines changed
  • pkg/cloud/services/networking

1 file changed

+4
-1
lines changed

pkg/cloud/services/networking/port.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ func (s *Service) DeleteClusterPorts(openStackCluster *infrav1.OpenStackCluster)
350350
}
351351

352352
for _, port := range portList {
353-
if strings.HasPrefix(port.Name, openStackCluster.Name) {
353+
// The bastion port in 0.10 was prefixed with the namespace and then the current port name
354+
// so in order to cleanup the old bastion port we need to check for the old format.
355+
bastionLegacyPortPrefix := fmt.Sprintf("%s-%s", openStackCluster.Namespace, openStackCluster.Name)
356+
if strings.HasPrefix(port.Name, openStackCluster.Name) || strings.HasPrefix(port.Name, bastionLegacyPortPrefix) {
354357
if err := s.DeletePort(openStackCluster, port.ID); err != nil {
355358
return fmt.Errorf("error deleting port %s: %v", port.ID, err)
356359
}

0 commit comments

Comments
 (0)