Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Commit d069654

Browse files
authored
Merge pull request #557 from ctreatma/bgp-npe
🐛 Check for non-nil response when enabling BGP
2 parents 3ffd9b2 + 2fdc247 commit d069654

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

controllers/packetmachine_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
365365
if machineScope.PacketCluster.Spec.VIPManager == "KUBE_VIP" {
366366
if err := r.PacketClient.EnsureNodeBGPEnabled(dev.ID); err != nil {
367367
// Do not treat an error enabling bgp on machine as fatal
368-
return ctrl.Result{RequeueAfter: time.Second * 20}, fmt.Errorf("failed to enable bpg on machine %s: %w", machineScope.Name(), err)
368+
return ctrl.Result{RequeueAfter: time.Second * 20}, fmt.Errorf("failed to enable bgp on machine %s: %w", machineScope.Name(), err)
369369
}
370370
}
371371

pkg/cloud/packet/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ func (p *Client) EnsureNodeBGPEnabled(id string) error {
297297
_, response, err := p.BGPSessions.Create(id, req)
298298
// if we already had one, then we can ignore the error
299299
// this really should be a 409, but 422 is what is returned
300-
if response.StatusCode == 422 && strings.Contains(fmt.Sprintf("%s", err), "already has session") {
300+
if response != nil && response.StatusCode == 422 && strings.Contains(fmt.Sprintf("%s", err), "already has session") {
301301
err = nil
302302
}
303303
return err

0 commit comments

Comments
 (0)