@@ -195,10 +195,10 @@ func TestReconcile(t *testing.T) {
195
195
// Deploy test-cluster-1 and test-cluster-2.
196
196
testClusterT1 := unstructuredTestCluster ("test-cluster-1" , t1v1beta1 .GroupVersion .WithKind ("TestCluster" ))
197
197
g .Expect (unstructured .SetNestedField (testClusterT1 .Object , "foo-value" , "spec" , "foo" )).To (Succeed ())
198
- g .Expect (managerT1 .GetClient ().Patch (ctx , testClusterT1 , client .Apply , fieldOwner )).To (Succeed ())
198
+ g .Expect (managerT1 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT1 ) , fieldOwner )).To (Succeed ())
199
199
testClusterT1 = unstructuredTestCluster ("test-cluster-2" , t1v1beta1 .GroupVersion .WithKind ("TestCluster" ))
200
200
g .Expect (unstructured .SetNestedField (testClusterT1 .Object , "foo-value" , "spec" , "foo" )).To (Succeed ())
201
- g .Expect (managerT1 .GetClient ().Patch (ctx , testClusterT1 , client .Apply , fieldOwner )).To (Succeed ())
201
+ g .Expect (managerT1 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT1 ) , fieldOwner )).To (Succeed ())
202
202
validateManagedFields (t , g , "v1beta1" , map [string ][]string {
203
203
"test-cluster-1" : {"test.cluster.x-k8s.io/v1beta1" },
204
204
"test-cluster-2" : {"test.cluster.x-k8s.io/v1beta1" },
@@ -226,11 +226,11 @@ func TestReconcile(t *testing.T) {
226
226
// Set an additional field with a different field manager and v1beta2 apiVersion in test-cluster-2
227
227
testClusterT2 := unstructuredTestCluster ("test-cluster-2" , t2v1beta2 .GroupVersion .WithKind ("TestCluster" ))
228
228
g .Expect (unstructured .SetNestedField (testClusterT2 .Object , "bar-value" , "spec" , "bar" )).To (Succeed ())
229
- g .Expect (managerT2 .GetClient ().Patch (ctx , testClusterT2 , client .Apply , client .FieldOwner ("different-unit-test-client" ))).To (Succeed ())
229
+ g .Expect (managerT2 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT2 ) , client .FieldOwner ("different-unit-test-client" ))).To (Succeed ())
230
230
// Deploy test-cluster-3.
231
231
testClusterT2 = unstructuredTestCluster ("test-cluster-3" , t2v1beta2 .GroupVersion .WithKind ("TestCluster" ))
232
232
g .Expect (unstructured .SetNestedField (testClusterT2 .Object , "foo-value" , "spec" , "foo" )).To (Succeed ())
233
- g .Expect (managerT2 .GetClient ().Patch (ctx , testClusterT2 , client .Apply , fieldOwner )).To (Succeed ())
233
+ g .Expect (managerT2 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT2 ) , fieldOwner )).To (Succeed ())
234
234
// At this point we have clusters with all combinations of managedField apiVersions.
235
235
validateManagedFields (t , g , "v1beta2" , map [string ][]string {
236
236
"test-cluster-1" : {"test.cluster.x-k8s.io/v1beta1" },
@@ -323,7 +323,7 @@ func TestReconcile(t *testing.T) {
323
323
// Try to patch the test-clusters CRs with SSA.
324
324
testClusterT4 := unstructuredTestCluster (clusterName , t4v1beta2 .GroupVersion .WithKind ("TestCluster" ))
325
325
g .Expect (unstructured .SetNestedField (testClusterT4 .Object , "new-foo-value" , "spec" , "foo" )).To (Succeed ())
326
- err = managerT4 .GetClient ().Patch (ctx , testClusterT4 , client .Apply , fieldOwner )
326
+ err = managerT4 .GetClient ().Apply (ctx , client .ApplyConfigurationFromUnstructured ( testClusterT4 ) , fieldOwner )
327
327
328
328
// If managedField cleanup was skipped before, the SSA patch will fail for the clusters which still have v1beta1 managedFields.
329
329
if skipCRDMigrationPhases .Has (CleanupManagedFieldsPhase ) && (clusterName == "test-cluster-1" || clusterName == "test-cluster-2" ) {
0 commit comments