@@ -8,10 +8,9 @@ import (
88 "time"
99
1010 operatorv1 "github.com/openshift/api/operator/v1"
11- operatorv1alpha1 "github.com/openshift/api/operator/v1alpha1"
1211 configclient "github.com/openshift/client-go/config/clientset/versioned"
1312 configinformer "github.com/openshift/client-go/config/informers/externalversions"
14- operatorv1alpha1apply "github.com/openshift/client-go/operator/applyconfigurations/operator/v1alpha1 "
13+ operatorv1apply "github.com/openshift/client-go/operator/applyconfigurations/operator/v1 "
1514 operatorclient "github.com/openshift/client-go/operator/clientset/versioned"
1615 operatorinformers "github.com/openshift/client-go/operator/informers/externalversions"
1716 "github.com/openshift/library-go/pkg/controller/controllercmd"
@@ -191,19 +190,19 @@ type OperatorClient struct {
191190}
192191
193192func (o OperatorClient ) Informer () cache.SharedIndexInformer {
194- return o .informers .Operator ().V1alpha1 ().OLMs ().Informer ()
193+ return o .informers .Operator ().V1 ().OLMs ().Informer ()
195194}
196195
197196func (o OperatorClient ) GetObjectMeta () (* metav1.ObjectMeta , error ) {
198- olm , err := o .clientset .OperatorV1alpha1 ().OLMs ().Get (context .TODO (), globalConfigName , metav1.GetOptions {})
197+ olm , err := o .clientset .OperatorV1 ().OLMs ().Get (context .TODO (), globalConfigName , metav1.GetOptions {})
199198 if err != nil {
200199 return nil , err
201200 }
202201 return & olm .ObjectMeta , nil
203202}
204203
205204func (o OperatorClient ) GetOperatorState () (* operatorv1.OperatorSpec , * operatorv1.OperatorStatus , string , error ) {
206- orig , err := o .informers .Operator ().V1alpha1 ().OLMs ().Lister ().Get (globalConfigName )
205+ orig , err := o .informers .Operator ().V1 ().OLMs ().Lister ().Get (globalConfigName )
207206 if err != nil {
208207 return nil , nil , "" , err
209208 }
@@ -213,7 +212,7 @@ func (o OperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv
213212}
214213
215214func (o OperatorClient ) GetOperatorStateWithQuorum (ctx context.Context ) (* operatorv1.OperatorSpec , * operatorv1.OperatorStatus , string , error ) {
216- orig , err := o .clientset .OperatorV1alpha1 ().OLMs ().Get (ctx , globalConfigName , metav1.GetOptions {})
215+ orig , err := o .clientset .OperatorV1 ().OLMs ().Get (ctx , globalConfigName , metav1.GetOptions {})
217216 if err != nil {
218217 return nil , nil , "" , err
219218 }
@@ -228,7 +227,7 @@ func (o OperatorClient) UpdateOperatorSpec(ctx context.Context, oldResourceVersi
228227 return nil , "" , fmt .Errorf ("error generating patch: %w" , err )
229228 }
230229
231- out , err := o .clientset .OperatorV1alpha1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )})
230+ out , err := o .clientset .OperatorV1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )})
232231 if err != nil {
233232 return nil , "" , err
234233 }
@@ -241,54 +240,54 @@ func (o OperatorClient) UpdateOperatorStatus(ctx context.Context, oldResourceVer
241240 return nil , fmt .Errorf ("error generating patch: %w" , err )
242241 }
243242
244- out , err := o .clientset .OperatorV1alpha1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )}, "status" )
243+ out , err := o .clientset .OperatorV1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )}, "status" )
245244 if err != nil {
246245 return nil , err
247246 }
248247 return & out .Status .OperatorStatus , nil
249248}
250249
251250func (o OperatorClient ) EnsureFinalizer (ctx context.Context , finalizer string ) error {
252- instance , err := o .informers .Operator ().V1alpha1 ().OLMs ().Lister ().Get (globalConfigName )
251+ instance , err := o .informers .Operator ().V1 ().OLMs ().Lister ().Get (globalConfigName )
253252 if err != nil {
254253 return err
255254 }
256255 newFinalizers := sets .List (sets .New (instance .GetFinalizers ()... ).Insert (finalizer ))
257256
258- olm := operatorv1alpha1apply .OLM (globalConfigName ).WithFinalizers (newFinalizers ... )
257+ olm := operatorv1apply .OLM (globalConfigName ).WithFinalizers (newFinalizers ... )
259258 patch , err := json .Marshal (olm )
260259 if err != nil {
261260 return err
262261 }
263262
264- if _ , err := o .clientset .OperatorV1alpha1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )}); err != nil {
263+ if _ , err := o .clientset .OperatorV1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )}); err != nil {
265264 return err
266265 }
267266 return nil
268267}
269268
270269func (o OperatorClient ) RemoveFinalizer (ctx context.Context , finalizer string ) error {
271- instance , err := o .informers .Operator ().V1alpha1 ().OLMs ().Lister ().Get (globalConfigName )
270+ instance , err := o .informers .Operator ().V1 ().OLMs ().Lister ().Get (globalConfigName )
272271 if err != nil {
273272 return err
274273 }
275274 newFinalizers := sets .List (sets .New (instance .GetFinalizers ()... ).Delete (finalizer ))
276275
277- olm := operatorv1alpha1apply .OLM (globalConfigName ).WithFinalizers (newFinalizers ... )
276+ olm := operatorv1apply .OLM (globalConfigName ).WithFinalizers (newFinalizers ... )
278277 patch , err := json .Marshal (olm )
279278 if err != nil {
280279 return err
281280 }
282281
283- if _ , err := o .clientset .OperatorV1alpha1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )}); err != nil {
282+ if _ , err := o .clientset .OperatorV1 ().OLMs ().Patch (ctx , globalConfigName , types .ApplyPatchType , patch , metav1.PatchOptions {FieldManager : fieldManager , Force : ptr .To (true )}); err != nil {
284283 return err
285284 }
286285 return nil
287286}
288287
289288func generateOLMPatch (resourceVersion string , in any , fieldPath ... string ) ([]byte , error ) {
290289 var u unstructured.Unstructured
291- u .SetAPIVersion (schema.GroupVersion {Group : operatorv1alpha1 .GroupName , Version : "v1alpha1 " }.String ())
290+ u .SetAPIVersion (schema.GroupVersion {Group : operatorv1 .GroupName , Version : "v1 " }.String ())
292291 u .SetKind ("OLM" )
293292 u .SetResourceVersion (resourceVersion )
294293
0 commit comments