@@ -28,10 +28,10 @@ import (
28
28
"sigs.k8s.io/controller-runtime/pkg/client"
29
29
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
30
30
31
- clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
31
+ clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
32
32
"sigs.k8s.io/cluster-api/util/annotations"
33
- v1beta2conditions "sigs.k8s.io/cluster-api/util/conditions/v1beta2"
34
- "sigs.k8s.io/cluster-api/util/patch"
33
+ v1beta2conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/ conditions/v1beta2"
34
+ "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/ patch"
35
35
)
36
36
37
37
// ConditionSetter combines the client.Object and Setter interface.
@@ -41,9 +41,9 @@ type ConditionSetter interface {
41
41
}
42
42
43
43
// EnsurePausedCondition sets the paused condition on the object and returns if it should be considered as paused.
44
- func EnsurePausedCondition (ctx context.Context , c client.Client , cluster * clusterv1 .Cluster , obj ConditionSetter ) (isPaused bool , requeue bool , err error ) {
45
- oldCondition := v1beta2conditions .Get (obj , clusterv1 .PausedV1Beta2Condition )
46
- newCondition := pausedCondition (c .Scheme (), cluster , obj , clusterv1 .PausedV1Beta2Condition )
44
+ func EnsurePausedCondition (ctx context.Context , c client.Client , cluster * clusterv1beta1 .Cluster , obj ConditionSetter ) (isPaused bool , requeue bool , err error ) {
45
+ oldCondition := v1beta2conditions .Get (obj , clusterv1beta1 .PausedV1Beta2Condition )
46
+ newCondition := pausedCondition (c .Scheme (), cluster , obj , clusterv1beta1 .PausedV1Beta2Condition )
47
47
48
48
isPaused = newCondition .Status == metav1 .ConditionTrue
49
49
pausedStatusChanged := oldCondition == nil || oldCondition .Status != newCondition .Status
@@ -81,7 +81,7 @@ func EnsurePausedCondition(ctx context.Context, c client.Client, cluster *cluste
81
81
v1beta2conditions .Set (obj , newCondition )
82
82
83
83
if err := patchHelper .Patch (ctx , obj , patch.WithOwnedV1Beta2Conditions {Conditions : []string {
84
- clusterv1 .PausedV1Beta2Condition ,
84
+ clusterv1beta1 .PausedV1Beta2Condition ,
85
85
}}); err != nil {
86
86
return isPaused , false , err
87
87
}
@@ -90,7 +90,7 @@ func EnsurePausedCondition(ctx context.Context, c client.Client, cluster *cluste
90
90
}
91
91
92
92
// pausedCondition sets the paused condition on the object and returns if it should be considered as paused.
93
- func pausedCondition (scheme * runtime.Scheme , cluster * clusterv1 .Cluster , obj ConditionSetter , targetConditionType string ) metav1.Condition {
93
+ func pausedCondition (scheme * runtime.Scheme , cluster * clusterv1beta1 .Cluster , obj ConditionSetter , targetConditionType string ) metav1.Condition {
94
94
if (cluster != nil && cluster .Spec .Paused ) || annotations .HasPaused (obj ) {
95
95
var messages []string
96
96
if cluster != nil && cluster .Spec .Paused {
@@ -107,7 +107,7 @@ func pausedCondition(scheme *runtime.Scheme, cluster *clusterv1.Cluster, obj Con
107
107
return metav1.Condition {
108
108
Type : targetConditionType ,
109
109
Status : metav1 .ConditionTrue ,
110
- Reason : clusterv1 .PausedV1Beta2Reason ,
110
+ Reason : clusterv1beta1 .PausedV1Beta2Reason ,
111
111
Message : strings .Join (messages , ", " ),
112
112
ObservedGeneration : obj .GetGeneration (),
113
113
}
@@ -116,7 +116,7 @@ func pausedCondition(scheme *runtime.Scheme, cluster *clusterv1.Cluster, obj Con
116
116
return metav1.Condition {
117
117
Type : targetConditionType ,
118
118
Status : metav1 .ConditionFalse ,
119
- Reason : clusterv1 .NotPausedV1Beta2Reason ,
119
+ Reason : clusterv1beta1 .NotPausedV1Beta2Reason ,
120
120
ObservedGeneration : obj .GetGeneration (),
121
121
}
122
122
}
0 commit comments