@@ -125,8 +125,8 @@ export async function createJobAndWaitForCompletion(
125125 world . logger . debug ( `Acquired lock for job: ${ jobName } ` ) ;
126126
127127 // Read the cron job and prepare the job spec
128- const cronJob = await batchClient . readNamespacedCronJob ( jobName , 'default' ) ;
129- const cronJobSpec = cronJob . body . spec ?. jobTemplate . spec ;
128+ const cronJob = await batchClient . readNamespacedCronJob ( { name : jobName , namespace : 'default' } ) ;
129+ const cronJobSpec = cronJob . spec ?. jobTemplate . spec ;
130130
131131 const job = new V1Job ( ) ;
132132 const metadata = new V1ObjectMeta ( ) ;
@@ -143,10 +143,10 @@ export async function createJobAndWaitForCompletion(
143143 job . metadata = metadata ;
144144
145145 // Create the job
146- const response = await batchClient . createNamespacedJob ( 'default' , job ) ;
147- world . logger . debug ( 'Job created' , { job : response . body . metadata } ) ;
146+ const response = await batchClient . createNamespacedJob ( { namespace : 'default' , body : job } ) ;
147+ world . logger . debug ( 'Job created' , { job : response . metadata } ) ;
148148
149- const expectedJobName = response . body . metadata ?. name ;
149+ const expectedJobName = response . metadata ?. name ;
150150
151151 // Watch for job completion
152152 await new Promise < void > ( ( resolve , reject ) => {
@@ -195,8 +195,8 @@ export async function createAndRunPod(
195195 const watchClient = createKubeWatchClient ( world ) ;
196196
197197 try {
198- const response = await clientCore . createNamespacedPod ( 'default' , podManifest ) ;
199- const podName = response . body . metadata ?. name ;
198+ const response = await clientCore . createNamespacedPod ( { namespace : 'default' , body : podManifest } ) ;
199+ const podName = response . metadata ?. name ;
200200 if ( waitForCompletion && podName ) {
201201 world . logger . debug ( 'Waiting for pod completion' , { podName } ) ;
202202
@@ -240,13 +240,13 @@ export async function createAndRunPod(
240240 if ( cleanup && podName ) {
241241 world . logger . debug ( 'Cleaning up pod' , { podName } ) ;
242242 try {
243- await clientCore . deleteNamespacedPod ( podName , 'default' ) ;
243+ await clientCore . deleteNamespacedPod ( { name : podName , namespace : 'default' } ) ;
244244 } catch ( cleanupErr ) {
245245 world . logger . warn ( 'Failed to cleanup pod' , { podName, err : cleanupErr } ) ;
246246 }
247247 }
248248
249- return response . body ;
249+ return response ;
250250 } catch ( err : unknown ) {
251251 world . logger . error ( 'Failed to create and run pod:' , { err } ) ;
252252 throw new Error ( `Failed to create and run pod: ${ err } ` ) ;
@@ -288,13 +288,13 @@ export async function waitForZenkoToStabilize(
288288 const zenkoClient = createKubeCustomObjectClient ( world ) ;
289289
290290 while ( ! status && Date . now ( ) - startTime < timeout ) {
291- const zenkoCR = await zenkoClient . getNamespacedCustomObject (
292- 'zenko.io' ,
293- 'v1alpha2' ,
291+ const zenkoCR = await zenkoClient . getNamespacedCustomObject ( {
292+ group : 'zenko.io' ,
293+ version : 'v1alpha2' ,
294294 namespace,
295- 'zenkos' ,
296- 'end2end' ,
297- ) . catch ( err => {
295+ plural : 'zenkos' ,
296+ name : 'end2end' ,
297+ } ) . catch ( err => {
298298 world . logger . error ( 'Error getting Zenko CR' , {
299299 err : err as unknown ,
300300 } ) ;
@@ -306,7 +306,7 @@ export async function waitForZenkoToStabilize(
306306 continue ;
307307 }
308308
309- const conditions : ZenkoStatus = ( zenkoCR . body as {
309+ const conditions : ZenkoStatus = ( zenkoCR as {
310310 status : {
311311 conditions : ZenkoStatus ,
312312 } ,
@@ -367,8 +367,8 @@ export async function waitForDataServicesToStabilize(world: Zenko, timeout = 15
367367
368368 // First list all deployments, and then filter the ones with an annotation that matches the data services
369369 const deployments : V1Deployment [ ] = [ ] ;
370- const serviceDeployments = await appsClient . listNamespacedDeployment ( namespace ) ;
371- for ( const deployment of serviceDeployments . body . items ) {
370+ const serviceDeployments = await appsClient . listNamespacedDeployment ( { namespace } ) ;
371+ for ( const deployment of serviceDeployments . items ) {
372372 const annotations = deployment . metadata ?. annotations ;
373373 if ( annotations && dataServices . some ( service => annotations [ annotationKey ] ?. includes ( service ) ) ) {
374374 deployments . push ( deployment ) ;
@@ -389,11 +389,12 @@ export async function waitForDataServicesToStabilize(world: Zenko, timeout = 15
389389 throw new Error ( 'Deployment name not found' ) ;
390390 }
391391
392- const deploymentStatus = await appsClient . readNamespacedDeploymentStatus ( deploymentName , namespace ) ;
393- const replicas = deploymentStatus . body . status ?. replicas ;
394- const readyReplicas = deploymentStatus . body . status ?. readyReplicas ;
395- const updatedReplicas = deploymentStatus . body . status ?. updatedReplicas ;
396- const availableReplicas = deploymentStatus . body . status ?. availableReplicas ;
392+ const deploymentStatus = await appsClient
393+ . readNamespacedDeploymentStatus ( { name : deploymentName , namespace } ) ;
394+ const replicas = deploymentStatus . status ?. replicas ;
395+ const readyReplicas = deploymentStatus . status ?. readyReplicas ;
396+ const updatedReplicas = deploymentStatus . status ?. updatedReplicas ;
397+ const availableReplicas = deploymentStatus . status ?. availableReplicas ;
397398
398399 world . logger . debug ( 'Checking deployment status' , {
399400 deployment : deploymentName ,
@@ -426,13 +427,13 @@ export async function waitForDataServicesToStabilize(world: Zenko, timeout = 15
426427export async function displayCRStatus ( world : Zenko , namespace = 'default' ) {
427428 const zenkoClient = createKubeCustomObjectClient ( world ) ;
428429
429- const zenkoCR = await zenkoClient . getNamespacedCustomObject (
430- 'zenko.io' ,
431- 'v1alpha2' ,
430+ const zenkoCR = await zenkoClient . getNamespacedCustomObject ( {
431+ group : 'zenko.io' ,
432+ version : 'v1alpha2' ,
432433 namespace,
433- 'zenkos' ,
434- 'end2end' ,
435- ) . catch ( err => {
434+ plural : 'zenkos' ,
435+ name : 'end2end' ,
436+ } ) . catch ( err => {
436437 world . logger . error ( 'Error getting Zenko CR' , {
437438 err : err as unknown ,
438439 } ) ;
@@ -451,44 +452,44 @@ export async function displayCRStatus(world: Zenko, namespace = 'default') {
451452export async function getDRSource ( world : Zenko , namespace = 'default' ) {
452453 const zenkoClient = createKubeCustomObjectClient ( world ) ;
453454
454- const zenkoCR = await zenkoClient . getNamespacedCustomObject (
455- 'zenko.io' ,
456- 'v1alpha1' ,
455+ const zenkoCR = await zenkoClient . getNamespacedCustomObject ( {
456+ group : 'zenko.io' ,
457+ version : 'v1alpha1' ,
457458 namespace,
458- 'zenkodrsources' ,
459- 'end2end-source' ,
460- ) . catch ( err => {
459+ plural : 'zenkodrsources' ,
460+ name : 'end2end-source' ,
461+ } ) . catch ( err => {
461462 world . logger . debug ( 'Error getting Zenko CR' , {
462463 err : err as unknown ,
463464 } ) ;
464465 } ) ;
465466
466- return zenkoCR ?. body ;
467+ return zenkoCR ;
467468}
468469
469470export async function getDRSink ( world : Zenko , namespace = 'default' ) {
470471 const zenkoClient = createKubeCustomObjectClient ( world ) ;
471472
472- const zenkoCR = await zenkoClient . getNamespacedCustomObject (
473- 'zenko.io' ,
474- 'v1alpha1' ,
473+ const zenkoCR = await zenkoClient . getNamespacedCustomObject ( {
474+ group : 'zenko.io' ,
475+ version : 'v1alpha1' ,
475476 namespace,
476- 'zenkodrsinks' ,
477- 'end2end-pra-sink' ,
478- ) . catch ( err => {
477+ plural : 'zenkodrsinks' ,
478+ name : 'end2end-pra-sink' ,
479+ } ) . catch ( err => {
479480 world . logger . debug ( 'Error getting Zenko CR' , {
480481 err : err as unknown ,
481482 } ) ;
482483 } ) ;
483484
484- return zenkoCR ?. body ;
485+ return zenkoCR ;
485486}
486487
487488export async function getPVCFromLabel ( world : Zenko , label : string , value : string , namespace = 'default' ) {
488489 const coreClient = createKubeCoreClient ( world ) ;
489490
490- const pvcList = await coreClient . listNamespacedPersistentVolumeClaim ( namespace ) ;
491- const pvc = pvcList . body . items . find ( ( pvc : V1PersistentVolumeClaim ) => pvc . metadata ?. labels ?. [ label ] === value ) ;
491+ const pvcList = await coreClient . listNamespacedPersistentVolumeClaim ( { namespace } ) ;
492+ const pvc = pvcList . items . find ( ( pvc : V1PersistentVolumeClaim ) => pvc . metadata ?. labels ?. [ label ] === value ) ;
492493
493494 return pvc ;
494495}
@@ -511,7 +512,7 @@ export async function createSecret(
511512 } ;
512513
513514 try {
514- await coreClient . deleteNamespacedSecret ( secretName , namespace ) ;
515+ await coreClient . deleteNamespacedSecret ( { name : secretName , namespace } ) ;
515516 } catch ( err ) {
516517 world . logger . debug ( 'Secret does not exist, creating new' , {
517518 secretName,
@@ -521,7 +522,7 @@ export async function createSecret(
521522 }
522523
523524 try {
524- const response = await coreClient . createNamespacedSecret ( namespace , secret ) ;
525+ const response = await coreClient . createNamespacedSecret ( { namespace, body : secret } ) ;
525526 return response ;
526527 } catch ( err ) {
527528 world . logger . error ( 'Error creating secret' , {
@@ -540,15 +541,15 @@ export async function getMongoDBConfig(
540541 const customObjectClient = createKubeCustomObjectClient ( world ) ;
541542 try {
542543 // Get replicaSetHosts from Zenko CR
543- const zenkoCR = await customObjectClient . getNamespacedCustomObject (
544- 'zenko.io' ,
545- 'v1alpha2' ,
544+ const zenkoCR = await customObjectClient . getNamespacedCustomObject ( {
545+ group : 'zenko.io' ,
546+ version : 'v1alpha2' ,
546547 namespace,
547- 'zenkos' ,
548- 'end2end'
549- ) ;
548+ plural : 'zenkos' ,
549+ name : 'end2end' ,
550+ } ) ;
550551 // eslint-disable-next-line @typescript-eslint/no-explicit-any
551- const mongodbSpec = ( zenkoCR . body as any ) ?. spec ?. mongodb ;
552+ const mongodbSpec = ( zenkoCR as any ) ?. spec ?. mongodb ;
552553 const mongodbConfig = {
553554 replicaSetHosts : mongodbSpec ?. endpoints || [ ] ,
554555 } ;
@@ -568,16 +569,12 @@ export async function getLocationConfigs(
568569 const coreClient = createKubeCoreClient ( world ) ;
569570 try {
570571 // Get location configurations from connector-cloudserver-config secret
571- const secretList = await coreClient . listNamespacedSecret (
572+ const secretList = await coreClient . listNamespacedSecret ( {
572573 namespace,
573- undefined ,
574- undefined ,
575- undefined ,
576- undefined ,
577- 'app.kubernetes.io/name=connector-cloudserver-config'
578- ) ;
579-
580- const secret = secretList . body . items [ 0 ] ;
574+ labelSelector : 'app.kubernetes.io/name=connector-cloudserver-config' ,
575+ } ) ;
576+
577+ const secret = secretList . items [ 0 ] ;
581578 const locationConfigData = secret . data ?. [ 'locationConfig.json' ] ;
582579 if ( ! locationConfigData ) {
583580 throw new Error ( 'locationConfig.json not found in secret' ) ;
@@ -597,13 +594,13 @@ export async function getZenkoVersion(
597594) : Promise < ZenkoVersion > {
598595 const customObjectClient = createKubeCustomObjectClient ( world ) ;
599596 try {
600- const zenkoVersionList = await customObjectClient . listNamespacedCustomObject (
601- 'zenko.io' ,
602- 'v1alpha1' ,
597+ const zenkoVersionList = await customObjectClient . listNamespacedCustomObject ( {
598+ group : 'zenko.io' ,
599+ version : 'v1alpha1' ,
603600 namespace,
604- 'zenkoversions'
605- ) ;
606- const zenkoVersionItems = ( zenkoVersionList . body as { items : ZenkoVersion [ ] } ) ?. items ;
601+ plural : 'zenkoversions' ,
602+ } ) ;
603+ const zenkoVersionItems = ( zenkoVersionList as { items : ZenkoVersion [ ] } ) ?. items ;
607604 if ( ! zenkoVersionItems || zenkoVersionItems . length === 0 ) {
608605 throw new Error ( 'No ZenkoVersion resources found' ) ;
609606 }
0 commit comments