@@ -7,18 +7,20 @@ const k8sCoreApi = kc.makeApiClient(CoreV1Api);
7
7
8
8
const { get } = require ( './config' ) ;
9
9
10
- const lodashGet = require ( 'lodash/get' ) ;
11
- const once = require ( 'lodash/once' ) ;
10
+ //used for owner ref, not used now:
11
+ // const lodashGet = require('lodash/get');
12
+ // const once = require('lodash/once');
12
13
14
+ //used for owner ref, not used now:
13
15
// Gets the Deployment uid for the JuiceBalancer
14
16
// This is required to set the JuiceBalancer as owner of the created JuiceShop Instances
15
- const getJuiceBalancerDeploymentUid = once ( async ( ) => {
16
- const deployment = await k8sAppsApi . readNamespacedDeployment (
17
- 'wrongsecrets-balancer' ,
18
- get ( 'namespace' )
19
- ) ;
20
- return lodashGet ( deployment , [ 'body' , 'metadata' , 'uid' ] , null ) ;
21
- } ) ;
17
+ // const getJuiceBalancerDeploymentUid = once(async () => {
18
+ // const deployment = await k8sAppsApi.readNamespacedDeployment(
19
+ // 'wrongsecrets-balancer',
20
+ // get('namespace')
21
+ // );
22
+ // return lodashGet(deployment, ['body', 'metadata', 'uid'], null);
23
+ // });
22
24
23
25
const createNameSpaceForTeam = async ( team ) => {
24
26
const namedNameSpace = {
@@ -349,23 +351,24 @@ const createDesktopServiceForTeam = async (teamname) =>
349
351
} ) ;
350
352
module . exports . createDesktopServiceForTeam = createDesktopServiceForTeam ;
351
353
352
- async function getOwnerReference ( ) {
353
- if ( get ( 'skipOwnerReference' ) === true ) {
354
- return { } ;
355
- }
356
- return {
357
- ownerReferences : [
358
- {
359
- apiVersion : 'apps/v1' ,
360
- blockOwnerDeletion : true ,
361
- controller : true ,
362
- kind : 'Deployment' ,
363
- name : 'wrongsecrets-balancer' ,
364
- uid : await getJuiceBalancerDeploymentUid ( ) ,
365
- } ,
366
- ] ,
367
- } ;
368
- }
354
+ //used for owner ref, not used now as we cannot do clusterwide owning of namespaced items:
355
+ // async function getOwnerReference() {
356
+ // if (get('skipOwnerReference') === true) {
357
+ // return {};
358
+ // }
359
+ // return {
360
+ // ownerReferences: [
361
+ // {
362
+ // apiVersion: 'apps/v1',
363
+ // blockOwnerDeletion: true,
364
+ // controller: true,
365
+ // kind: 'Deployment',
366
+ // name: 'wrongsecrets-balancer',
367
+ // uid: await getJuiceBalancerDeploymentUid(),
368
+ // },
369
+ // ],
370
+ // };
371
+ // }
369
372
370
373
// TODO fix!
371
374
const getJuiceShopInstances = ( ) =>
@@ -378,16 +381,9 @@ const getJuiceShopInstances = () =>
378
381
// undefined, //labelSelector
379
382
// undefined, //limit
380
383
// `app=wrongsecrets,deployment-context=${get('deploymentContext')}`
381
- . listDeploymentForAllNamespaces (
382
- true ,
383
- false ,
384
- undefined ,
385
- undefined ,
386
- undefined ,
387
- `app=wrongsecrets,deployment-context=${ get ( 'deploymentContext' ) } `
388
- )
384
+ . listDeploymentForAllNamespaces ( )
389
385
. catch ( ( error ) => {
390
- throw new Error ( error . response . body . message ) ;
386
+ throw new Error ( error ) ;
391
387
} ) ;
392
388
module . exports . getJuiceShopInstances = getJuiceShopInstances ;
393
389
0 commit comments