@@ -19,7 +19,7 @@ package apimachinery
19
19
import (
20
20
"github.com/onsi/ginkgo"
21
21
22
- "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1 "
22
+ v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1 "
23
23
"k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset"
24
24
"k8s.io/apiextensions-apiserver/test/integration/fixtures"
25
25
"k8s.io/apimachinery/pkg/api/equality"
@@ -52,14 +52,14 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
52
52
apiExtensionClient , err := clientset .NewForConfig (config )
53
53
framework .ExpectNoError (err , "initializing apiExtensionClient" )
54
54
55
- randomDefinition := fixtures .NewRandomNameCustomResourceDefinition ( v1beta1 .ClusterScoped )
55
+ randomDefinition := fixtures .NewRandomNameV1CustomResourceDefinition ( v1 .ClusterScoped )
56
56
57
57
// Create CRD and waits for the resource to be recognized and available.
58
- randomDefinition , err = fixtures .CreateNewCustomResourceDefinition (randomDefinition , apiExtensionClient , f .DynamicClient )
58
+ randomDefinition , err = fixtures .CreateNewV1CustomResourceDefinition (randomDefinition , apiExtensionClient , f .DynamicClient )
59
59
framework .ExpectNoError (err , "creating CustomResourceDefinition" )
60
60
61
61
defer func () {
62
- err = fixtures .DeleteCustomResourceDefinition (randomDefinition , apiExtensionClient )
62
+ err = fixtures .DeleteV1CustomResourceDefinition (randomDefinition , apiExtensionClient )
63
63
framework .ExpectNoError (err , "deleting CustomResourceDefinition" )
64
64
}()
65
65
})
@@ -80,30 +80,30 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
80
80
testUUID := string (uuid .NewUUID ())
81
81
82
82
// Create CRD and wait for the resource to be recognized and available.
83
- crds := make ([]* v1beta1 .CustomResourceDefinition , testListSize )
83
+ crds := make ([]* v1 .CustomResourceDefinition , testListSize )
84
84
for i := 0 ; i < testListSize ; i ++ {
85
- crd := fixtures .NewRandomNameCustomResourceDefinition ( v1beta1 .ClusterScoped )
85
+ crd := fixtures .NewRandomNameV1CustomResourceDefinition ( v1 .ClusterScoped )
86
86
crd .Labels = map [string ]string {"e2e-list-test-uuid" : testUUID }
87
- crd , err = fixtures .CreateNewCustomResourceDefinition (crd , apiExtensionClient , f .DynamicClient )
87
+ crd , err = fixtures .CreateNewV1CustomResourceDefinition (crd , apiExtensionClient , f .DynamicClient )
88
88
framework .ExpectNoError (err , "creating CustomResourceDefinition" )
89
89
crds [i ] = crd
90
90
}
91
91
92
92
// Create a crd w/o the label to ensure the label selector matching works correctly
93
- crd := fixtures .NewRandomNameCustomResourceDefinition ( v1beta1 .ClusterScoped )
94
- crd , err = fixtures .CreateNewCustomResourceDefinition (crd , apiExtensionClient , f .DynamicClient )
93
+ crd := fixtures .NewRandomNameV1CustomResourceDefinition ( v1 .ClusterScoped )
94
+ crd , err = fixtures .CreateNewV1CustomResourceDefinition (crd , apiExtensionClient , f .DynamicClient )
95
95
framework .ExpectNoError (err , "creating CustomResourceDefinition" )
96
96
defer func () {
97
- err = fixtures .DeleteCustomResourceDefinition (crd , apiExtensionClient )
97
+ err = fixtures .DeleteV1CustomResourceDefinition (crd , apiExtensionClient )
98
98
framework .ExpectNoError (err , "deleting CustomResourceDefinition" )
99
99
}()
100
100
101
101
selectorListOpts := metav1.ListOptions {LabelSelector : "e2e-list-test-uuid=" + testUUID }
102
- list , err := apiExtensionClient .ApiextensionsV1beta1 ().CustomResourceDefinitions ().List (selectorListOpts )
102
+ list , err := apiExtensionClient .ApiextensionsV1 ().CustomResourceDefinitions ().List (selectorListOpts )
103
103
framework .ExpectNoError (err , "listing CustomResourceDefinitions" )
104
104
framework .ExpectEqual (len (list .Items ), testListSize )
105
105
for _ , actual := range list .Items {
106
- var expected * v1beta1 .CustomResourceDefinition
106
+ var expected * v1 .CustomResourceDefinition
107
107
for _ , e := range crds {
108
108
if e .Name == actual .Name && e .Namespace == actual .Namespace {
109
109
expected = e
@@ -119,7 +119,7 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
119
119
// Use delete collection to remove the CRDs
120
120
err = fixtures .DeleteCustomResourceDefinitions (selectorListOpts , apiExtensionClient )
121
121
framework .ExpectNoError (err , "deleting CustomResourceDefinitions" )
122
- _ , err = apiExtensionClient .ApiextensionsV1beta1 ().CustomResourceDefinitions ().Get (crd .Name , metav1.GetOptions {})
122
+ _ , err = apiExtensionClient .ApiextensionsV1 ().CustomResourceDefinitions ().Get (crd .Name , metav1.GetOptions {})
123
123
framework .ExpectNoError (err , "getting remaining CustomResourceDefinition" )
124
124
})
125
125
@@ -135,20 +135,20 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
135
135
framework .ExpectNoError (err , "initializing apiExtensionClient" )
136
136
dynamicClient , err := dynamic .NewForConfig (config )
137
137
framework .ExpectNoError (err , "initializing dynamic client" )
138
- gvr := v1beta1 .SchemeGroupVersion .WithResource ("customresourcedefinitions" )
138
+ gvr := v1 .SchemeGroupVersion .WithResource ("customresourcedefinitions" )
139
139
resourceClient := dynamicClient .Resource (gvr )
140
140
141
141
// Create CRD and waits for the resource to be recognized and available.
142
- crd := fixtures .NewRandomNameCustomResourceDefinition ( v1beta1 .ClusterScoped )
143
- crd , err = fixtures .CreateNewCustomResourceDefinition (crd , apiExtensionClient , f .DynamicClient )
142
+ crd := fixtures .NewRandomNameV1CustomResourceDefinition ( v1 .ClusterScoped )
143
+ crd , err = fixtures .CreateNewV1CustomResourceDefinition (crd , apiExtensionClient , f .DynamicClient )
144
144
framework .ExpectNoError (err , "creating CustomResourceDefinition" )
145
145
defer func () {
146
- err = fixtures .DeleteCustomResourceDefinition (crd , apiExtensionClient )
146
+ err = fixtures .DeleteV1CustomResourceDefinition (crd , apiExtensionClient )
147
147
framework .ExpectNoError (err , "deleting CustomResourceDefinition" )
148
148
}()
149
149
150
- var updated * v1beta1 .CustomResourceDefinition
151
- updateCondition := v1beta1 .CustomResourceDefinitionCondition {Message : "updated" }
150
+ var updated * v1 .CustomResourceDefinition
151
+ updateCondition := v1 .CustomResourceDefinitionCondition {Message : "updated" }
152
152
err = retry .RetryOnConflict (retry .DefaultRetry , func () error {
153
153
// Use dynamic client to read the status sub-resource since typed client does not expose it.
154
154
u , err := resourceClient .Get (crd .GetName (), metav1.GetOptions {}, "status" )
@@ -158,14 +158,14 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
158
158
e2elog .Failf ("Expected CustomResourceDefinition Spec to match status sub-resource Spec, but got:\n %s" , diff .ObjectReflectDiff (status .Spec , crd .Spec ))
159
159
}
160
160
status .Status .Conditions = append (status .Status .Conditions , updateCondition )
161
- updated , err = apiExtensionClient .ApiextensionsV1beta1 ().CustomResourceDefinitions ().UpdateStatus (status )
161
+ updated , err = apiExtensionClient .ApiextensionsV1 ().CustomResourceDefinitions ().UpdateStatus (status )
162
162
return err
163
163
})
164
164
framework .ExpectNoError (err , "updating CustomResourceDefinition status" )
165
165
expectCondition (updated .Status .Conditions , updateCondition )
166
166
167
- patchCondition := v1beta1 .CustomResourceDefinitionCondition {Message : "patched" }
168
- patched , err := apiExtensionClient .ApiextensionsV1beta1 ().CustomResourceDefinitions ().Patch (
167
+ patchCondition := v1 .CustomResourceDefinitionCondition {Message : "patched" }
168
+ patched , err := apiExtensionClient .ApiextensionsV1 ().CustomResourceDefinitions ().Patch (
169
169
crd .GetName (),
170
170
types .JSONPatchType ,
171
171
[]byte (`[{"op": "add", "path": "/status/conditions", "value": [{"message": "patched"}]}]` ),
@@ -177,14 +177,14 @@ var _ = SIGDescribe("CustomResourceDefinition resources", func() {
177
177
})
178
178
})
179
179
180
- func unstructuredToCRD (obj * unstructured.Unstructured ) * v1beta1 .CustomResourceDefinition {
181
- crd := new (v1beta1 .CustomResourceDefinition )
180
+ func unstructuredToCRD (obj * unstructured.Unstructured ) * v1 .CustomResourceDefinition {
181
+ crd := new (v1 .CustomResourceDefinition )
182
182
err := runtime .DefaultUnstructuredConverter .FromUnstructured (obj .Object , crd )
183
183
framework .ExpectNoError (err , "converting unstructured to CustomResourceDefinition" )
184
184
return crd
185
185
}
186
186
187
- func expectCondition (conditions []v1beta1 .CustomResourceDefinitionCondition , expected v1beta1 .CustomResourceDefinitionCondition ) {
187
+ func expectCondition (conditions []v1 .CustomResourceDefinitionCondition , expected v1 .CustomResourceDefinitionCondition ) {
188
188
for _ , c := range conditions {
189
189
if equality .Semantic .DeepEqual (c , expected ) {
190
190
return
0 commit comments