7
7
8
8
import type { GetReleasesConfig , ReleaseResult } from './utils/types' ;
9
9
10
- import { fromNodeProviderChain } from '@aws-sdk/credential-providers' ;
10
+ // import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
11
11
12
12
import { EksFilter } from './schema' ;
13
13
import { logger } from './utils/logger' ;
@@ -16,30 +16,30 @@ import { ClusterVersionInformation } from '@aws-sdk/client-eks/dist-types/models
16
16
17
17
export class AwsEKSDataSource {
18
18
19
- private readonly clients : Record < string , EKSClient > = { } ;
19
+ // private readonly clients: Record<string, EKSClient> = {};
20
20
21
21
async getReleases ( {
22
22
packageName : serializedFilter
23
23
} : GetReleasesConfig ) : Promise < ReleaseResult | null > {
24
24
const res = EksFilter . safeParse ( serializedFilter ) ;
25
25
if ( ! res . success ) {
26
+ console . log ( "UPS ERROR" )
26
27
logger . debug (
27
28
{ err : res . error , serializedFilter } ,
28
29
'Error parsing eks-addons config.' ,
29
30
) ;
30
31
return null
31
32
}
32
33
33
- const filter = res . data ;
34
-
35
34
const input : DescribeClusterVersionsCommandInput = {
36
- defaultOnly : false ,
37
- includeAll : true ,
38
- maxResults : 1 ,
35
+ defaultOnly : res . data . default ?? undefined ,
36
+ includeAll : res . data ?. default === undefined ? true : undefined ,
39
37
} ;
38
+ console . log ( input )
40
39
const cmd = new DescribeClusterVersionsCommand ( input )
41
- const response : DescribeClusterVersionsCommandOutput = await this . getClient ( filter ) . send ( cmd )
40
+ const response : DescribeClusterVersionsCommandOutput = await this . getClientS ( ) . send ( cmd )
42
41
const addons : ClusterVersionInformation [ ] = response . clusterVersions ?? [ ] ;
42
+ // console.log(addons)
43
43
const result = {
44
44
releases : addons
45
45
. filter ( ( info ) : info is ClusterVersionInformation & { clusterVersion : string } =>
@@ -50,7 +50,7 @@ export class AwsEKSDataSource {
50
50
status : info . status ,
51
51
} ) )
52
52
}
53
- console . log ( addons )
53
+ // console.log(addons)
54
54
return result
55
55
// return {
56
56
// releases: addons
@@ -73,23 +73,30 @@ export class AwsEKSDataSource {
73
73
// };
74
74
}
75
75
76
- private getClient ( { region, profile } : EksFilter ) : EKSClient {
77
- const cacheKey = `${ region ?? 'default' } #${ profile ?? 'default' } ` ;
78
- if ( ! ( cacheKey in this . clients ) ) {
79
- this . clients [ cacheKey ] = new EKSClient ( {
80
- region : region ?? undefined ,
81
- credentials : fromNodeProviderChain ( profile ? { profile : profile } : undefined )
82
- } )
83
- }
84
- return this . clients [ cacheKey ] ;
76
+ // private getClient({ region, profile }: EksFilter): EKSClient {
77
+ // const cacheKey = `${region ?? 'default'}#${profile ?? 'default'}`;
78
+ // if (!(cacheKey in this.clients)) {
79
+ // this.clients[cacheKey] = new EKSClient({
80
+ // region: region ?? undefined,
81
+ // credentials: fromNodeProviderChain(profile ? { profile: profile } : undefined)
82
+ // })
83
+ // }
84
+ // return this.clients[cacheKey];
85
+ // }
86
+
87
+ private getClientS ( ) : EKSClient {
88
+ return new EKSClient ( )
85
89
}
86
90
}
87
91
88
92
const eks = new AwsEKSDataSource ( )
89
93
90
94
const input : readonly string [ ] = [
91
95
'{}' ,
92
- // '{"addonName":"amazon-cloudwatch-observability", "default":true}'
96
+ '{"default":true}' ,
97
+ '{"default":false}' ,
98
+ // '{"status":"standard-support", "default":true}',
99
+ // '{"status":"standard_support"}',
93
100
] ;
94
101
95
102
input . forEach ( ( el ) => {
0 commit comments