timonel 2.2.0 → 2.4.0
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 +16 -0
- package/README.md +5 -1
- package/SECURITY.md +15 -8
- package/dist/cli.js +29 -31
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/helm.d.ts +200 -12
- package/dist/lib/helm.d.ts.map +1 -1
- package/dist/lib/helm.js +234 -13
- package/dist/lib/helm.js.map +1 -1
- package/dist/lib/helmChartWriter.d.ts +238 -0
- package/dist/lib/helmChartWriter.d.ts.map +1 -0
- package/dist/lib/helmChartWriter.js +318 -0
- package/dist/lib/helmChartWriter.js.map +1 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.d.ts +26 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.d.ts.map +1 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.js +35 -0
- package/dist/lib/resources/autoscaling/autoscalingResources.js.map +1 -0
- package/dist/lib/resources/baseResourceProvider.d.ts +47 -0
- package/dist/lib/resources/baseResourceProvider.d.ts.map +1 -0
- package/dist/lib/resources/baseResourceProvider.js +83 -0
- package/dist/lib/resources/baseResourceProvider.js.map +1 -0
- package/dist/lib/resources/cloud/aws/awsResources.d.ts +165 -0
- package/dist/lib/resources/cloud/aws/awsResources.d.ts.map +1 -0
- package/dist/lib/resources/cloud/aws/awsResources.js +187 -0
- package/dist/lib/resources/cloud/aws/awsResources.js.map +1 -0
- package/dist/lib/resources/cloud/azure/azureResources.d.ts +169 -0
- package/dist/lib/resources/cloud/azure/azureResources.d.ts.map +1 -0
- package/dist/lib/resources/cloud/azure/azureResources.js +218 -0
- package/dist/lib/resources/cloud/azure/azureResources.js.map +1 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.d.ts +133 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.d.ts.map +1 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.js +162 -0
- package/dist/lib/resources/cloud/gcp/gcpResources.js.map +1 -0
- package/dist/lib/resources/core/coreResources.d.ts +584 -0
- package/dist/lib/resources/core/coreResources.d.ts.map +1 -0
- package/dist/lib/resources/core/coreResources.js +796 -0
- package/dist/lib/resources/core/coreResources.js.map +1 -0
- package/dist/lib/resources/core/storageResources.d.ts +133 -0
- package/dist/lib/resources/core/storageResources.d.ts.map +1 -0
- package/dist/lib/resources/core/storageResources.js +120 -0
- package/dist/lib/resources/core/storageResources.js.map +1 -0
- package/dist/lib/resources/validation/validationResources.d.ts +26 -0
- package/dist/lib/resources/validation/validationResources.d.ts.map +1 -0
- package/dist/lib/resources/validation/validationResources.js +33 -0
- package/dist/lib/resources/validation/validationResources.js.map +1 -0
- package/dist/lib/rutter.d.ts +554 -0
- package/dist/lib/rutter.d.ts.map +1 -0
- package/dist/lib/rutter.js +665 -0
- package/dist/lib/rutter.js.map +1 -0
- package/dist/lib/security.d.ts +73 -0
- package/dist/lib/security.d.ts.map +1 -0
- package/dist/lib/security.js +138 -0
- package/dist/lib/security.js.map +1 -0
- package/dist/lib/umbrella.d.ts +22 -2
- package/dist/lib/umbrella.d.ts.map +1 -1
- package/dist/lib/umbrella.js +21 -1
- package/dist/lib/umbrella.js.map +1 -1
- package/dist/lib/umbrellaRutter.d.ts +97 -0
- package/dist/lib/umbrellaRutter.d.ts.map +1 -0
- package/dist/lib/{UmbrellaRutter.js → umbrellaRutter.js} +72 -23
- package/dist/lib/umbrellaRutter.js.map +1 -0
- package/package.json +2 -1
- package/dist/lib/HelmChartWriter.d.ts +0 -69
- package/dist/lib/HelmChartWriter.d.ts.map +0 -1
- package/dist/lib/HelmChartWriter.js +0 -124
- package/dist/lib/HelmChartWriter.js.map +0 -1
- package/dist/lib/Rutter.d.ts +0 -1334
- package/dist/lib/Rutter.d.ts.map +0 -1
- package/dist/lib/Rutter.js +0 -2138
- package/dist/lib/Rutter.js.map +0 -1
- package/dist/lib/UmbrellaRutter.d.ts +0 -34
- package/dist/lib/UmbrellaRutter.d.ts.map +0 -1
- package/dist/lib/UmbrellaRutter.js.map +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { BaseResourceProvider } from '../../baseResourceProvider.js';
|
|
2
|
+
/**
|
|
3
|
+
* Azure-specific Kubernetes resources provider
|
|
4
|
+
* Handles Azure integrations like Azure Disk, Azure File, Application Gateway, AGIC, and other Azure services
|
|
5
|
+
*
|
|
6
|
+
* @since 2.4.0
|
|
7
|
+
*/
|
|
8
|
+
export class AzureResources extends BaseResourceProvider {
|
|
9
|
+
/**
|
|
10
|
+
* Creates an Azure Disk StorageClass
|
|
11
|
+
* @param spec - Azure Disk StorageClass specification
|
|
12
|
+
* @returns Created StorageClass ApiObject
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* azureResources.addAzureDiskStorageClass({
|
|
17
|
+
* name: 'premium-disk',
|
|
18
|
+
* skuName: 'Premium_LRS',
|
|
19
|
+
* cachingMode: 'ReadOnly',
|
|
20
|
+
* allowVolumeExpansion: true
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @since 2.4.0
|
|
25
|
+
*/
|
|
26
|
+
addAzureDiskStorageClass(spec) {
|
|
27
|
+
const parameters = {
|
|
28
|
+
skuName: spec.skuName ?? 'Standard_LRS',
|
|
29
|
+
...(spec.cachingMode ? { cachingmode: spec.cachingMode } : {}),
|
|
30
|
+
...(spec.fsType ? { fsType: spec.fsType } : {}),
|
|
31
|
+
...(spec.kind ? { kind: spec.kind } : {}),
|
|
32
|
+
};
|
|
33
|
+
const storageClassSpec = {
|
|
34
|
+
provisioner: 'disk.csi.azure.com',
|
|
35
|
+
parameters,
|
|
36
|
+
reclaimPolicy: spec.reclaimPolicy ?? 'Delete',
|
|
37
|
+
allowVolumeExpansion: spec.allowVolumeExpansion ?? true,
|
|
38
|
+
volumeBindingMode: spec.volumeBindingMode ?? 'WaitForFirstConsumer',
|
|
39
|
+
};
|
|
40
|
+
return this.createApiObject(spec.name, AzureResources.STORAGE_API_VERSION, 'StorageClass', storageClassSpec, spec.labels, spec.annotations);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Creates an Azure File StorageClass
|
|
44
|
+
* @param spec - Azure File StorageClass specification
|
|
45
|
+
* @returns Created StorageClass ApiObject
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* azureResources.addAzureFileStorageClass({
|
|
50
|
+
* name: 'azure-file-premium',
|
|
51
|
+
* skuName: 'Premium_LRS',
|
|
52
|
+
* protocol: 'nfs',
|
|
53
|
+
* allowSharedAccess: true
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @since 2.4.0
|
|
58
|
+
*/
|
|
59
|
+
addAzureFileStorageClass(spec) {
|
|
60
|
+
const parameters = {
|
|
61
|
+
skuName: spec.skuName ?? 'Standard_LRS',
|
|
62
|
+
...(spec.protocol ? { protocol: spec.protocol } : {}),
|
|
63
|
+
...(spec.allowSharedAccess !== undefined
|
|
64
|
+
? { allowSharedAccess: String(spec.allowSharedAccess) }
|
|
65
|
+
: {}),
|
|
66
|
+
};
|
|
67
|
+
const storageClassSpec = {
|
|
68
|
+
provisioner: 'file.csi.azure.com',
|
|
69
|
+
parameters,
|
|
70
|
+
reclaimPolicy: spec.reclaimPolicy ?? 'Delete',
|
|
71
|
+
allowVolumeExpansion: spec.allowVolumeExpansion ?? true,
|
|
72
|
+
volumeBindingMode: spec.volumeBindingMode ?? 'Immediate',
|
|
73
|
+
};
|
|
74
|
+
return this.createApiObject(spec.name, AzureResources.STORAGE_API_VERSION, 'StorageClass', storageClassSpec, spec.labels, spec.annotations);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates an Azure Application Gateway Ingress
|
|
78
|
+
* @param spec - AGIC Ingress specification
|
|
79
|
+
* @returns Created Ingress ApiObject
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* azureResources.addApplicationGatewayIngress({
|
|
84
|
+
* name: 'app-gateway-ingress',
|
|
85
|
+
* host: 'myapp.example.com',
|
|
86
|
+
* serviceName: 'my-service',
|
|
87
|
+
* servicePort: 80,
|
|
88
|
+
* sslRedirect: true
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @since 2.4.0
|
|
93
|
+
*/
|
|
94
|
+
addApplicationGatewayIngress(spec) {
|
|
95
|
+
const annotations = {
|
|
96
|
+
'kubernetes.io/ingress.class': 'azure/application-gateway',
|
|
97
|
+
...(spec.sslRedirect !== undefined
|
|
98
|
+
? { 'appgw.ingress.kubernetes.io/ssl-redirect': String(spec.sslRedirect) }
|
|
99
|
+
: {}),
|
|
100
|
+
...(spec.cookieBasedAffinity !== undefined
|
|
101
|
+
? { 'appgw.ingress.kubernetes.io/cookie-based-affinity': String(spec.cookieBasedAffinity) }
|
|
102
|
+
: {}),
|
|
103
|
+
...(spec.requestTimeout
|
|
104
|
+
? { 'appgw.ingress.kubernetes.io/request-timeout': String(spec.requestTimeout) }
|
|
105
|
+
: {}),
|
|
106
|
+
...(spec.connectionDraining !== undefined
|
|
107
|
+
? { 'appgw.ingress.kubernetes.io/connection-draining': String(spec.connectionDraining) }
|
|
108
|
+
: {}),
|
|
109
|
+
...(spec.annotations || {}),
|
|
110
|
+
};
|
|
111
|
+
const rules = [
|
|
112
|
+
{
|
|
113
|
+
host: spec.host,
|
|
114
|
+
http: {
|
|
115
|
+
paths: [
|
|
116
|
+
{
|
|
117
|
+
path: spec.path ?? '/',
|
|
118
|
+
pathType: 'Prefix',
|
|
119
|
+
backend: {
|
|
120
|
+
service: {
|
|
121
|
+
name: spec.serviceName,
|
|
122
|
+
port: { number: spec.servicePort },
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
const ingressSpec = {
|
|
131
|
+
rules,
|
|
132
|
+
...(spec.tls ? { tls: spec.tls } : {}),
|
|
133
|
+
};
|
|
134
|
+
return this.createApiObject(spec.name, AzureResources.NETWORKING_API_VERSION, 'Ingress', ingressSpec, spec.labels, annotations);
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Creates an Azure Key Vault SecretProviderClass
|
|
138
|
+
* @param spec - Azure Key Vault SecretProviderClass specification
|
|
139
|
+
* @returns Created SecretProviderClass ApiObject
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* azureResources.addAzureKeyVaultSecretProviderClass({
|
|
144
|
+
* name: 'app-secrets',
|
|
145
|
+
* keyVaultName: 'my-keyvault',
|
|
146
|
+
* tenantId: '87654321-4321-4321-4321-210987654321',
|
|
147
|
+
* objects: [
|
|
148
|
+
* { objectName: 'database-password', objectType: 'secret' }
|
|
149
|
+
* ]
|
|
150
|
+
* });
|
|
151
|
+
* ```
|
|
152
|
+
*
|
|
153
|
+
* @since 2.4.0
|
|
154
|
+
*/
|
|
155
|
+
addAzureKeyVaultSecretProviderClass(spec) {
|
|
156
|
+
// Validate object names for security
|
|
157
|
+
spec.objects.forEach((obj) => {
|
|
158
|
+
if (obj.objectName.includes('../') || obj.objectName.includes('..\\')) {
|
|
159
|
+
throw new Error(`Azure Key Vault ${spec.name}: Object name '${obj.objectName}' contains invalid path traversal sequences`);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
const objects = spec.objects.map((obj) => ({
|
|
163
|
+
objectName: obj.objectName,
|
|
164
|
+
objectType: obj.objectType,
|
|
165
|
+
...(obj.objectAlias ? { objectAlias: obj.objectAlias } : {}),
|
|
166
|
+
...(obj.objectVersion ? { objectVersion: obj.objectVersion } : {}),
|
|
167
|
+
}));
|
|
168
|
+
const secretProviderSpec = {
|
|
169
|
+
secretObjects: [
|
|
170
|
+
{
|
|
171
|
+
secretName: spec.secretName || spec.name,
|
|
172
|
+
type: 'Opaque',
|
|
173
|
+
data: objects.map((obj) => ({
|
|
174
|
+
objectName: obj.objectName,
|
|
175
|
+
key: obj.objectAlias || obj.objectName,
|
|
176
|
+
})),
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
parameters: {
|
|
180
|
+
keyvaultName: spec.keyVaultName,
|
|
181
|
+
tenantId: spec.tenantId,
|
|
182
|
+
objects: JSON.stringify({ array: objects }),
|
|
183
|
+
...(spec.userAssignedIdentityID
|
|
184
|
+
? { userAssignedIdentityID: spec.userAssignedIdentityID }
|
|
185
|
+
: {}),
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
return this.createApiObject(spec.name, 'secrets-store.csi.x-k8s.io/v1', 'SecretProviderClass', secretProviderSpec, spec.labels, spec.annotations);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Creates an Azure Container Registry ServiceAccount
|
|
192
|
+
* @param spec - Azure ACR ServiceAccount specification
|
|
193
|
+
* @returns Created ServiceAccount ApiObject
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* azureResources.addAzureACRServiceAccount({
|
|
198
|
+
* name: 'acr-service-account',
|
|
199
|
+
* acrName: 'myregistry',
|
|
200
|
+
* resourceGroup: 'my-rg'
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*
|
|
204
|
+
* @since 2.4.0
|
|
205
|
+
*/
|
|
206
|
+
addAzureACRServiceAccount(spec) {
|
|
207
|
+
const annotations = {
|
|
208
|
+
'azure.workload.identity/client-id': spec.clientId || '',
|
|
209
|
+
'azure.workload.identity/tenant-id': spec.tenantId || '',
|
|
210
|
+
...(spec.annotations || {}),
|
|
211
|
+
};
|
|
212
|
+
const serviceAccountSpec = {};
|
|
213
|
+
return this.createApiObject(spec.name, 'v1', 'ServiceAccount', serviceAccountSpec, spec.labels, annotations);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
AzureResources.STORAGE_API_VERSION = 'storage.k8s.io/v1';
|
|
217
|
+
AzureResources.NETWORKING_API_VERSION = 'networking.k8s.io/v1';
|
|
218
|
+
//# sourceMappingURL=azureResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"azureResources.js","sourceRoot":"","sources":["../../../../../src/lib/resources/cloud/azure/azureResources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,oBAAoB;IAItD;;;;;;;;;;;;;;;;OAgBG;IACH,wBAAwB,CAAC,IAA+B;QACtD,MAAM,UAAU,GAA2B;YACzC,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,cAAc;YACvC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/C,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,CAAC;QAEF,MAAM,gBAAgB,GAAG;YACvB,WAAW,EAAE,oBAAoB;YACjC,UAAU;YACV,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,QAAQ;YAC7C,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,IAAI,IAAI;YACvD,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,IAAI,sBAAsB;SACpE,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CACzB,IAAI,CAAC,IAAI,EACT,cAAc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,EAAE;gBACV,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;gBAC3C,GAAG,CAAC,IAAI,CAAC,sBAAsB;oBAC7B,CAAC,CAAC,EAAE,sBAAsB,EAAE,IAAI,CAAC,sBAAsB,EAAE;oBACzD,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC;QAEF,OAAO,IAAI,CAAC,eAAe,CACzB,IAAI,CAAC,IAAI,EACT,+BAA+B,EAC/B,qBAAqB,EACrB,kBAAkB,EAClB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,WAAW,CACjB,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,yBAAyB,CAAC,IAAgC;QACxD,MAAM,WAAW,GAA2B;YAC1C,mCAAmC,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;YACxD,mCAAmC,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;YACxD,GAAG,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;SAC5B,CAAC;QAEF,MAAM,kBAAkB,GAAG,EAAE,CAAC;QAE9B,OAAO,IAAI,CAAC,eAAe,CACzB,IAAI,CAAC,IAAI,EACT,IAAI,EACJ,gBAAgB,EAChB,kBAAkB,EAClB,IAAI,CAAC,MAAM,EACX,WAAW,CACZ,CAAC;IACJ,CAAC;;AArQuB,kCAAmB,GAAG,mBAAmB,CAAC;AAC1C,qCAAsB,GAAG,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { ApiObject } from 'cdk8s';
|
|
2
|
+
import { BaseResourceProvider } from '../../baseResourceProvider.js';
|
|
3
|
+
/**
|
|
4
|
+
* GCP-specific Kubernetes resources provider
|
|
5
|
+
* Handles GCP integrations like Persistent Disk, Filestore, GCE Ingress, Workload Identity, and other GCP services
|
|
6
|
+
*
|
|
7
|
+
* @since 2.4.0
|
|
8
|
+
*/
|
|
9
|
+
export declare class GCPResources extends BaseResourceProvider {
|
|
10
|
+
private static readonly STORAGE_API_VERSION;
|
|
11
|
+
private static readonly CORE_API_VERSION;
|
|
12
|
+
private static readonly NETWORKING_API_VERSION;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a GCP Persistent Disk StorageClass
|
|
15
|
+
* @param spec - GCP PD StorageClass specification
|
|
16
|
+
* @returns Created StorageClass ApiObject
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* gcpResources.addPersistentDiskStorageClass({
|
|
21
|
+
* name: 'fast-ssd',
|
|
22
|
+
* type: 'pd-ssd',
|
|
23
|
+
* replicationType: 'regional-pd',
|
|
24
|
+
* allowVolumeExpansion: true
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @since 2.4.0
|
|
29
|
+
*/
|
|
30
|
+
addPersistentDiskStorageClass(spec: GCPPersistentDiskStorageClassSpec): ApiObject;
|
|
31
|
+
/**
|
|
32
|
+
* Creates a GCP Filestore StorageClass
|
|
33
|
+
* @param spec - GCP Filestore StorageClass specification
|
|
34
|
+
* @returns Created StorageClass ApiObject
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* gcpResources.addFilestoreStorageClass({
|
|
39
|
+
* name: 'filestore-premium',
|
|
40
|
+
* tier: 'premium',
|
|
41
|
+
* network: 'default',
|
|
42
|
+
* allowVolumeExpansion: true
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @since 2.4.0
|
|
47
|
+
*/
|
|
48
|
+
addFilestoreStorageClass(spec: GCPFilestoreStorageClassSpec): ApiObject;
|
|
49
|
+
/**
|
|
50
|
+
* Creates a GCE Ingress with Google Cloud Load Balancer
|
|
51
|
+
* @param spec - GCE Ingress specification
|
|
52
|
+
* @returns Created Ingress ApiObject
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```typescript
|
|
56
|
+
* gcpResources.addGCEIngress({
|
|
57
|
+
* name: 'gce-ingress',
|
|
58
|
+
* host: 'myapp.example.com',
|
|
59
|
+
* serviceName: 'my-service',
|
|
60
|
+
* servicePort: 80,
|
|
61
|
+
* staticIPName: 'my-static-ip',
|
|
62
|
+
* managedCertificate: 'my-ssl-cert'
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* @since 2.4.0
|
|
67
|
+
*/
|
|
68
|
+
addGCEIngress(spec: GCPGCEIngressSpec): ApiObject;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a ServiceAccount with Workload Identity annotations
|
|
71
|
+
* @param spec - Workload Identity ServiceAccount specification
|
|
72
|
+
* @returns Created ServiceAccount ApiObject
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* gcpResources.addWorkloadIdentityServiceAccount({
|
|
77
|
+
* name: 'workload-identity-sa',
|
|
78
|
+
* googleServiceAccount: 'my-gsa@my-project.iam.gserviceaccount.com',
|
|
79
|
+
* namespace: 'default'
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @since 2.4.0
|
|
84
|
+
*/
|
|
85
|
+
addWorkloadIdentityServiceAccount(spec: GCPWorkloadIdentityServiceAccountSpec): ApiObject;
|
|
86
|
+
}
|
|
87
|
+
export interface GCPPersistentDiskStorageClassSpec {
|
|
88
|
+
name: string;
|
|
89
|
+
type?: 'pd-standard' | 'pd-ssd' | 'pd-balanced';
|
|
90
|
+
replicationType?: 'none' | 'regional-pd';
|
|
91
|
+
fsType?: string;
|
|
92
|
+
reclaimPolicy?: 'Delete' | 'Retain';
|
|
93
|
+
allowVolumeExpansion?: boolean;
|
|
94
|
+
volumeBindingMode?: 'Immediate' | 'WaitForFirstConsumer';
|
|
95
|
+
labels?: Record<string, string>;
|
|
96
|
+
annotations?: Record<string, string>;
|
|
97
|
+
}
|
|
98
|
+
export interface GCPFilestoreStorageClassSpec {
|
|
99
|
+
name: string;
|
|
100
|
+
tier?: 'standard' | 'premium' | 'basic-hdd' | 'basic-ssd';
|
|
101
|
+
network?: string;
|
|
102
|
+
location?: string;
|
|
103
|
+
reclaimPolicy?: 'Delete' | 'Retain';
|
|
104
|
+
allowVolumeExpansion?: boolean;
|
|
105
|
+
volumeBindingMode?: 'Immediate' | 'WaitForFirstConsumer';
|
|
106
|
+
labels?: Record<string, string>;
|
|
107
|
+
annotations?: Record<string, string>;
|
|
108
|
+
}
|
|
109
|
+
export interface GCPGCEIngressSpec {
|
|
110
|
+
name: string;
|
|
111
|
+
host: string;
|
|
112
|
+
serviceName: string;
|
|
113
|
+
servicePort: number;
|
|
114
|
+
path?: string;
|
|
115
|
+
staticIPName?: string;
|
|
116
|
+
managedCertificate?: string;
|
|
117
|
+
sslRedirect?: boolean;
|
|
118
|
+
backendConfig?: Record<string, unknown>;
|
|
119
|
+
tls?: Array<{
|
|
120
|
+
hosts: string[];
|
|
121
|
+
secretName: string;
|
|
122
|
+
}>;
|
|
123
|
+
labels?: Record<string, string>;
|
|
124
|
+
annotations?: Record<string, string>;
|
|
125
|
+
}
|
|
126
|
+
export interface GCPWorkloadIdentityServiceAccountSpec {
|
|
127
|
+
name: string;
|
|
128
|
+
googleServiceAccount: string;
|
|
129
|
+
namespace?: string;
|
|
130
|
+
labels?: Record<string, string>;
|
|
131
|
+
annotations?: Record<string, string>;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=gcpResources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcpResources.d.ts","sourceRoot":"","sources":["../../../../../src/lib/resources/cloud/gcp/gcpResources.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA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+
import { BaseResourceProvider } from '../../baseResourceProvider.js';
|
|
2
|
+
/**
|
|
3
|
+
* GCP-specific Kubernetes resources provider
|
|
4
|
+
* Handles GCP integrations like Persistent Disk, Filestore, GCE Ingress, Workload Identity, and other GCP services
|
|
5
|
+
*
|
|
6
|
+
* @since 2.4.0
|
|
7
|
+
*/
|
|
8
|
+
export class GCPResources extends BaseResourceProvider {
|
|
9
|
+
/**
|
|
10
|
+
* Creates a GCP Persistent Disk StorageClass
|
|
11
|
+
* @param spec - GCP PD StorageClass specification
|
|
12
|
+
* @returns Created StorageClass ApiObject
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* gcpResources.addPersistentDiskStorageClass({
|
|
17
|
+
* name: 'fast-ssd',
|
|
18
|
+
* type: 'pd-ssd',
|
|
19
|
+
* replicationType: 'regional-pd',
|
|
20
|
+
* allowVolumeExpansion: true
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @since 2.4.0
|
|
25
|
+
*/
|
|
26
|
+
addPersistentDiskStorageClass(spec) {
|
|
27
|
+
const parameters = {
|
|
28
|
+
type: spec.type ?? 'pd-standard',
|
|
29
|
+
...(spec.replicationType ? { 'replication-type': spec.replicationType } : {}),
|
|
30
|
+
...(spec.fsType ? { fstype: spec.fsType } : {}),
|
|
31
|
+
};
|
|
32
|
+
const storageClassSpec = {
|
|
33
|
+
provisioner: 'pd.csi.storage.gke.io',
|
|
34
|
+
parameters,
|
|
35
|
+
reclaimPolicy: spec.reclaimPolicy ?? 'Delete',
|
|
36
|
+
allowVolumeExpansion: spec.allowVolumeExpansion ?? true,
|
|
37
|
+
volumeBindingMode: spec.volumeBindingMode ?? 'WaitForFirstConsumer',
|
|
38
|
+
};
|
|
39
|
+
return this.createApiObject(spec.name, GCPResources.STORAGE_API_VERSION, 'StorageClass', storageClassSpec, spec.labels, spec.annotations);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Creates a GCP Filestore StorageClass
|
|
43
|
+
* @param spec - GCP Filestore StorageClass specification
|
|
44
|
+
* @returns Created StorageClass ApiObject
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```typescript
|
|
48
|
+
* gcpResources.addFilestoreStorageClass({
|
|
49
|
+
* name: 'filestore-premium',
|
|
50
|
+
* tier: 'premium',
|
|
51
|
+
* network: 'default',
|
|
52
|
+
* allowVolumeExpansion: true
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @since 2.4.0
|
|
57
|
+
*/
|
|
58
|
+
addFilestoreStorageClass(spec) {
|
|
59
|
+
const parameters = {
|
|
60
|
+
tier: spec.tier ?? 'standard',
|
|
61
|
+
network: spec.network ?? 'default',
|
|
62
|
+
...(spec.location ? { location: spec.location } : {}),
|
|
63
|
+
};
|
|
64
|
+
const storageClassSpec = {
|
|
65
|
+
provisioner: 'filestore.csi.storage.gke.io',
|
|
66
|
+
parameters,
|
|
67
|
+
reclaimPolicy: spec.reclaimPolicy ?? 'Delete',
|
|
68
|
+
allowVolumeExpansion: spec.allowVolumeExpansion ?? true,
|
|
69
|
+
volumeBindingMode: spec.volumeBindingMode ?? 'Immediate',
|
|
70
|
+
};
|
|
71
|
+
return this.createApiObject(spec.name, GCPResources.STORAGE_API_VERSION, 'StorageClass', storageClassSpec, spec.labels, spec.annotations);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates a GCE Ingress with Google Cloud Load Balancer
|
|
75
|
+
* @param spec - GCE Ingress specification
|
|
76
|
+
* @returns Created Ingress ApiObject
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* gcpResources.addGCEIngress({
|
|
81
|
+
* name: 'gce-ingress',
|
|
82
|
+
* host: 'myapp.example.com',
|
|
83
|
+
* serviceName: 'my-service',
|
|
84
|
+
* servicePort: 80,
|
|
85
|
+
* staticIPName: 'my-static-ip',
|
|
86
|
+
* managedCertificate: 'my-ssl-cert'
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @since 2.4.0
|
|
91
|
+
*/
|
|
92
|
+
addGCEIngress(spec) {
|
|
93
|
+
const annotations = {
|
|
94
|
+
'kubernetes.io/ingress.class': 'gce',
|
|
95
|
+
...(spec.staticIPName
|
|
96
|
+
? { 'kubernetes.io/ingress.global-static-ip-name': spec.staticIPName }
|
|
97
|
+
: {}),
|
|
98
|
+
...(spec.managedCertificate
|
|
99
|
+
? { 'networking.gke.io/managed-certificates': spec.managedCertificate }
|
|
100
|
+
: {}),
|
|
101
|
+
...(spec.sslRedirect !== undefined
|
|
102
|
+
? { 'ingress.gcp.kubernetes.io/force-ssl-redirect': String(spec.sslRedirect) }
|
|
103
|
+
: {}),
|
|
104
|
+
...(spec.backendConfig
|
|
105
|
+
? { 'cloud.google.com/backend-config': JSON.stringify(spec.backendConfig) }
|
|
106
|
+
: {}),
|
|
107
|
+
...(spec.annotations || {}),
|
|
108
|
+
};
|
|
109
|
+
const rules = [
|
|
110
|
+
{
|
|
111
|
+
host: spec.host,
|
|
112
|
+
http: {
|
|
113
|
+
paths: [
|
|
114
|
+
{
|
|
115
|
+
path: spec.path ?? '/*',
|
|
116
|
+
pathType: 'ImplementationSpecific',
|
|
117
|
+
backend: {
|
|
118
|
+
service: {
|
|
119
|
+
name: spec.serviceName,
|
|
120
|
+
port: { number: spec.servicePort },
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
const ingressSpec = {
|
|
129
|
+
rules,
|
|
130
|
+
...(spec.tls ? { tls: spec.tls } : {}),
|
|
131
|
+
};
|
|
132
|
+
return this.createApiObject(spec.name, GCPResources.NETWORKING_API_VERSION, 'Ingress', ingressSpec, spec.labels, annotations);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Creates a ServiceAccount with Workload Identity annotations
|
|
136
|
+
* @param spec - Workload Identity ServiceAccount specification
|
|
137
|
+
* @returns Created ServiceAccount ApiObject
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* gcpResources.addWorkloadIdentityServiceAccount({
|
|
142
|
+
* name: 'workload-identity-sa',
|
|
143
|
+
* googleServiceAccount: 'my-gsa@my-project.iam.gserviceaccount.com',
|
|
144
|
+
* namespace: 'default'
|
|
145
|
+
* });
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* @since 2.4.0
|
|
149
|
+
*/
|
|
150
|
+
addWorkloadIdentityServiceAccount(spec) {
|
|
151
|
+
const annotations = {
|
|
152
|
+
'iam.gke.io/gcp-service-account': spec.googleServiceAccount,
|
|
153
|
+
...(spec.annotations || {}),
|
|
154
|
+
};
|
|
155
|
+
const serviceAccountSpec = {};
|
|
156
|
+
return this.createApiObject(spec.name, GCPResources.CORE_API_VERSION, 'ServiceAccount', serviceAccountSpec, spec.labels, annotations);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
GCPResources.STORAGE_API_VERSION = 'storage.k8s.io/v1';
|
|
160
|
+
GCPResources.CORE_API_VERSION = 'v1';
|
|
161
|
+
GCPResources.NETWORKING_API_VERSION = 'networking.k8s.io/v1';
|
|
162
|
+
//# sourceMappingURL=gcpResources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gcpResources.js","sourceRoot":"","sources":["../../../../../src/lib/resources/cloud/gcp/gcpResources.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,oBAAoB;IAKpD;;;;;;;;;;;;;;;;OAgBG;IACH,6BAA6B,CAAC,IAAuC;QACnE,MAAM,UAAU,GAA2B;YACzC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,aAAa;YAChC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