@@ -20,6 +20,7 @@ import (
20
20
"context"
21
21
"fmt"
22
22
"net/http"
23
+ "strings"
23
24
"time"
24
25
25
26
corev1 "k8s.io/api/core/v1"
@@ -238,8 +239,14 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
238
239
createDeviceReq .ExtraTags = tags
239
240
240
241
dev , err = r .PacketClient .NewDevice (createDeviceReq )
241
- if err != nil {
242
- errs := fmt .Errorf ("failed to create machine %s: %v" , machineScope .Name (), err )
242
+
243
+ switch {
244
+ // TODO: find a better way than parsing the error messages for this.
245
+ case strings .Contains (err .Error (), " no available hardware reservations " ):
246
+ // Do not treat an error indicating there are no hardware reservations available as fatal
247
+ return ctrl.Result {}, fmt .Errorf ("failed to create machine %s: %w" , machineScope .Name (), err )
248
+ case err != nil :
249
+ errs := fmt .Errorf ("failed to create machine %s: %w" , machineScope .Name (), err )
243
250
machineScope .SetErrorReason (capierrors .CreateMachineError )
244
251
machineScope .SetErrorMessage (errs )
245
252
return ctrl.Result {}, errs
@@ -280,10 +287,7 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
280
287
Address : controlPlaneEndpoint .Address ,
281
288
}); err != nil {
282
289
r .Log .Error (err , "err assigining elastic ip to control plane. retrying..." )
283
- return ctrl.Result {
284
- Requeue : true ,
285
- RequeueAfter : time .Second * 20 ,
286
- }, nil
290
+ return ctrl.Result {RequeueAfter : time .Second * 20 }, nil
287
291
}
288
292
}
289
293
machineScope .SetReady ()
0 commit comments