timonel 3.1.1 → 3.1.2
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.
- package/CHANGELOG.md +7 -0
- package/README.md +323 -695
- package/dist/cli.js +275 -15
- package/dist/index.d.ts +5 -1
- package/dist/index.js +12 -0
- package/dist/lib/helm.d.ts +471 -0
- package/dist/lib/helm.js +483 -0
- package/dist/lib/helmChartWriter.d.ts +157 -0
- package/dist/lib/helmChartWriter.js +171 -1
- package/dist/lib/policy/configurationLoader.d.ts +132 -0
- package/dist/lib/policy/configurationLoader.js +132 -0
- package/dist/lib/policy/errorContextGenerator.d.ts +89 -0
- package/dist/lib/policy/errorContextGenerator.js +99 -2
- package/dist/lib/policy/errors.d.ts +35 -0
- package/dist/lib/policy/errors.js +36 -0
- package/dist/lib/policy/index.d.ts +9 -0
- package/dist/lib/policy/index.js +16 -0
- package/dist/lib/policy/parallelExecutor.d.ts +90 -0
- package/dist/lib/policy/parallelExecutor.js +86 -3
- package/dist/lib/policy/pluginLoader.d.ts +92 -0
- package/dist/lib/policy/pluginLoader.js +92 -1
- package/dist/lib/policy/pluginRegistry.d.ts +54 -0
- package/dist/lib/policy/pluginRegistry.js +56 -0
- package/dist/lib/policy/policyEngine.d.ts +137 -0
- package/dist/lib/policy/policyEngine.js +191 -5
- package/dist/lib/policy/resultAggregator.d.ts +46 -0
- package/dist/lib/policy/resultAggregator.js +69 -1
- package/dist/lib/policy/resultFormatter.d.ts +88 -0
- package/dist/lib/policy/resultFormatter.js +101 -0
- package/dist/lib/policy/types.d.ts +136 -0
- package/dist/lib/policy/types.js +8 -0
- package/dist/lib/policy/validationCache.d.ts +146 -0
- package/dist/lib/policy/validationCache.js +142 -6
- package/dist/lib/resources/baseResourceProvider.d.ts +45 -0
- package/dist/lib/resources/baseResourceProvider.js +48 -1
- package/dist/lib/resources/cloud/aws/awsResources.d.ts +192 -0
- package/dist/lib/resources/cloud/aws/awsResources.js +163 -1
- package/dist/lib/resources/cloud/aws/karpenterResources.d.ts +131 -0
- package/dist/lib/resources/cloud/aws/karpenterResources.js +77 -0
- package/dist/lib/rutter.d.ts +381 -3
- package/dist/lib/rutter.js +439 -28
- package/dist/lib/security.d.ts +123 -0
- package/dist/lib/security.js +162 -4
- package/dist/lib/templates/flexible-subchart.d.ts +52 -0
- package/dist/lib/templates/flexible-subchart.js +70 -0
- package/dist/lib/templates/umbrella-chart.d.ts +27 -0
- package/dist/lib/templates/umbrella-chart.js +89 -0
- package/dist/lib/types.d.ts +26 -0
- package/dist/lib/umbrella.d.ts +23 -0
- package/dist/lib/umbrella.js +23 -0
- package/dist/lib/umbrellaRutter.d.ts +75 -0
- package/dist/lib/umbrellaRutter.js +82 -2
- package/dist/lib/utils/envVarsLoader.d.ts +49 -0
- package/dist/lib/utils/envVarsLoader.js +53 -0
- package/dist/lib/utils/helmConstructSerializer.d.ts +17 -0
- package/dist/lib/utils/helmConstructSerializer.js +22 -0
- package/dist/lib/utils/helmControlStructures.d.ts +194 -0
- package/dist/lib/utils/helmControlStructures.js +180 -0
- package/dist/lib/utils/helmHelpers/envHelpers.d.ts +13 -0
- package/dist/lib/utils/helmHelpers/envHelpers.js +13 -0
- package/dist/lib/utils/helmHelpers/gitopsHelpers.d.ts +13 -0
- package/dist/lib/utils/helmHelpers/gitopsHelpers.js +13 -0
- package/dist/lib/utils/helmHelpers/index.d.ts +74 -0
- package/dist/lib/utils/helmHelpers/index.js +85 -1
- package/dist/lib/utils/helmHelpers/observabilityHelpers.d.ts +13 -0
- package/dist/lib/utils/helmHelpers/observabilityHelpers.js +13 -0
- package/dist/lib/utils/helmHelpers/types.d.ts +23 -0
- package/dist/lib/utils/helmHelpers/types.js +4 -0
- package/dist/lib/utils/helmHelpers/validationHelpers.d.ts +13 -0
- package/dist/lib/utils/helmHelpers/validationHelpers.js +13 -0
- package/dist/lib/utils/helmHelpers.d.ts +62 -0
- package/dist/lib/utils/helmHelpers.js +77 -0
- package/dist/lib/utils/helmYamlSerializer.d.ts +77 -0
- package/dist/lib/utils/helmYamlSerializer.js +398 -21
- package/dist/lib/utils/logger.d.ts +153 -0
- package/dist/lib/utils/logger.js +170 -2
- package/dist/lib/utils/valuesRef.d.ts +181 -50
- package/dist/lib/utils/valuesRef.js +168 -170
- package/dist/lib/validation/inputValidator.d.ts +45 -0
- package/dist/lib/validation/inputValidator.js +67 -2
- package/dist/types/index.d.ts +34 -0
- package/dist/types/index.js +3 -0
- package/package.json +31 -38
|
@@ -1,109 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Karpenter resources for AWS EKS node management
|
|
3
|
+
* @since 2.8.0+
|
|
4
|
+
*/
|
|
1
5
|
import type { ApiObject } from 'cdk8s';
|
|
2
6
|
import { BaseResourceProvider } from '../../baseResourceProvider.js';
|
|
7
|
+
/**
|
|
8
|
+
* Karpenter version compatibility utilities
|
|
9
|
+
* @since 2.8.0+
|
|
10
|
+
*/
|
|
3
11
|
export declare class KarpenterVersionUtils {
|
|
12
|
+
/**
|
|
13
|
+
* Checks if the current Karpenter version supports v1 API
|
|
14
|
+
* @returns true if v1 API is supported, false otherwise
|
|
15
|
+
*/
|
|
4
16
|
static isKarpenterV1Compatible(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the appropriate API version for NodePool resources
|
|
19
|
+
* @returns API version string
|
|
20
|
+
*/
|
|
5
21
|
static getNodePoolApiVersion(): string;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the appropriate API version for NodeClaim resources
|
|
24
|
+
* @returns API version string
|
|
25
|
+
*/
|
|
6
26
|
static getNodeClaimApiVersion(): string;
|
|
7
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Karpenter Disruption Budget specification
|
|
30
|
+
* @since 2.8.0+
|
|
31
|
+
*/
|
|
8
32
|
export interface KarpenterDisruptionBudget {
|
|
33
|
+
/** Number or percentage of nodes that can be disrupted */
|
|
9
34
|
nodes: string;
|
|
35
|
+
/** Cron schedule for when budget applies (optional) */
|
|
10
36
|
schedule?: string;
|
|
37
|
+
/** Duration the budget is active (optional) */
|
|
11
38
|
duration?: string;
|
|
12
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* Validates a KarpenterDisruptionBudget configuration
|
|
42
|
+
* @param budget - The budget to validate
|
|
43
|
+
* @returns true if valid, false otherwise
|
|
44
|
+
* @since 2.8.0+
|
|
45
|
+
*/
|
|
13
46
|
export declare function isValidDisruptionBudget(budget: KarpenterDisruptionBudget): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Validates Kubernetes duration format
|
|
49
|
+
* @param duration - Duration string to validate
|
|
50
|
+
* @returns true if valid, false otherwise
|
|
51
|
+
* @since 2.7.1
|
|
52
|
+
*/
|
|
14
53
|
export declare function isValidKubernetesDuration(duration: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Default termination grace period for Karpenter nodes
|
|
56
|
+
* @since 2.7.1
|
|
57
|
+
*/
|
|
15
58
|
export declare const DEFAULT_TERMINATION_GRACE_PERIOD = "30s";
|
|
59
|
+
/**
|
|
60
|
+
* Karpenter Disruption specification
|
|
61
|
+
* @since 2.7.1
|
|
62
|
+
*/
|
|
16
63
|
export interface KarpenterDisruption {
|
|
64
|
+
/** Consolidation policy */
|
|
17
65
|
consolidationPolicy?: 'WhenEmpty' | 'WhenEmptyOrUnderutilized';
|
|
66
|
+
/** Time to wait before consolidating */
|
|
18
67
|
consolidateAfter?: string;
|
|
68
|
+
/** Node expiration time */
|
|
19
69
|
expireAfter?: string;
|
|
70
|
+
/** Disruption budgets for rate limiting */
|
|
20
71
|
budgets?: KarpenterDisruptionBudget[];
|
|
21
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Karpenter NodePool specification
|
|
75
|
+
* @since 2.8.0+
|
|
76
|
+
*/
|
|
22
77
|
export interface KarpenterNodePoolSpec {
|
|
78
|
+
/** Resource name */
|
|
23
79
|
name: string;
|
|
80
|
+
/** Template for nodes */
|
|
24
81
|
template: {
|
|
25
82
|
metadata?: {
|
|
26
83
|
labels?: Record<string, string>;
|
|
27
84
|
annotations?: Record<string, string>;
|
|
28
85
|
};
|
|
29
86
|
spec: {
|
|
87
|
+
/** Node class reference */
|
|
30
88
|
nodeClassRef: {
|
|
31
89
|
apiVersion: string;
|
|
32
90
|
kind: string;
|
|
33
91
|
name: string;
|
|
34
92
|
};
|
|
93
|
+
/** Node requirements */
|
|
35
94
|
requirements?: Array<{
|
|
36
95
|
key: string;
|
|
37
96
|
operator: 'In' | 'NotIn' | 'Exists' | 'DoesNotExist' | 'Gt' | 'Lt';
|
|
38
97
|
values?: string[];
|
|
39
98
|
}>;
|
|
99
|
+
/** Taints to apply to nodes */
|
|
40
100
|
taints?: Array<{
|
|
41
101
|
key: string;
|
|
42
102
|
value?: string;
|
|
43
103
|
effect: 'NoSchedule' | 'PreferNoSchedule' | 'NoExecute';
|
|
44
104
|
}>;
|
|
105
|
+
/** Startup taints */
|
|
45
106
|
startupTaints?: Array<{
|
|
46
107
|
key: string;
|
|
47
108
|
value?: string;
|
|
48
109
|
effect: 'NoSchedule' | 'PreferNoSchedule' | 'NoExecute';
|
|
49
110
|
}>;
|
|
111
|
+
/** Termination grace period */
|
|
50
112
|
terminationGracePeriod?: string;
|
|
51
113
|
};
|
|
52
114
|
};
|
|
115
|
+
/** Disruption settings */
|
|
53
116
|
disruption?: KarpenterDisruption;
|
|
117
|
+
/** Resource limits */
|
|
54
118
|
limits?: Record<string, string>;
|
|
119
|
+
/** Resource weight for scheduling priority */
|
|
55
120
|
weight?: number;
|
|
121
|
+
/** Resource labels */
|
|
56
122
|
labels?: Record<string, string>;
|
|
123
|
+
/** Resource annotations */
|
|
57
124
|
annotations?: Record<string, string>;
|
|
58
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Karpenter NodeClaim specification
|
|
128
|
+
* @since 2.8.0+
|
|
129
|
+
*/
|
|
59
130
|
export interface KarpenterNodeClaimSpec {
|
|
131
|
+
/** Resource name */
|
|
60
132
|
name: string;
|
|
133
|
+
/** Node class reference */
|
|
61
134
|
nodeClassRef: {
|
|
62
135
|
apiVersion: string;
|
|
63
136
|
kind: string;
|
|
64
137
|
name: string;
|
|
65
138
|
};
|
|
139
|
+
/** Node requirements */
|
|
66
140
|
requirements?: Array<{
|
|
67
141
|
key: string;
|
|
68
142
|
operator: 'In' | 'NotIn' | 'Exists' | 'DoesNotExist' | 'Gt' | 'Lt';
|
|
69
143
|
values?: string[];
|
|
70
144
|
}>;
|
|
145
|
+
/** Taints to apply to node */
|
|
71
146
|
taints?: Array<{
|
|
72
147
|
key: string;
|
|
73
148
|
value?: string;
|
|
74
149
|
effect: 'NoSchedule' | 'PreferNoSchedule' | 'NoExecute';
|
|
75
150
|
}>;
|
|
151
|
+
/** Startup taints */
|
|
76
152
|
startupTaints?: Array<{
|
|
77
153
|
key: string;
|
|
78
154
|
value?: string;
|
|
79
155
|
effect: 'NoSchedule' | 'PreferNoSchedule' | 'NoExecute';
|
|
80
156
|
}>;
|
|
157
|
+
/** Resource labels */
|
|
81
158
|
labels?: Record<string, string>;
|
|
159
|
+
/** Resource annotations */
|
|
82
160
|
annotations?: Record<string, string>;
|
|
83
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Karpenter EC2NodeClass specification
|
|
164
|
+
* @since 2.7.0
|
|
165
|
+
*/
|
|
84
166
|
export interface KarpenterEC2NodeClassSpec {
|
|
167
|
+
/** Resource name */
|
|
85
168
|
name: string;
|
|
169
|
+
/** AMI family */
|
|
86
170
|
amiFamily?: 'AL2' | 'AL2023' | 'Bottlerocket' | 'Ubuntu' | 'Windows2019' | 'Windows2022' | 'Custom';
|
|
171
|
+
/** AMI selector */
|
|
87
172
|
amiSelectorTerms?: Array<{
|
|
88
173
|
tags?: Record<string, string>;
|
|
89
174
|
id?: string;
|
|
90
175
|
name?: string;
|
|
91
176
|
owner?: string;
|
|
92
177
|
}>;
|
|
178
|
+
/** Instance store policy */
|
|
93
179
|
instanceStorePolicy?: 'RAID0' | 'NVME';
|
|
180
|
+
/** Instance profile */
|
|
94
181
|
instanceProfile?: string;
|
|
182
|
+
/** Security group selector */
|
|
95
183
|
securityGroupSelectorTerms?: Array<{
|
|
96
184
|
tags?: Record<string, string>;
|
|
97
185
|
id?: string;
|
|
98
186
|
name?: string;
|
|
99
187
|
}>;
|
|
188
|
+
/** Subnet selector */
|
|
100
189
|
subnetSelectorTerms?: Array<{
|
|
101
190
|
tags?: Record<string, string>;
|
|
102
191
|
id?: string;
|
|
103
192
|
}>;
|
|
193
|
+
/** User data */
|
|
104
194
|
userData?: string;
|
|
195
|
+
/** Role */
|
|
105
196
|
role?: string;
|
|
197
|
+
/** Tags to apply to instances */
|
|
106
198
|
tags?: Record<string, string>;
|
|
199
|
+
/** Block device mappings */
|
|
107
200
|
blockDeviceMappings?: Array<{
|
|
108
201
|
deviceName: string;
|
|
109
202
|
ebs?: {
|
|
@@ -116,19 +209,51 @@ export interface KarpenterEC2NodeClassSpec {
|
|
|
116
209
|
deleteOnTermination?: boolean;
|
|
117
210
|
};
|
|
118
211
|
}>;
|
|
212
|
+
/** Metadata options */
|
|
119
213
|
metadataOptions?: {
|
|
120
214
|
httpEndpoint?: 'enabled' | 'disabled';
|
|
121
215
|
httpProtocolIPv6?: 'enabled' | 'disabled';
|
|
122
216
|
httpPutResponseHopLimit?: number;
|
|
123
217
|
httpTokens?: 'required' | 'optional';
|
|
124
218
|
};
|
|
219
|
+
/** Resource labels */
|
|
125
220
|
labels?: Record<string, string>;
|
|
221
|
+
/** Resource annotations */
|
|
126
222
|
annotations?: Record<string, string>;
|
|
127
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Karpenter resources provider for AWS EKS node management
|
|
226
|
+
* @extends BaseResourceProvider
|
|
227
|
+
* @since 2.7.0
|
|
228
|
+
*/
|
|
128
229
|
export declare class KarpenterResources extends BaseResourceProvider {
|
|
230
|
+
/**
|
|
231
|
+
* Creates a Karpenter NodePool resource
|
|
232
|
+
* @param spec - NodePool specification
|
|
233
|
+
* @returns Created NodePool ApiObject
|
|
234
|
+
* @since 2.8.0+
|
|
235
|
+
*/
|
|
129
236
|
addKarpenterNodePool(spec: KarpenterNodePoolSpec): ApiObject;
|
|
237
|
+
/**
|
|
238
|
+
* Creates a Karpenter NodeClaim resource
|
|
239
|
+
* @param spec - NodeClaim specification
|
|
240
|
+
* @returns Created NodeClaim ApiObject
|
|
241
|
+
* @since 2.7.0
|
|
242
|
+
*/
|
|
130
243
|
addKarpenterNodeClaim(spec: KarpenterNodeClaimSpec): ApiObject;
|
|
244
|
+
/**
|
|
245
|
+
* Creates a Karpenter EC2NodeClass resource
|
|
246
|
+
* @param spec - EC2NodeClass specification
|
|
247
|
+
* @returns Created EC2NodeClass ApiObject
|
|
248
|
+
* @since 2.7.0
|
|
249
|
+
*/
|
|
131
250
|
addKarpenterEC2NodeClass(spec: KarpenterEC2NodeClassSpec): ApiObject;
|
|
251
|
+
/**
|
|
252
|
+
* Creates a Karpenter NodePool with optimized disruption settings for cost efficiency
|
|
253
|
+
* @param spec - NodePool specification with disruption optimization
|
|
254
|
+
* @returns Created NodePool ApiObject
|
|
255
|
+
* @since 2.8.0+
|
|
256
|
+
*/
|
|
132
257
|
addKarpenterNodePoolWithDisruption(spec: {
|
|
133
258
|
name: string;
|
|
134
259
|
nodeClassRef: {
|
|
@@ -150,6 +275,12 @@ export declare class KarpenterResources extends BaseResourceProvider {
|
|
|
150
275
|
labels?: Record<string, string>;
|
|
151
276
|
annotations?: Record<string, string>;
|
|
152
277
|
}): ApiObject;
|
|
278
|
+
/**
|
|
279
|
+
* Creates a Karpenter NodePool with scheduling constraints and priorities
|
|
280
|
+
* @param spec - NodePool specification with scheduling optimization
|
|
281
|
+
* @returns Created NodePool ApiObject
|
|
282
|
+
* @since 2.8.0+
|
|
283
|
+
*/
|
|
153
284
|
addKarpenterNodePoolWithScheduling(spec: {
|
|
154
285
|
name: string;
|
|
155
286
|
nodeClassRef: {
|
|
@@ -1,24 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Karpenter resources for AWS EKS node management
|
|
3
|
+
* @since 2.8.0+
|
|
4
|
+
*/
|
|
1
5
|
import { BaseResourceProvider } from '../../baseResourceProvider.js';
|
|
6
|
+
/**
|
|
7
|
+
* Karpenter version compatibility utilities
|
|
8
|
+
* @since 2.8.0+
|
|
9
|
+
*/
|
|
2
10
|
export class KarpenterVersionUtils {
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the current Karpenter version supports v1 API
|
|
13
|
+
* @returns true if v1 API is supported, false otherwise
|
|
14
|
+
*/
|
|
3
15
|
static isKarpenterV1Compatible() {
|
|
16
|
+
// For now, we assume v1 compatibility since we're targeting Karpenter v1.6+
|
|
17
|
+
// In the future, this could check actual cluster version
|
|
4
18
|
return true;
|
|
5
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the appropriate API version for NodePool resources
|
|
22
|
+
* @returns API version string
|
|
23
|
+
*/
|
|
6
24
|
static getNodePoolApiVersion() {
|
|
7
25
|
return this.isKarpenterV1Compatible() ? 'karpenter.sh/v1' : 'karpenter.sh/v1beta1';
|
|
8
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets the appropriate API version for NodeClaim resources
|
|
29
|
+
* @returns API version string
|
|
30
|
+
*/
|
|
9
31
|
static getNodeClaimApiVersion() {
|
|
10
32
|
return this.isKarpenterV1Compatible() ? 'karpenter.sh/v1' : 'karpenter.sh/v1beta1';
|
|
11
33
|
}
|
|
12
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Validates a KarpenterDisruptionBudget configuration
|
|
37
|
+
* @param budget - The budget to validate
|
|
38
|
+
* @returns true if valid, false otherwise
|
|
39
|
+
* @since 2.8.0+
|
|
40
|
+
*/
|
|
13
41
|
export function isValidDisruptionBudget(budget) {
|
|
14
42
|
const nodePattern = /^(\d+%|\d+)$/;
|
|
15
43
|
return nodePattern.test(budget.nodes);
|
|
16
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Validates Kubernetes duration format
|
|
47
|
+
* @param duration - Duration string to validate
|
|
48
|
+
* @returns true if valid, false otherwise
|
|
49
|
+
* @since 2.7.1
|
|
50
|
+
*/
|
|
17
51
|
export function isValidKubernetesDuration(duration) {
|
|
18
52
|
try {
|
|
53
|
+
// Validate input is a string
|
|
19
54
|
if (typeof duration !== 'string') {
|
|
20
55
|
return false;
|
|
21
56
|
}
|
|
57
|
+
// eslint-disable-next-line security/detect-unsafe-regex
|
|
22
58
|
const durationPattern = /^(\d+h)?(\d+m)?(\d+s)?$/;
|
|
23
59
|
return durationPattern.test(duration) && duration.length > 0;
|
|
24
60
|
}
|
|
@@ -26,8 +62,23 @@ export function isValidKubernetesDuration(duration) {
|
|
|
26
62
|
return false;
|
|
27
63
|
}
|
|
28
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Default termination grace period for Karpenter nodes
|
|
67
|
+
* @since 2.7.1
|
|
68
|
+
*/
|
|
29
69
|
export const DEFAULT_TERMINATION_GRACE_PERIOD = '30s';
|
|
70
|
+
/**
|
|
71
|
+
* Karpenter resources provider for AWS EKS node management
|
|
72
|
+
* @extends BaseResourceProvider
|
|
73
|
+
* @since 2.7.0
|
|
74
|
+
*/
|
|
30
75
|
export class KarpenterResources extends BaseResourceProvider {
|
|
76
|
+
/**
|
|
77
|
+
* Creates a Karpenter NodePool resource
|
|
78
|
+
* @param spec - NodePool specification
|
|
79
|
+
* @returns Created NodePool ApiObject
|
|
80
|
+
* @since 2.8.0+
|
|
81
|
+
*/
|
|
31
82
|
addKarpenterNodePool(spec) {
|
|
32
83
|
const nodePoolSpec = {
|
|
33
84
|
template: spec.template,
|
|
@@ -43,6 +94,12 @@ export class KarpenterResources extends BaseResourceProvider {
|
|
|
43
94
|
}
|
|
44
95
|
return this.createApiObject(spec.name, KarpenterVersionUtils.getNodePoolApiVersion(), 'NodePool', nodePoolSpec, spec.labels, spec.annotations);
|
|
45
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Creates a Karpenter NodeClaim resource
|
|
99
|
+
* @param spec - NodeClaim specification
|
|
100
|
+
* @returns Created NodeClaim ApiObject
|
|
101
|
+
* @since 2.7.0
|
|
102
|
+
*/
|
|
46
103
|
addKarpenterNodeClaim(spec) {
|
|
47
104
|
const nodeClaimSpec = {
|
|
48
105
|
nodeClassRef: spec.nodeClassRef,
|
|
@@ -58,6 +115,12 @@ export class KarpenterResources extends BaseResourceProvider {
|
|
|
58
115
|
}
|
|
59
116
|
return this.createApiObject(spec.name, KarpenterVersionUtils.getNodeClaimApiVersion(), 'NodeClaim', nodeClaimSpec, spec.labels, spec.annotations);
|
|
60
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Creates a Karpenter EC2NodeClass resource
|
|
120
|
+
* @param spec - EC2NodeClass specification
|
|
121
|
+
* @returns Created EC2NodeClass ApiObject
|
|
122
|
+
* @since 2.7.0
|
|
123
|
+
*/
|
|
61
124
|
addKarpenterEC2NodeClass(spec) {
|
|
62
125
|
const nodeClassSpec = {};
|
|
63
126
|
if (spec.amiFamily) {
|
|
@@ -95,6 +158,12 @@ export class KarpenterResources extends BaseResourceProvider {
|
|
|
95
158
|
}
|
|
96
159
|
return this.createApiObject(spec.name, 'karpenter.k8s.aws/v1beta1', 'EC2NodeClass', nodeClassSpec, spec.labels, spec.annotations);
|
|
97
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Creates a Karpenter NodePool with optimized disruption settings for cost efficiency
|
|
163
|
+
* @param spec - NodePool specification with disruption optimization
|
|
164
|
+
* @returns Created NodePool ApiObject
|
|
165
|
+
* @since 2.8.0+
|
|
166
|
+
*/
|
|
98
167
|
addKarpenterNodePoolWithDisruption(spec) {
|
|
99
168
|
const disruption = {};
|
|
100
169
|
if (spec.consolidationPolicy) {
|
|
@@ -129,12 +198,14 @@ export class KarpenterResources extends BaseResourceProvider {
|
|
|
129
198
|
nodePoolConfig['weight'] = spec.weight;
|
|
130
199
|
}
|
|
131
200
|
if (spec.labels) {
|
|
201
|
+
// Validate labels is an object
|
|
132
202
|
if (typeof spec.labels !== 'object' || Array.isArray(spec.labels)) {
|
|
133
203
|
throw new Error('Labels must be a valid object');
|
|
134
204
|
}
|
|
135
205
|
nodePoolConfig['labels'] = spec.labels;
|
|
136
206
|
}
|
|
137
207
|
if (spec.annotations) {
|
|
208
|
+
// Validate annotations is an object
|
|
138
209
|
if (typeof spec.annotations !== 'object' || Array.isArray(spec.annotations)) {
|
|
139
210
|
throw new Error('Annotations must be a valid object');
|
|
140
211
|
}
|
|
@@ -142,6 +213,12 @@ export class KarpenterResources extends BaseResourceProvider {
|
|
|
142
213
|
}
|
|
143
214
|
return this.addKarpenterNodePool(nodePoolConfig);
|
|
144
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Creates a Karpenter NodePool with scheduling constraints and priorities
|
|
218
|
+
* @param spec - NodePool specification with scheduling optimization
|
|
219
|
+
* @returns Created NodePool ApiObject
|
|
220
|
+
* @since 2.8.0+
|
|
221
|
+
*/
|
|
145
222
|
addKarpenterNodePoolWithScheduling(spec) {
|
|
146
223
|
const templateSpec = {
|
|
147
224
|
nodeClassRef: spec.nodeClassRef,
|