@@ -18,18 +18,16 @@ package controllers
1818
1919import (
2020 "context"
21+ "errors"
2122 "fmt"
2223 "net/http"
2324 "strings"
2425 "time"
2526
26- corev1 "k8s.io/api/core/v1"
27-
2827 "github.com/go-logr/logr"
2928 "github.com/google/uuid"
3029 "github.com/packethost/packngo"
31- "github.com/pkg/errors"
32-
30+ corev1 "k8s.io/api/core/v1"
3331 apierrors "k8s.io/apimachinery/pkg/api/errors"
3432 "k8s.io/apimachinery/pkg/runtime"
3533 "k8s.io/client-go/tools/record"
@@ -65,6 +63,7 @@ type PacketMachineReconciler struct {
6563// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=packetmachines,verbs=get;list;watch;create;update;patch;delete
6664// +kubebuilder:rbac:groups=infrastructure.cluster.x-k8s.io,resources=packetmachines/status,verbs=get;update;patch
6765// +kubebuilder:rbac:groups=cluster.x-k8s.io,resources=machines;machines/status,verbs=get;list;watch
66+ // +kubebuilder:rbac:groups=bootstrap.cluster.x-k8s.io,resources=kubeadmconfigs;kubeadmconfigs/status,verbs=get;list;watch
6867// +kubebuilder:rbac:groups="",resources=secrets;,verbs=get;list;watch
6968
7069func (r * PacketMachineReconciler ) Reconcile (req ctrl.Request ) (_ ctrl.Result , reterr error ) {
@@ -132,7 +131,7 @@ func (r *PacketMachineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, re
132131 }
133132
134133 // Create the machine scope
135- machineScope , err := scope .NewMachineScope (scope.MachineScopeParams {
134+ machineScope , err := scope .NewMachineScope (ctx , scope.MachineScopeParams {
136135 Logger : logger ,
137136 Client : r .Client ,
138137 Cluster : cluster ,
@@ -141,7 +140,7 @@ func (r *PacketMachineReconciler) Reconcile(req ctrl.Request) (_ ctrl.Result, re
141140 PacketMachine : packetmachine ,
142141 })
143142 if err != nil {
144- return ctrl.Result {}, errors .Errorf ("failed to create scope: %+v " , err )
143+ return ctrl.Result {}, fmt .Errorf ("failed to create scope: %w " , err )
145144 }
146145
147146 // Always close the scope when exiting this function so we can persist any PacketMachine changes.
@@ -298,7 +297,7 @@ func (r *PacketMachineReconciler) reconcile(ctx context.Context, machineScope *s
298297 result = ctrl.Result {}
299298 default :
300299 machineScope .SetErrorReason (capierrors .UpdateMachineError )
301- machineScope .SetErrorMessage (errors .Errorf ("Instance status %q is unexpected" , dev .State ))
300+ machineScope .SetErrorMessage (fmt .Errorf ("Instance status %q is unexpected" , dev .State ))
302301 result = ctrl.Result {}
303302 }
304303
0 commit comments