Skip to content

Commit dae1613

Browse files
committed
capi v1.9.0-beta.0: fix deprecated deps
1 parent 3f25319 commit dae1613

File tree

9 files changed

+17
-22
lines changed

9 files changed

+17
-22
lines changed

api/v1beta1/gcpmachine_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package v1beta1
1919
import (
2020
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22-
"sigs.k8s.io/cluster-api/errors"
2322
)
2423

2524
const (
@@ -386,7 +385,7 @@ type GCPMachineStatus struct {
386385
// can be added as events to the Machine object and/or logged in the
387386
// controller's output.
388387
// +optional
389-
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
388+
FailureReason *string `json:"failureReason,omitempty"`
390389

391390
// FailureMessage will be set in the event that there is a terminal problem
392391
// reconciling the Machine and will contain a more verbose string suitable

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cloud/interfaces.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
corev1 "k8s.io/api/core/v1"
2626
infrav1 "sigs.k8s.io/cluster-api-provider-gcp/api/v1beta1"
2727
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
28-
capierrors "sigs.k8s.io/cluster-api/errors"
2928
)
3029

3130
// Cloud alias for cloud.Cloud interface.
@@ -99,7 +98,7 @@ type MachineSetter interface {
9998
SetProviderID()
10099
SetInstanceStatus(v infrav1.InstanceStatus)
101100
SetFailureMessage(v error)
102-
SetFailureReason(v capierrors.MachineStatusError)
101+
SetFailureReason(v string)
103102
SetAnnotation(key, value string)
104103
SetAddresses(addressList []corev1.NodeAddress)
105104
}

cloud/scope/machine.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"sigs.k8s.io/cluster-api-provider-gcp/cloud/providerid"
3838
"sigs.k8s.io/cluster-api-provider-gcp/cloud/services/shared"
3939
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
40-
capierrors "sigs.k8s.io/cluster-api/errors"
4140
"sigs.k8s.io/cluster-api/util"
4241
"sigs.k8s.io/cluster-api/util/patch"
4342
"sigs.k8s.io/controller-runtime/pkg/client"
@@ -201,7 +200,7 @@ func (m *MachineScope) SetFailureMessage(v error) {
201200
}
202201

203202
// SetFailureReason sets the GCPMachine status failure reason.
204-
func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) {
203+
func (m *MachineScope) SetFailureReason(v string) {
205204
m.GCPMachine.Status.FailureReason = &v
206205
}
207206

controllers/gcpcluster_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ func (r *GCPClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
6565
c, err := ctrl.NewControllerManagedBy(mgr).
6666
WithOptions(options).
6767
For(&infrav1.GCPCluster{}).
68-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
69-
WithEventFilter(predicates.ResourceIsNotExternallyManaged(log)).
68+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), log, r.WatchFilterValue)).
69+
WithEventFilter(predicates.ResourceIsNotExternallyManaged(mgr.GetScheme(), log)).
7070
Build(r)
7171
if err != nil {
7272
return errors.Wrap(err, "error creating controller")
@@ -93,7 +93,7 @@ func (r *GCPClusterReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
9393
}
9494
return requests
9595
}),
96-
predicates.ClusterUnpaused(log),
96+
predicates.ClusterUnpaused(mgr.GetScheme(), log),
9797
)); err != nil {
9898
return errors.Wrap(err, "failed adding a watch for ready clusters")
9999
}

