@@ -20,7 +20,6 @@ import (
2020 "context"
2121 "encoding/json"
2222 "fmt"
23- "k8s.io/apimachinery/pkg/types"
2423 "math/rand"
2524 "path"
2625 "reflect"
@@ -36,6 +35,7 @@ import (
3635 "k8s.io/apimachinery/pkg/labels"
3736 "k8s.io/apimachinery/pkg/runtime"
3837 "k8s.io/apimachinery/pkg/runtime/schema"
38+ "k8s.io/apimachinery/pkg/types"
3939 "k8s.io/apimachinery/pkg/util/wait"
4040 fakediscovery "k8s.io/client-go/discovery/fake"
4141 "k8s.io/client-go/dynamic"
@@ -107,13 +107,13 @@ func mustCreateTestController(t testing.TB, testConfigs ...*testConfig) (*machin
107107 dynamicClientset := fakedynamic .NewSimpleDynamicClientWithCustomListKinds (
108108 runtime .NewScheme (),
109109 map [schema.GroupVersionResource ]string {
110- {Group : "cluster.x-k8s.io" , Version : "v1alpha3" , Resource : "machinedeployments" }: "kindList" ,
111- {Group : "cluster.x-k8s.io" , Version : "v1alpha3" , Resource : "machines" }: "kindList" ,
112- {Group : "cluster.x-k8s.io" , Version : "v1alpha3" , Resource : "machinesets" }: "kindList" ,
113- {Group : "cluster.x-k8s.io" , Version : "v1alpha3" , Resource : "machinepools" }: "kindList" ,
114110 {Group : "cluster.x-k8s.io" , Version : "v1beta1" , Resource : "machinedeployments" }: "kindList" ,
115111 {Group : "cluster.x-k8s.io" , Version : "v1beta1" , Resource : "machines" }: "kindList" ,
116112 {Group : "cluster.x-k8s.io" , Version : "v1beta1" , Resource : "machinesets" }: "kindList" ,
113+ {Group : "cluster.x-k8s.io" , Version : "v1beta2" , Resource : "machinedeployments" }: "kindList" ,
114+ {Group : "cluster.x-k8s.io" , Version : "v1beta2" , Resource : "machines" }: "kindList" ,
115+ {Group : "cluster.x-k8s.io" , Version : "v1beta2" , Resource : "machinesets" }: "kindList" ,
116+ {Group : "cluster.x-k8s.io" , Version : "v1beta2" , Resource : "machinepools" }: "kindList" ,
117117 {Group : "custom.x-k8s.io" , Version : "v1beta1" , Resource : "machinepools" }: "kindList" ,
118118 {Group : "custom.x-k8s.io" , Version : "v1beta1" , Resource : "machinedeployments" }: "kindList" ,
119119 {Group : "custom.x-k8s.io" , Version : "v1beta1" , Resource : "machines" }: "kindList" ,
@@ -151,7 +151,7 @@ func mustCreateTestController(t testing.TB, testConfigs ...*testConfig) (*machin
151151 },
152152 },
153153 {
154- GroupVersion : fmt .Sprintf ("%s/v1alpha3 " , defaultCAPIGroup ),
154+ GroupVersion : fmt .Sprintf ("%s/v1beta2 " , defaultCAPIGroup ),
155155 APIResources : []metav1.APIResource {
156156 {
157157 Name : resourceNameMachineDeployment ,
@@ -191,7 +191,7 @@ func mustCreateTestController(t testing.TB, testConfigs ...*testConfig) (*machin
191191
192192 gvr := schema.GroupVersionResource {
193193 Group : action .GetResource ().Group ,
194- Version : "v1alpha3 " ,
194+ Version : "v1beta2 " ,
195195 Resource : resource ,
196196 }
197197
@@ -366,7 +366,7 @@ func createTestConfigs(specs ...testSpec) []*testConfig {
366366 config .machineSet = & unstructured.Unstructured {
367367 Object : map [string ]interface {}{
368368 "kind" : machineSetKind ,
369- "apiVersion" : "cluster.x-k8s.io/v1alpha3 " ,
369+ "apiVersion" : "cluster.x-k8s.io/v1beta2 " ,
370370 "metadata" : map [string ]interface {}{
371371 "name" : spec .machineSetName ,
372372 "namespace" : spec .namespace ,
@@ -404,7 +404,7 @@ func createTestConfigs(specs ...testSpec) []*testConfig {
404404 config .machineDeployment = & unstructured.Unstructured {
405405 Object : map [string ]interface {}{
406406 "kind" : machineDeploymentKind ,
407- "apiVersion" : "cluster.x-k8s.io/v1alpha3 " ,
407+ "apiVersion" : "cluster.x-k8s.io/v1beta2 " ,
408408 "metadata" : map [string ]interface {}{
409409 "name" : spec .machineDeploymentName ,
410410 "namespace" : spec .namespace ,
@@ -416,9 +416,9 @@ func createTestConfigs(specs ...testSpec) []*testConfig {
416416 "template" : map [string ]interface {}{
417417 "spec" : map [string ]interface {}{
418418 "infrastructureRef" : map [string ]interface {}{
419- "apiVersion " : "infrastructure.cluster.x-k8s.io/v1beta1 " ,
420- "kind" : machineTemplateKind ,
421- "name" : "TestMachineTemplate" ,
419+ "apiGroup " : "infrastructure.cluster.x-k8s.io" ,
420+ "kind" : machineTemplateKind ,
421+ "name" : "TestMachineTemplate" ,
422422 },
423423 },
424424 },
@@ -506,7 +506,7 @@ func makeLinkedNodeAndMachine(i int, namespace, clusterName string, owner metav1
506506 machine := & unstructured.Unstructured {
507507 Object : map [string ]interface {}{
508508 "kind" : machineKind ,
509- "apiVersion" : "cluster.x-k8s.io/v1alpha3 " ,
509+ "apiVersion" : "cluster.x-k8s.io/v1beta2 " ,
510510 "metadata" : map [string ]interface {}{
511511 "name" : fmt .Sprintf ("%s-%s-machine-%d" , namespace , owner .Name , i ),
512512 "namespace" : namespace ,
@@ -1550,7 +1550,7 @@ func TestGetAPIGroupPreferredVersion(t *testing.T) {
15501550 {
15511551 description : "find version for default API group" ,
15521552 APIGroup : defaultCAPIGroup ,
1553- preferredVersion : "v1alpha3 " ,
1553+ preferredVersion : "v1beta2 " ,
15541554 envVar : "" ,
15551555 error : false ,
15561556 },
@@ -1584,7 +1584,7 @@ func TestGetAPIGroupPreferredVersion(t *testing.T) {
15841584 GroupVersion : fmt .Sprintf ("%s/v1beta1" , customCAPIGroup ),
15851585 },
15861586 {
1587- GroupVersion : fmt .Sprintf ("%s/v1alpha3 " , defaultCAPIGroup ),
1587+ GroupVersion : fmt .Sprintf ("%s/v1beta2 " , defaultCAPIGroup ),
15881588 },
15891589 {
15901590 GroupVersion : fmt .Sprintf ("%s/%s" , customCAPIGroup , customVersion ),
@@ -1595,7 +1595,7 @@ func TestGetAPIGroupPreferredVersion(t *testing.T) {
15951595 for _ , tc := range testCases {
15961596 t .Run (tc .description , func (t * testing.T ) {
15971597 t .Setenv (CAPIVersionEnvVar , tc .envVar )
1598- version , err := getAPIGroupPreferredVersion (discoveryClient , tc .APIGroup )
1598+ version , err := getCAPIGroupPreferredVersion (discoveryClient , tc .APIGroup )
15991599 if (err != nil ) != tc .error {
16001600 t .Errorf ("expected to have error: %t. Had an error: %t" , tc .error , err != nil )
16011601 }
@@ -1617,14 +1617,14 @@ func TestGroupVersionHasResource(t *testing.T) {
16171617 {
16181618 description : "true when it finds resource" ,
16191619 resourceName : resourceNameMachineDeployment ,
1620- APIGroup : fmt .Sprintf ("%s/v1alpha3 " , defaultCAPIGroup ),
1620+ APIGroup : fmt .Sprintf ("%s/v1beta2 " , defaultCAPIGroup ),
16211621 expected : true ,
16221622 error : false ,
16231623 },
16241624 {
16251625 description : "false when it does not find resource" ,
16261626 resourceName : "resourceDoesNotExist" ,
1627- APIGroup : fmt .Sprintf ("%s/v1alpha3 " , defaultCAPIGroup ),
1627+ APIGroup : fmt .Sprintf ("%s/v1beta2 " , defaultCAPIGroup ),
16281628 expected : false ,
16291629 error : false ,
16301630 },
@@ -1641,7 +1641,7 @@ func TestGroupVersionHasResource(t *testing.T) {
16411641 Fake : & clientgotesting.Fake {
16421642 Resources : []* metav1.APIResourceList {
16431643 {
1644- GroupVersion : fmt .Sprintf ("%s/v1alpha3 " , defaultCAPIGroup ),
1644+ GroupVersion : fmt .Sprintf ("%s/v1beta2 " , defaultCAPIGroup ),
16451645 APIResources : []metav1.APIResource {
16461646 {
16471647 Name : resourceNameMachineDeployment ,
0 commit comments