timonel 2.8.1 → 2.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cli.d.ts +0 -1
  3. package/dist/cli.js +290 -226
  4. package/dist/index.d.ts +0 -5
  5. package/dist/index.js +0 -6
  6. package/dist/lib/helm.d.ts +0 -472
  7. package/dist/lib/helm.js +0 -481
  8. package/dist/lib/helmChartWriter.d.ts +0 -178
  9. package/dist/lib/helmChartWriter.js +0 -180
  10. package/dist/lib/resources/baseResourceProvider.d.ts +0 -46
  11. package/dist/lib/resources/baseResourceProvider.js +1 -47
  12. package/dist/lib/resources/cloud/aws/awsResources.d.ts +0 -144
  13. package/dist/lib/resources/cloud/aws/awsResources.js +1 -163
  14. package/dist/lib/resources/cloud/aws/karpenterResources.d.ts +0 -132
  15. package/dist/lib/resources/cloud/aws/karpenterResources.js +0 -75
  16. package/dist/lib/rutter.d.ts +0 -324
  17. package/dist/lib/rutter.js +8 -352
  18. package/dist/lib/security.d.ts +0 -119
  19. package/dist/lib/security.js +4 -160
  20. package/dist/lib/umbrella.d.ts +0 -24
  21. package/dist/lib/umbrella.js +0 -24
  22. package/dist/lib/umbrellaRutter.d.ts +0 -71
  23. package/dist/lib/umbrellaRutter.js +2 -82
  24. package/dist/lib/utils/helmHelpers.d.ts +0 -39
  25. package/dist/lib/utils/helmHelpers.js +0 -32
  26. package/package.json +1 -1
  27. package/dist/cli.d.ts.map +0 -1
  28. package/dist/cli.js.map +0 -1
  29. package/dist/index.d.ts.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/lib/helm.d.ts.map +0 -1
  32. package/dist/lib/helm.js.map +0 -1
  33. package/dist/lib/helmChartWriter.d.ts.map +0 -1
  34. package/dist/lib/helmChartWriter.js.map +0 -1
  35. package/dist/lib/resources/baseResourceProvider.d.ts.map +0 -1
  36. package/dist/lib/resources/baseResourceProvider.js.map +0 -1
  37. package/dist/lib/resources/cloud/aws/awsResources.d.ts.map +0 -1
  38. package/dist/lib/resources/cloud/aws/awsResources.js.map +0 -1
  39. package/dist/lib/resources/cloud/aws/karpenterResources.d.ts.map +0 -1
  40. package/dist/lib/resources/cloud/aws/karpenterResources.js.map +0 -1
  41. package/dist/lib/rutter.d.ts.map +0 -1
  42. package/dist/lib/rutter.js.map +0 -1
  43. package/dist/lib/security.d.ts.map +0 -1
  44. package/dist/lib/security.js.map +0 -1
  45. package/dist/lib/umbrella.d.ts.map +0 -1
  46. package/dist/lib/umbrella.js.map +0 -1
  47. package/dist/lib/umbrellaRutter.d.ts.map +0 -1
  48. package/dist/lib/umbrellaRutter.js.map +0 -1
  49. package/dist/lib/utils/helmHelpers.d.ts.map +0 -1
  50. package/dist/lib/utils/helmHelpers.js.map +0 -1
@@ -1,164 +1,21 @@
1
1
  import type { ApiObject } from 'cdk8s';
2
2
  import * as kplus from 'cdk8s-plus-33';
3
3
  import { BaseResourceProvider } from '../../baseResourceProvider.js';
