Skip to content

Commit 375dc1e

Browse files
committed
small fixes in loadbalancer tasks
1 parent 7616f13 commit 375dc1e

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

upup/pkg/fi/cloudup/scaleway/cloud.go

+4
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,10 @@ func (s *scwCloudImplementation) DeleteLoadBalancer(loadBalancer *lb.LB) error {
435435
Zone: s.zone,
436436
})
437437
if err != nil {
438+
if is404Error(err) {
439+
klog.V(8).Infof("Load-balancer %q (%s) was already deleted", loadBalancer.Name, loadBalancer.ID)
440+
return nil
441+
}
438442
return fmt.Errorf("waiting for load-balancer: %w", err)
439443
}
440444
err = s.lbAPI.DeleteLB(&lb.ZonedAPIDeleteLBRequest{

upup/pkg/fi/cloudup/scalewaytasks/lb_backend.go

+4
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ func (l *LBBackend) Find(context *fi.CloudupContext) (*LBBackend, error) {
5454
cloud := context.T.Cloud.(scaleway.ScwCloud)
5555
lbService := cloud.LBService()
5656

57+
if l.LoadBalancer.LBID == nil {
58+
return nil, nil
59+
}
60+
5761
backendResponse, err := lbService.ListBackends(&lb.ZonedAPIListBackendsRequest{
5862
Zone: scw.Zone(cloud.Zone()),
5963
LBID: fi.ValueOf(l.LoadBalancer.LBID),

upup/pkg/fi/cloudup/scalewaytasks/lb_frontend.go

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ func (l *LBFrontend) Find(context *fi.CloudupContext) (*LBFrontend, error) {
5151
cloud := context.T.Cloud.(scaleway.ScwCloud)
5252
lbService := cloud.LBService()
5353

54+
if l.LoadBalancer.LBID == nil {
55+
return nil, nil
56+
}
57+
5458
frontendResponse, err := lbService.ListFrontends(&lb.ZonedAPIListFrontendsRequest{
5559
Zone: scw.Zone(cloud.Zone()),
5660
LBID: fi.ValueOf(l.LoadBalancer.LBID),

upup/pkg/fi/cloudup/scalewaytasks/loadbalancer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func (l *LoadBalancer) RenderScw(t *scaleway.ScwAPITarget, actual, expected, cha
142142

143143
if actual != nil {
144144

145-
klog.Infof("Updating existing load-balancer with name %q", expected.Name)
145+
klog.Infof("Updating existing load-balancer with name %q", fi.ValueOf(expected.Name))
146146

147147
// We update the tags
148148
if changes != nil || len(actual.Tags) != len(expected.Tags) {
@@ -164,7 +164,7 @@ func (l *LoadBalancer) RenderScw(t *scaleway.ScwAPITarget, actual, expected, cha
164164

165165
} else {
166166

167-
klog.Infof("Creating new load-balancer with name %q", expected.Name)
167+
klog.Infof("Creating new load-balancer with name %q", fi.ValueOf(expected.Name))
168168

169169
lbCreated, err := lbService.CreateLB(&lb.ZonedAPICreateLBRequest{
170170
Zone: scw.Zone(fi.ValueOf(expected.Zone)),

0 commit comments

Comments
 (0)