@@ -279,6 +279,11 @@ impl KubeClient {
279
279
let timeout_secs = self . timeouts . apply_crd . as_secs ( ) as u32 ;
280
280
let crds: Api < CustomResourceDefinition > = Api :: all ( self . client . clone ( ) ) ;
281
281
282
+ let lp = ListParams :: default ( )
283
+ . fields ( & format ! ( "metadata.name={}" , crd. name( ) ) )
284
+ . timeout ( timeout_secs) ;
285
+ let mut stream = crds. watch ( & lp, "0" ) . await ?. boxed ( ) ;
286
+
282
287
let apply_params = PatchParams :: apply ( "agent_integration_test" ) . force ( ) ;
283
288
crds. patch ( & crd. name ( ) , & apply_params, & Patch :: Apply ( crd) )
284
289
. await ?;
@@ -287,11 +292,6 @@ impl KubeClient {
287
292
return Ok ( ( ) ) ;
288
293
}
289
294
290
- let lp = ListParams :: default ( )
291
- . fields ( & format ! ( "metadata.name={}" , crd. name( ) ) )
292
- . timeout ( timeout_secs) ;
293
- let mut stream = crds. watch ( & lp, "0" ) . await ?. boxed ( ) ;
294
-
295
295
while let Some ( status) = stream. try_next ( ) . await ? {
296
296
if let WatchEvent :: Modified ( crd) = status {
297
297
if is_ready ( & crd) {
@@ -351,14 +351,15 @@ impl KubeClient {
351
351
let timeout_secs = self . timeouts . create . as_secs ( ) as u32 ;
352
352
let api: Api < K > = Api :: namespaced ( self . client . clone ( ) , & self . namespace ) ;
353
353
354
- let resource = from_yaml ( spec) ;
355
- api. create ( & PostParams :: default ( ) , & resource) . await ?;
354
+ let resource: K = from_yaml ( spec) ;
356
355
357
356
let list_params = ListParams :: default ( )
358
357
. fields ( & format ! ( "metadata.name={}" , resource. name( ) ) )
359
358
. timeout ( timeout_secs) ;
360
359
let mut stream = api. watch ( & list_params, "0" ) . await ?. boxed ( ) ;
361
360
361
+ api. create ( & PostParams :: default ( ) , & resource) . await ?;
362
+
362
363
while let Some ( status) = stream. try_next ( ) . await ? {
363
364
if let WatchEvent :: Added ( resource) = status {
364
365
return Ok ( resource) ;
@@ -381,6 +382,11 @@ impl KubeClient {
381
382
let timeout_secs = self . timeouts . delete . as_secs ( ) as u32 ;
382
383
let api: Api < K > = Api :: namespaced ( self . client . clone ( ) , & self . namespace ) ;
383
384
385
+ let list_params = ListParams :: default ( )
386
+ . fields ( & format ! ( "metadata.name={}" , resource. name( ) ) )
387
+ . timeout ( timeout_secs) ;
388
+ let mut stream = api. watch ( & list_params, "0" ) . await ?. boxed ( ) ;
389
+
384
390
let result = api
385
391
. delete ( & resource. name ( ) , & DeleteParams :: default ( ) )
386
392
. await ?;
@@ -389,11 +395,6 @@ impl KubeClient {
389
395
return Ok ( ( ) ) ;
390
396
}
391
397
392
- let list_params = ListParams :: default ( )
393
- . fields ( & format ! ( "metadata.name={}" , resource. name( ) ) )
394
- . timeout ( timeout_secs) ;
395
- let mut stream = api. watch ( & list_params, "0" ) . await ?. boxed ( ) ;
396
-
397
398
while let Some ( status) = stream. try_next ( ) . await ? {
398
399
if let WatchEvent :: Deleted ( _) = status {
399
400
return Ok ( ( ) ) ;
0 commit comments