4
- /**
5
- * AWS-specific Kubernetes resources provider
6
- * Handles AWS integrations like EBS, EFS, ALB, IRSA, and other AWS services
7
- *
8
- * @since 2.4.0
9
- */
10
4
  export declare class AWSResources extends BaseResourceProvider {
11
5
  private static readonly STORAGE_API_VERSION;
12
- /**
13
- * Creates an AWS EBS StorageClass
14
- * @param spec - EBS StorageClass specification
15
- * @returns Created StorageClass ApiObject
16
- *
17
- * @example
18
- * ```typescript
19
- * awsResources.addEBSStorageClass({
20
- * name: 'fast-ebs',
21
- * volumeType: 'gp3',
22
- * encrypted: true,
23
- * allowVolumeExpansion: true
24
- * });
25
- * ```
26
- *
27
- * @since 2.4.0
28
- */
29
6
  addEBSStorageClass(spec: AWSEBSStorageClassSpec): ApiObject;
30
- /**
31
- * Creates an AWS EFS StorageClass
32
- * @param spec - EFS StorageClass specification
33
- * @returns Created StorageClass ApiObject
34
- *
35
- * @example
36
- * ```typescript
37
- * awsResources.addEFSStorageClass({
38
- * name: 'efs-storage',
39
- * fileSystemId: 'fs-12345678',
40
- * directoryPerms: '0755'
41
- * });
42
- * ```
43
- *
44
- * @since 2.4.0
45
- */
46
7
  addEFSStorageClass(spec: AWSEFSStorageClassSpec): ApiObject;
47
- /**
48
- * Creates an AWS IRSA (IAM Roles for Service Accounts) ServiceAccount
49
- * @param spec - IRSA ServiceAccount specification
50
- * @returns Created ServiceAccount ApiObject
51
- *
52
- * @example
53
- * ```typescript
54
- * awsResources.addIRSAServiceAccount({
55
- * name: 'aws-service-account',
56
- * roleArn: 'arn:aws:iam::123456789012:role/MyRole'
57
- * });
58
- * ```
59
- *
60
- * @since 2.4.0
61
- */
62
8
  addIRSAServiceAccount(spec: AWSIRSAServiceAccountSpec): kplus.ServiceAccount;
63
- /**
64
- * Creates an AWS ALB Ingress
65
- * @param spec - ALB Ingress specification
66
- * @returns Created Ingress ApiObject
67
- *
68
- * @example
69
- * ```typescript
70
- * awsResources.addALBIngress({
71
- * name: 'web-ingress',
72
- * rules: [{
73
- * paths: [{
74
- * path: '/',
75
- * pathType: 'Prefix',
76
- * backend: { service: { name: 'web-service', port: { number: 80 } } }
77
- * }]
78
- * }],
79
- * scheme: 'internet-facing'
80
- * });
81
- * ```
82
- *
83
- * @since 2.4.0
84
- */
85
9
  addALBIngress(spec: AWSALBIngressSpec): kplus.Ingress;
86
- /**
87
- * Validates Ingress paths format according to Kubernetes specification
88
- * @param rules - Ingress rules to validate
89
- * @private
90
- * @since 2.5.0
91
- */
92
10
  private validateIngressPaths;
93
- /**
94
- * Validates a single Ingress rule
95
- * @param rule - Ingress rule to validate
96
- * @private
97
- * @since 2.5.0
98
- */
99
11
  private validateIngressRule;
100
- /**
101
- * Validates a single Ingress path
102
- * @param pathRule - Path rule to validate
103
- * @private
104
- * @since 2.5.0
105
- */
106
12
  private validateIngressPath;
107
- /**
108
- * Validates path format
109
- * @param path - Path to validate
110
- * @private
111
- * @since 2.5.0
112
- */
113
13
  private validatePathFormat;
114
- /**
115
- * Validates path type
116
- * @param pathType - Path type to validate
117
- * @private
118
- * @since 2.5.0
119
- */
120
14
  private validatePathType;
121
- /**
122
- * Validates backend configuration
123
- * @param backend - Backend to validate
124
- * @private
125
- * @since 2.5.0
126
- */
127
15
  private validateBackend;
128
- /**
129
- * Validates StorageClass provisioner is present and valid
130
- * @param provisioner - Provisioner string to validate
131
- * @param storageType - Type of storage (for error messages)
132
- * @private
133
- * @since 2.5.0
134
- */
135
16
  private validateStorageClassProvisioner;
136
- /**
137
- * Validates AWS IAM Role ARN format
138
- * @param roleArn - Role ARN to validate
139
- */
140
17
  private validateRoleArn;
141
- /**
142
- * Builds ALB-specific annotations
143
- * @param spec - ALB Ingress specification
144
- * @returns ALB annotations
145
- */
146
18
  private buildALBAnnotations;
147
- /**
148
- * Creates a ServiceAccount with ECR access annotations
149
- * @param spec - ECR ServiceAccount specification
150
- * @returns Created ServiceAccount ApiObject
151
- *
152
- * @example
153
- * ```typescript
154
- * awsResources.addECRServiceAccount({
155
- * name: 'ecr-service-account',
156
- * roleArn: 'arn:aws:iam::123456789012:role/ECRAccessRole'
157
- * });
158
- * ```
159
- *
160
- * @since 2.7.0
161
- */
162
19
  addECRServiceAccount(spec: AWSECRServiceAccountSpec): kplus.ServiceAccount;
163
20
  }
