@@ -18,15 +18,16 @@ import (
18
18
ctrl "sigs.k8s.io/controller-runtime"
19
19
"sigs.k8s.io/controller-runtime/pkg/client"
20
20
21
- capiv1alpha1 "github.com/weaveworks/cluster-bootstrap-controller/api/v1alpha1"
21
+ capialpha2 "github.com/weaveworks/cluster-bootstrap-controller/api/v1alpha2"
22
+ capiv1alpha2 "github.com/weaveworks/cluster-bootstrap-controller/api/v1alpha2"
22
23
"github.com/weaveworks/cluster-bootstrap-controller/test"
23
24
gitopsv1alpha1 "github.com/weaveworks/cluster-controller/api/v1alpha1"
24
25
)
25
26
26
27
const testWaitDuration = time .Second * 55
27
28
28
29
func TestReconcile_when_cluster_not_ready (t * testing.T ) {
29
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
30
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
30
31
c .Spec .RequireClusterReady = true
31
32
c .Spec .ClusterReadinessBackoff = & metav1.Duration {Duration : testWaitDuration }
32
33
@@ -66,7 +67,7 @@ func TestReconcile_when_cluster_not_ready(t *testing.T) {
66
67
}
67
68
68
69
func TestReconcile_when_cluster_secret_not_available (t * testing.T ) {
69
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
70
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
70
71
c .Spec .RequireClusterReady = true
71
72
})
72
73
cl := makeTestCluster (func (c * gitopsv1alpha1.GitopsCluster ) {
@@ -96,7 +97,7 @@ func TestReconcile_when_cluster_secret_not_available(t *testing.T) {
96
97
}
97
98
98
99
func TestReconcile_when_cluster_ready (t * testing.T ) {
99
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
100
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
100
101
c .Spec .RequireClusterReady = true
101
102
})
102
103
readyNode := makeNode (map [string ]string {
@@ -139,7 +140,7 @@ func TestReconcile_when_cluster_ready(t *testing.T) {
139
140
}
140
141
141
142
func TestReconcile_when_cluster_ready_bootstrapped_with_same_config (t * testing.T ) {
142
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
143
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
143
144
c .Spec .RequireClusterReady = true
144
145
})
145
146
readyNode := makeNode (map [string ]string {
@@ -151,8 +152,8 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_same_config(t *testing.T
151
152
c .ObjectMeta .Labels = bc .Spec .ClusterSelector .MatchLabels
152
153
c .Status .Conditions = append (c .Status .Conditions , makeReadyCondition ())
153
154
c .ObjectMeta .Annotations = map [string ]string {
154
- capiv1alpha1 .BootstrappedAnnotation : "true" ,
155
- capiv1alpha1 .BootstrapConfigsAnnotation : fmt .Sprintf ("%s/%s" , bc .Namespace , bc .Name ),
155
+ capiv1alpha2 .BootstrappedAnnotation : "true" ,
156
+ capiv1alpha2 .BootstrapConfigsAnnotation : fmt .Sprintf ("%s/%s" , bc .Namespace , bc .Name ),
156
157
}
157
158
})
158
159
secret := makeTestSecret (types.NamespacedName {
@@ -186,7 +187,7 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_same_config(t *testing.T
186
187
}
187
188
188
189
func TestReconcile_when_cluster_ready_bootstrapped_with_different_config (t * testing.T ) {
189
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
190
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
190
191
c .Spec .RequireClusterReady = true
191
192
})
192
193
readyNode := makeNode (map [string ]string {
@@ -197,8 +198,8 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_different_config(t *test
197
198
cl := makeTestCluster (func (c * gitopsv1alpha1.GitopsCluster ) {
198
199
c .ObjectMeta .Labels = bc .Spec .ClusterSelector .MatchLabels
199
200
c .ObjectMeta .Annotations = map [string ]string {
200
- capiv1alpha1 .BootstrappedAnnotation : "true" ,
201
- capiv1alpha1 .BootstrapConfigsAnnotation : "unknown/unknown" ,
201
+ capiv1alpha2 .BootstrappedAnnotation : "true" ,
202
+ capiv1alpha2 .BootstrapConfigsAnnotation : "unknown/unknown" ,
202
203
}
203
204
c .Status .Conditions = append (c .Status .Conditions , makeReadyCondition ())
204
205
})
@@ -233,7 +234,7 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_different_config(t *test
233
234
}
234
235
235
236
func TestReconcile_when_cluster_provisioned (t * testing.T ) {
236
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
237
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
237
238
c .Spec .RequireClusterProvisioned = true
238
239
})
239
240
cl := makeTestCluster (func (c * gitopsv1alpha1.GitopsCluster ) {
@@ -271,7 +272,7 @@ func TestReconcile_when_cluster_provisioned(t *testing.T) {
271
272
}
272
273
273
274
func TestReconcile_when_cluster_not_provisioned (t * testing.T ) {
274
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
275
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
275
276
c .Spec .RequireClusterProvisioned = true
276
277
})
277
278
cl := makeTestCluster (func (c * gitopsv1alpha1.GitopsCluster ) {
@@ -309,7 +310,7 @@ func TestReconcile_when_cluster_not_provisioned(t *testing.T) {
309
310
}
310
311
311
312
func TestReconcile_when_cluster_no_matching_labels (t * testing.T ) {
312
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
313
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
313
314
c .Spec .RequireClusterReady = true
314
315
})
315
316
cl := makeTestCluster (func (c * gitopsv1alpha1.GitopsCluster ) {
@@ -342,7 +343,7 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_multiple_config(t *testi
342
343
// Multiple configs can bootstrap the same cluster
343
344
// If the reconciled cluster is in that list (anywhere) then we don't create
344
345
// jobs.
345
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
346
+ bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha2 .ClusterBootstrapConfig ) {
346
347
c .Spec .RequireClusterReady = true
347
348
})
348
349
readyNode := makeNode (map [string ]string {
@@ -353,8 +354,8 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_multiple_config(t *testi
353
354
cl := makeTestCluster (func (c * gitopsv1alpha1.GitopsCluster ) {
354
355
c .ObjectMeta .Labels = bc .Spec .ClusterSelector .MatchLabels
355
356
c .ObjectMeta .Annotations = map [string ]string {
356
- capiv1alpha1 .BootstrappedAnnotation : "true" ,
357
- capiv1alpha1 .BootstrapConfigsAnnotation : fmt .Sprintf ("%s,%s/%s" , "unknown/unknown" , bc .GetNamespace (), bc .GetName ()),
357
+ capialpha2 .BootstrappedAnnotation : "true" ,
358
+ capialpha2 .BootstrapConfigsAnnotation : fmt .Sprintf ("%s,%s/%s" , "unknown/unknown" , bc .GetNamespace (), bc .GetName ()),
358
359
}
359
360
c .Status .Conditions = append (c .Status .Conditions , makeReadyCondition ())
360
361
})
@@ -391,7 +392,7 @@ func TestReconcile_when_cluster_ready_bootstrapped_with_multiple_config(t *testi
391
392
func TestReconcile_when_empty_label_selector (t * testing.T ) {
392
393
// When the label selector is empty, we don't want any jobs created, rather
393
394
// than a job for all clusters.
394
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
395
+ bc := makeTestClusterBootstrapConfig (func (c * capialpha2 .ClusterBootstrapConfig ) {
395
396
c .Spec .RequireClusterReady = true
396
397
c .Spec .ClusterSelector = metav1.LabelSelector {
397
398
MatchLabels : map [string ]string {},
@@ -425,7 +426,7 @@ func TestReconcile_when_empty_label_selector(t *testing.T) {
425
426
}
426
427
427
428
func TestReconcile_when_cluster_ready_and_old_label (t * testing.T ) {
428
- bc := makeTestClusterBootstrapConfig (func (c * capiv1alpha1 .ClusterBootstrapConfig ) {
429
+ bc := makeTestClusterBootstrapConfig (func (c * capialpha2 .ClusterBootstrapConfig ) {
429
430
c .Spec .RequireClusterReady = true
430
431
})
431
432
readyNode := makeNode (map [string ]string {
0 commit comments