Skip to content

Commit 2a8c1a8

Browse files
committed
port/cleanup: support old bastion port name
To support upgrades from 0.10 where the bastion port name was named after the namespace + cluster name, we need to take care of removing that port as well during an upgrade.
1 parent 7b0b155 commit 2a8c1a8

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)