@@ -36,7 +36,6 @@ type reconciler struct {
3636 informerScope kubebindv1alpha2.InformerScope
3737 clusterScopedIsolation kubebindv1alpha2.Isolation
3838
39- getCRD func (name string ) (* apiextensionsv1.CustomResourceDefinition , error )
4039 getAPIResourceSchema func (ctx context.Context , name string ) (* kubebindv1alpha2.APIResourceSchema , error )
4140 getServiceExport func (ns , name string ) (* kubebindv1alpha2.APIServiceExport , error )
4241 createServiceExport func (ctx context.Context , resource * kubebindv1alpha2.APIServiceExport ) (* kubebindv1alpha2.APIServiceExport , error )
@@ -58,44 +57,22 @@ func (r *reconciler) reconcile(ctx context.Context, req *kubebindv1alpha2.APISer
5857
5958func (r * reconciler ) ensureExports (ctx context.Context , req * kubebindv1alpha2.APIServiceExportRequest ) error {
6059 logger := klog .FromContext (ctx )
61-
6260 if req .Status .Phase == kubebindv1alpha2 .APIServiceExportRequestPhasePending {
63- failure := false
6461 for _ , res := range req .Spec .Resources {
65- // backend is created using CRD's as backup. But this is not required.
6662 name := res .Resource + "." + res .Group
67-
6863 apiResourceSchema , err := r .getAPIResourceSchema (ctx , name )
69- switch {
70- case apierrors .IsNotFound (err ):
71- logger .V (1 ).Info ("APIResourceSchema not found, continuing with fallback to CRD conversion to APIResourceSchema" , "name" , name )
72- crd , err := r .getCRD (name )
73- if err != nil && ! apierrors .IsNotFound (err ) {
74- return err
75- }
64+ if err != nil {
7665 if apierrors .IsNotFound (err ) {
7766 conditions .MarkFalse (
7867 req ,
7968 kubebindv1alpha2 .APIServiceExportRequestConditionExportsReady ,
80- "CRDNotFound " ,
69+ "APIResourceSchemaNotFound " ,
8170 conditionsapi .ConditionSeverityError ,
82- "CustomResourceDefinition %s in the service provider cluster not found" ,
71+ "APIResourceSchema %s in the service provider cluster not found" ,
8372 name ,
8473 )
85- failure = true
86- break
87- }
88- schema , err := helpers .CRDToAPIResourceSchema (crd , "" )
89- if err != nil {
9074 return err
9175 }
92- schema .Namespace = req .Namespace
93-
94- logger .V (1 ).Info ("Creating APIResourceSchema" , "name" , schema .Name , "namespace" , schema .Namespace )
95- if apiResourceSchema , err = r .createAPIResourceSchema (ctx , schema ); err != nil {
96- return err
97- }
98- case err != nil :
9976 return err
10077 }
10178
@@ -134,11 +111,8 @@ func (r *reconciler) ensureExports(ctx context.Context, req *kubebindv1alpha2.AP
134111 }
135112 }
136113
137- if ! failure {
138- conditions .MarkTrue (req , kubebindv1alpha2 .APIServiceExportRequestConditionExportsReady )
139- req .Status .Phase = kubebindv1alpha2 .APIServiceExportRequestPhaseSucceeded
140- return nil
141- }
114+ conditions .MarkTrue (req , kubebindv1alpha2 .APIServiceExportRequestConditionExportsReady )
115+ req .Status .Phase = kubebindv1alpha2 .APIServiceExportRequestPhaseSucceeded
142116
143117 if time .Since (req .CreationTimestamp .Time ) > time .Minute {
144118 req .Status .Phase = kubebindv1alpha2 .APIServiceExportRequestPhaseFailed
0 commit comments