| From 294b2d3ca34f7d327da3b27bd07edde7f5bbac43 Mon Sep 17 00:00:00 2001 |
| From: okozachenko <okozachenko1203@users.noreply.github.com> |
| Date: Tue, 19 Dec 2023 01:07:36 +1100 |
| Subject: [PATCH] fix: skip port deletion when instances have no port |
| |
| --- |
| pkg/cloud/services/networking/port.go | 4 ++++ |
| 1 file changed, 4 insertions(+) |
| |
| diff --git a/pkg/cloud/services/networking/port.go b/pkg/cloud/services/networking/port.go |
| index 4c213851f8..84b9bfc618 100644 |
| --- a/pkg/cloud/services/networking/port.go |
| +++ b/pkg/cloud/services/networking/port.go |
| @@ -315,6 +315,10 @@ func (s *Service) GarbageCollectErrorInstancesPort(eventObject runtime.Object, i |
| return fmt.Errorf("garbage collection of port %s failed, found %d ports with the same name", portName, len(portList)) |
| } |
| |
| + if len(portList) == 0 { |
| + continue |
| + } |
| + |
| if err := s.DeletePort(eventObject, portList[0].ID); err != nil { |
| return err |
| } |