164
21
  export interface AWSEBSStorageClassSpec {
@@ -237,4 +94,3 @@ export interface AWSALBIngressSpec {
237
94
  labels?: Record<string, string>;
238
95
  annotations?: Record<string, string>;
239
96
  }
240
- //# sourceMappingURL=awsResources.d.ts.map
@@ -1,29 +1,6 @@
1
1
  import * as kplus from 'cdk8s-plus-33';
2
2
  import { BaseResourceProvider } from '../../baseResourceProvider.js';
3
- /**
4
- * AWS-specific Kubernetes resources provider
5
- * Handles AWS integrations like EBS, EFS, ALB, IRSA, and other AWS services
6
- *
7
- * @since 2.4.0
8
- */
9
3
  export class AWSResources extends BaseResourceProvider {
10
- /**
11
- * Creates an AWS EBS StorageClass
12
- * @param spec - EBS StorageClass specification
13
- * @returns Created StorageClass ApiObject
14
- *
15
- * @example
16
- * ```typescript
17
- * awsResources.addEBSStorageClass({
18
- * name: 'fast-ebs',
19
- * volumeType: 'gp3',
20
- * encrypted: true,
21
- * allowVolumeExpansion: true
22
- * });
23
- * ```
24
- *
25
- * @since 2.4.0
26
- */
27
4
  addEBSStorageClass(spec) {
28
5
  const parameters = {
29
6
  type: spec.volumeType ?? 'gp3',
@@ -40,26 +17,9 @@ export class AWSResources extends BaseResourceProvider {
40
17
  allowVolumeExpansion: spec.allowVolumeExpansion ?? true,
41
18
  volumeBindingMode: spec.volumeBindingMode ?? 'WaitForFirstConsumer',
42
19
  };
43
- // Validate EBS-specific provisioner
44
20
  this.validateStorageClassProvisioner(provisioner, 'EBS');
45
21
  return this.createRootLevelApiObject(spec.name, AWSResources.STORAGE_API_VERSION, 'StorageClass', fields, spec.labels, spec.annotations);
46
22
  }
47
- /**
48
- * Creates an AWS EFS StorageClass
49
- * @param spec - EFS StorageClass specification
50
- * @returns Created StorageClass ApiObject
51
- *
52
- * @example
53
- * ```typescript
54
- * awsResources.addEFSStorageClass({
55
- * name: 'efs-storage',
56
- * fileSystemId: 'fs-12345678',
57
- * directoryPerms: '0755'
58
- * });
59
- * ```
60
- *
61
- * @since 2.4.0
62
- */
63
23
  addEFSStorageClass(spec) {
64
24
  const parameters = {
65
25
  ...(spec.fileSystemId ? { fileSystemId: spec.fileSystemId } : {}),
@@ -75,25 +35,9 @@ export class AWSResources extends BaseResourceProvider {
75
35
  reclaimPolicy: spec.reclaimPolicy ?? 'Delete',
76
36
  volumeBindingMode: spec.volumeBindingMode ?? 'Immediate',
77
37
  };
78
- // Validate EFS-specific provisioner
79
38
  this.validateStorageClassProvisioner(provisioner, 'EFS');
80
39
  return this.createRootLevelApiObject(spec.name, AWSResources.STORAGE_API_VERSION, 'StorageClass', fields, spec.labels, spec.annotations);
81
40
  }
82
- /**
83
- * Creates an AWS IRSA (IAM Roles for Service Accounts) ServiceAccount
84
- * @param spec - IRSA ServiceAccount specification
85
- * @returns Created ServiceAccount ApiObject
86
- *
87
- * @example
88
- * ```typescript
89
- * awsResources.addIRSAServiceAccount({
90
- * name: 'aws-service-account',
91
- * roleArn: 'arn:aws:iam::123456789012:role/MyRole'
92
- * });
93
- * ```
94
- *
95
- * @since 2.4.0
96
- */
97
41
  addIRSAServiceAccount(spec) {
98
42
  this.validateRoleArn(spec.roleArn);
99
43
  const annotations = {
@@ -108,7 +52,6 @@ export class AWSResources extends BaseResourceProvider {
108
52
  },
109
53
  automountToken: spec.automountServiceAccountToken ?? true,
110
54
  });
111
- // Add image pull secrets if specified
112
55
  if (spec.imagePullSecrets) {
113
56
  spec.imagePullSecrets.forEach((secret) => {
114
57
  serviceAccount.addSecret(kplus.Secret.fromSecretName(this.chart, `${spec.name}-secret-${secret.name}`, secret.name));
@@ -116,30 +59,7 @@ export class AWSResources extends BaseResourceProvider {
116
59
  }
117
60
  return serviceAccount;
118
61
  }
119
- /**
120
- * Creates an AWS ALB Ingress
121
- * @param spec - ALB Ingress specification
122
- * @returns Created Ingress ApiObject
123
- *
124
- * @example
125
- * ```typescript
126
- * awsResources.addALBIngress({
127
- * name: 'web-ingress',
128
- * rules: [{
129
- * paths: [{
130
- * path: '/',
131
- * pathType: 'Prefix',
132
- * backend: { service: { name: 'web-service', port: { number: 80 } } }
133
- * }]
134
- * }],
135
- * scheme: 'internet-facing'
136
- * });
137
- * ```
138
- *
139
- * @since 2.4.0
140
- */
141
62
  addALBIngress(spec) {
142
- // Validate ingress paths format
143
63
  this.validateIngressPaths(spec.rules);
144
64
  const annotations = this.buildALBAnnotations(spec);
145
65
  const ingress = new kplus.Ingress(this.chart, spec.name, {
@@ -150,21 +70,15 @@ export class AWSResources extends BaseResourceProvider {
150
70
  },
151
71
  className: spec.ingressClassName ?? 'alb',
152
72
  });
153
- // Add rules to the ingress
154
73
  spec.rules.forEach((rule) => {
155
74
  rule.paths.forEach((path) => {
156
- // Create a service reference for the backend - we need to create a Service instance that references the existing service
157
- const service = new kplus.Service(this.chart, `${spec.name}-service-ref-${path.backend.service.name}`, {
158
- // This creates a reference to an existing service by name
159
- // The service should already exist in the cluster
160
- });
75
+ const service = new kplus.Service(this.chart, `${spec.name}-service-ref-${path.backend.service.name}`, {});
161
76
  const backend = kplus.IngressBackend.fromService(service, {
162
77
  port: path.backend.service.port.number || parseInt(path.backend.service.port.name || '80'),
163
78
  });
164
79
  ingress.addRule(path.path, backend, path.pathType);
165
80
  });
166
81
  });
167
- // Add TLS configuration if specified
168
82
  if (spec.tls) {
169
83
  spec.tls.forEach((tlsConfig) => {
170
84
  if (tlsConfig.secretName && tlsConfig.hosts) {
@@ -179,23 +93,11 @@ export class AWSResources extends BaseResourceProvider {
179
93
  }
180
94
  return ingress;
181
95
  }
182
- /**
183
- * Validates Ingress paths format according to Kubernetes specification
184
- * @param rules - Ingress rules to validate
185
- * @private
186
- * @since 2.5.0
187
- */
188
96
  validateIngressPaths(rules) {
189
97
  for (const rule of rules) {
190
98
  this.validateIngressRule(rule);
191
99
  }
192
100
  }
193
- /**
194
- * Validates a single Ingress rule
195
- * @param rule - Ingress rule to validate
196
- * @private
197
- * @since 2.5.0
198
- */
199
101
  validateIngressRule(rule) {
200
102
  if (!rule.paths || !Array.isArray(rule.paths)) {
201
103
  throw new Error('Ingress rule must have a paths array');
@@ -204,56 +106,29 @@ export class AWSResources extends BaseResourceProvider {
204
106
  this.validateIngressPath(pathRule);
205
107
  }
206
108
  }
207
- /**
208
- * Validates a single Ingress path
209
- * @param pathRule - Path rule to validate
210
- * @private
211
- * @since 2.5.0
212
- */
213
109
  validateIngressPath(pathRule) {
214
110
  this.validatePathFormat(pathRule.path);
215
111
  this.validatePathType(pathRule.pathType);
216
112
  this.validateBackend(pathRule.backend);
217
113
  }
218
- /**
219
- * Validates path format
220
- * @param path - Path to validate
221
- * @private
222
- * @since 2.5.0
223
- */
224
114
  validatePathFormat(path) {
225
115
  if (!path || typeof path !== 'string') {
226
116
  throw new Error('Ingress path must be a non-empty string');
227
117
  }
228
- // Normalize path and check for traversal attempts
229
118
  const normalizedPath = path.replace(/\/+/g, '/');
230
119
  if (!normalizedPath.startsWith('/')) {
231
120
  throw new Error(`Ingress path "${path}" must start with /`);
232
121
  }
233
- // For Kubernetes Ingress paths, we allow URL patterns but warn about suspicious ones
234
122
  if (normalizedPath.includes('../') || normalizedPath.includes('./')) {
235
- // Note: These could be valid URL patterns in some cases, but are suspicious
236
123
  console.warn(`Warning: Ingress path "${path}" contains path traversal-like sequences`);
237
124
  }
238
125
  }
239
- /**
240
- * Validates path type
241
- * @param pathType - Path type to validate
242
- * @private
243
- * @since 2.5.0
244
- */
245
126
  validatePathType(pathType) {
246
127
  const validPathTypes = ['Exact', 'Prefix', 'ImplementationSpecific'];
247
128
  if (!validPathTypes.includes(pathType)) {
248
129
  throw new Error(`Invalid pathType "${pathType}". Must be one of: ${validPathTypes.join(', ')}`);
249
130
  }
250
131
  }
251
- /**
252
- * Validates backend configuration
253
- * @param backend - Backend to validate
254
- * @private
255
- * @since 2.5.0
256
- */
257
132
  validateBackend(backend) {
258
133
  if (!backend?.service?.name) {
259
134
  throw new Error('Ingress path backend must specify service name');
@@ -267,13 +142,6 @@ export class AWSResources extends BaseResourceProvider {
267
142
  throw new Error(`Invalid port number ${port.number}. Must be between 1 and 65535`);
268
143
  }
269
144
  }
270
- /**
271
- * Validates StorageClass provisioner is present and valid
272
- * @param provisioner - Provisioner string to validate
273
- * @param storageType - Type of storage (for error messages)
274
- * @private
275
- * @since 2.5.0
276
- */
277
145
  validateStorageClassProvisioner(provisioner, storageType) {
278
146
  if (!provisioner || typeof provisioner !== 'string' || provisioner.trim() === '') {
279
147
  throw new Error(`${storageType} StorageClass must have a valid provisioner`);
@@ -282,7 +150,6 @@ export class AWSResources extends BaseResourceProvider {
282
150
  EBS: 'ebs.csi.aws.com',
283
151
  EFS: 'efs.csi.aws.com',
284
152
  };
285
- // Validate provisioner matches storage type
286
153
  const expectedProvisioner = validProvisioners[storageType];
287
154
  if (!expectedProvisioner) {
288
155
  throw new Error(`Invalid storage type: ${storageType}`);
@@ -291,12 +158,7 @@ export class AWSResources extends BaseResourceProvider {
291
158
  throw new Error(`Invalid AWS ${storageType} provisioner "${provisioner}". Must be: ${expectedProvisioner}`);
292
159
  }
293
160
  }
294
- /**
295
- * Validates AWS IAM Role ARN format
296
- * @param roleArn - Role ARN to validate
297
- */
298
161
  validateRoleArn(roleArn) {
299
- // Skip validation for Helm template values
300
162
  if (roleArn.includes('{{') && roleArn.includes('}}')) {
301
163
  return;
302
164
  }
@@ -305,15 +167,8 @@ export class AWSResources extends BaseResourceProvider {
305
167
  throw new Error(`Invalid AWS IAM Role ARN format: ${roleArn}`);
306
168
  }
307
169
  }
308
- /**
309
- * Builds ALB-specific annotations
310
- * @param spec - ALB Ingress specification
311
- * @returns ALB annotations
312
- */
313
170
  buildALBAnnotations(spec) {
314
171
  const annotations = {
315
- // Remove deprecated kubernetes.io/ingress.class annotation
316
- // Use spec.ingressClassName instead
317
172
  ...(spec.annotations ?? {}),
318
173
  };
319
174
  if (spec.scheme) {
@@ -333,21 +188,6 @@ export class AWSResources extends BaseResourceProvider {
333
188
  }
334
189
  return annotations;
335
190
  }
336
- /**
337
- * Creates a ServiceAccount with ECR access annotations
338
- * @param spec - ECR ServiceAccount specification
339
- * @returns Created ServiceAccount ApiObject
340
- *
341
- * @example
342
- * ```typescript
343
- * awsResources.addECRServiceAccount({
344
- * name: 'ecr-service-account',
345
- * roleArn: 'arn:aws:iam::123456789012:role/ECRAccessRole'
346
- * });
347
- * ```
348
- *
349
- * @since 2.7.0
350
- */
351
191
  addECRServiceAccount(spec) {
352
192
  const annotations = {
353
193
  'eks.amazonaws.com/role-arn': spec.roleArn,
@@ -361,7 +201,6 @@ export class AWSResources extends BaseResourceProvider {
361
201
  },
362
202
  automountToken: spec.automountServiceAccountToken ?? true,
363
203
  });
364
- // Add image pull secrets if specified
365
204
  if (spec.imagePullSecrets) {
366
205
  spec.imagePullSecrets.forEach((secret) => {
367
206
  serviceAccount.addSecret(kplus.Secret.fromSecretName(this.chart, `${spec.name}-ecr-secret-${secret.name}`, secret.name));
@@ -371,4 +210,3 @@ export class AWSResources extends BaseResourceProvider {
371
210
  }
372
211
  }
373
212
  AWSResources.STORAGE_API_VERSION = 'storage.k8s.io/v1';
374
- //# sourceMappingURL=awsResources.js.map