controllers/gcpmachine_controller.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import (
2828
"sigs.k8s.io/cluster-api-provider-gcp/cloud/services/compute/instances"
2929
"sigs.k8s.io/cluster-api-provider-gcp/util/reconciler"
3030
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
31-
capierrors "sigs.k8s.io/cluster-api/errors"
3231
"sigs.k8s.io/cluster-api/util"
3332
"sigs.k8s.io/cluster-api/util/annotations"
3433
"sigs.k8s.io/cluster-api/util/predicates"
@@ -60,7 +59,7 @@ func (r *GCPMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
6059
c, err := ctrl.NewControllerManagedBy(mgr).
6160
WithOptions(options).
6261
For(&infrav1.GCPMachine{}).
63-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
62+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), ctrl.LoggerFrom(ctx), r.WatchFilterValue)).
6463
Watches(
6564
&clusterv1.Machine{},
6665
handler.EnqueueRequestsFromMapFunc(util.MachineToInfrastructureMapFunc(infrav1.GroupVersion.WithKind("GCPMachine"))),
@@ -83,7 +82,7 @@ func (r *GCPMachineReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Ma
8382
if err := c.Watch(
8483
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
8584
handler.EnqueueRequestsFromMapFunc(clusterToObjectFunc),
86-
predicates.ClusterUnpausedAndInfrastructureReady(log),
85+
predicates.ClusterPausedTransitionsOrInfrastructureReady(mgr.GetScheme(), log),
8786
)); err != nil {
8887
return errors.Wrap(err, "failed adding a watch for ready clusters")
8988
}
@@ -244,7 +243,7 @@ func (r *GCPMachineReconciler) reconcile(ctx context.Context, machineScope *scop
244243
machineScope.SetReady()
245244
return ctrl.Result{}, nil
246245
default:
247-
machineScope.SetFailureReason(capierrors.UpdateMachineError)
246+
machineScope.SetFailureReason("UpdateError")
248247
machineScope.SetFailureMessage(errors.Errorf("GCPMachine instance state %s is unexpected", instanceState))
249248
return ctrl.Result{Requeue: true}, nil
250249
}

exp/controllers/gcpmanagedcluster_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (r *GCPManagedClusterReconciler) SetupWithManager(ctx context.Context, mgr
145145
c, err := ctrl.NewControllerManagedBy(mgr).
146146
WithOptions(options).
147147
For(&infrav1exp.GCPManagedCluster{}).
148-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
148+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), log, r.WatchFilterValue)).
149149
Watches(
150150
&infrav1exp.GCPManagedControlPlane{},
151151
handler.EnqueueRequestsFromMapFunc(r.managedControlPlaneMapper()),
@@ -158,8 +158,8 @@ func (r *GCPManagedClusterReconciler) SetupWithManager(ctx context.Context, mgr
158158
if err = c.Watch(
159159
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
160160
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, infrav1exp.GroupVersion.WithKind("GCPManagedCluster"), mgr.GetClient(), &infrav1exp.GCPManagedCluster{})),
161-
predicates.ClusterUnpaused(log),
162-
predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue),
161+
predicates.ClusterUnpaused(mgr.GetScheme(), log),
162+
predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), log, r.WatchFilterValue),
163163
)); err != nil {
164164
return fmt.Errorf("adding watch for ready clusters: %v", err)
165165
}

exp/controllers/gcpmanagedcontrolplane_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (r *GCPManagedControlPlaneReconciler) SetupWithManager(ctx context.Context,
6767
c, err := ctrl.NewControllerManagedBy(mgr).
6868
WithOptions(options).
6969
For(gcpManagedControlPlane).
70-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
70+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), log, r.WatchFilterValue)).
7171
Build(r)
7272
if err != nil {
7373
return errors.Wrap(err, "error creating controller")
@@ -76,7 +76,7 @@ func (r *GCPManagedControlPlaneReconciler) SetupWithManager(ctx context.Context,
7676
if err = c.Watch(
7777
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
7878
handler.EnqueueRequestsFromMapFunc(util.ClusterToInfrastructureMapFunc(ctx, gcpManagedControlPlane.GroupVersionKind(), mgr.GetClient(), &infrav1exp.GCPManagedControlPlane{})),
79-
predicates.ClusterUnpausedAndInfrastructureReady(log),
79+
predicates.ClusterPausedTransitionsOrInfrastructureReady(mgr.GetScheme(), log),
8080
)); err != nil {
8181
return fmt.Errorf("failed adding a watch for ready clusters: %w", err)
8282
}

exp/controllers/gcpmanagedmachinepool_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (r *GCPManagedMachinePoolReconciler) SetupWithManager(ctx context.Context,
157157
c, err := ctrl.NewControllerManagedBy(mgr).
158158
WithOptions(options).
159159
For(&infrav1exp.GCPManagedMachinePool{}).
160-
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(log, r.WatchFilterValue)).
160+
WithEventFilter(predicates.ResourceNotPausedAndHasFilterLabel(mgr.GetScheme(), log, r.WatchFilterValue)).
161161
Watches(
162162
&expclusterv1.MachinePool{},
163163
handler.EnqueueRequestsFromMapFunc(machinePoolToInfrastructureMapFunc(gvk)),
@@ -180,7 +180,7 @@ func (r *GCPManagedMachinePoolReconciler) SetupWithManager(ctx context.Context,
180180
if err := c.Watch(
181181
source.Kind[client.Object](mgr.GetCache(), &clusterv1.Cluster{},
182182
handler.EnqueueRequestsFromMapFunc(clusterToObjectFunc),
183-
predicates.ClusterUnpausedAndInfrastructureReady(log),
183+
predicates.ClusterPausedTransitionsOrInfrastructureReady(mgr.GetScheme(), log),
184184
)); err != nil {
185185
return errors.Wrap(err, "failed adding a watch for ready clusters")
186186
}

0 commit comments

Comments
 (0)