@@ -21,7 +21,6 @@ import (
21
21
"flag"
22
22
"fmt"
23
23
"os"
24
- "strings"
25
24
26
25
"k8s.io/apimachinery/pkg/fields"
27
26
"k8s.io/apimachinery/pkg/runtime"
@@ -69,7 +68,7 @@ func main() {
69
68
var enableLeaderElection bool
70
69
var probeAddr string
71
70
var apiExportName string
72
- flag .StringVar (& apiExportName , "api-export-name" , "" , "The name of the APIExport." )
71
+ flag .StringVar (& apiExportName , "api-export-name" , "data.my.domain " , "The name of the APIExport." )
73
72
flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
74
73
flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081" , "The address the probe endpoint binds to." )
75
74
flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
@@ -176,14 +175,10 @@ func restConfigForAPIExport(ctx context.Context, cfg *rest.Config, apiExportName
176
175
return nil , fmt .Errorf ("error creating APIExport client: %w" , err )
177
176
}
178
177
179
- var opts []client.ListOption
180
- if apiExportName != "" {
181
- opts = append (opts , client.MatchingFieldsSelector {
182
- Selector : fields .OneTermEqualSelector ("metadata.name" , apiExportName ),
183
- })
178
+ selector := client.MatchingFieldsSelector {
179
+ Selector : fields .OneTermEqualSelector ("metadata.name" , apiExportName ),
184
180
}
185
-
186
- watch , err := apiExportClient .Watch (ctx , & apisv1alpha1.APIExportList {}, opts ... )
181
+ watch , err := apiExportClient .Watch (ctx , & apisv1alpha1.APIExportList {}, selector )
187
182
if err != nil {
188
183
return nil , fmt .Errorf ("error watching for APIExport: %w" , err )
189
184
}
@@ -197,7 +192,7 @@ func restConfigForAPIExport(ctx context.Context, cfg *rest.Config, apiExportName
197
192
if ! ok {
198
193
// The channel has been closed. Let's retry watching in case it timed out on idle,
199
194
// or fail in case connection to the server cannot be re-established.
200
- watch , err = apiExportClient .Watch (ctx , & apisv1alpha1.APIExportList {}, opts ... )
195
+ watch , err = apiExportClient .Watch (ctx , & apisv1alpha1.APIExportList {}, selector )
201
196
if err != nil {
202
197
return nil , fmt .Errorf ("error watching for APIExport: %w" , err )
203
198
}
@@ -210,12 +205,6 @@ func restConfigForAPIExport(ctx context.Context, cfg *rest.Config, apiExportName
210
205
211
206
setupLog .Info ("APIExport event received" , "name" , apiExport .Name , "event" , e .Type )
212
207
213
- if resources := apiExport .Spec .LatestResourceSchemas ; apiExportName == "" &&
214
- (len (resources ) == 0 || ! strings .HasSuffix (resources [0 ], datav1alpha1 .GroupVersion .Group )) {
215
- // This is not this controller APIExport
216
- continue
217
- }
218
-
219
208
if ! conditions .IsTrue (apiExport , apisv1alpha1 .APIExportVirtualWorkspaceURLsReady ) {
220
209
setupLog .Info ("APIExport virtual workspace URLs are not ready" , "APIExport" , apiExport .Name )
221
210
continue
0 commit comments