timonel 0.3.0 → 1.0.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 +96 -1
- package/README.md +432 -11
- package/dist/cli.js +32 -72
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -20
- package/dist/index.js.map +1 -1
- package/dist/lib/HelmChartWriter.d.ts +2 -0
- package/dist/lib/HelmChartWriter.d.ts.map +1 -1
- package/dist/lib/HelmChartWriter.js +24 -52
- package/dist/lib/HelmChartWriter.js.map +1 -1
- package/dist/lib/Rutter.d.ts +396 -12
- package/dist/lib/Rutter.d.ts.map +1 -1
- package/dist/lib/Rutter.js +656 -56
- package/dist/lib/Rutter.js.map +1 -1
- package/dist/lib/UmbrellaRutter.d.ts +2 -2
- package/dist/lib/UmbrellaRutter.d.ts.map +1 -1
- package/dist/lib/UmbrellaRutter.js +12 -20
- package/dist/lib/UmbrellaRutter.js.map +1 -1
- package/dist/lib/helm.js +11 -24
- package/dist/lib/helm.js.map +1 -1
- package/dist/lib/umbrella.d.ts +2 -2
- package/dist/lib/umbrella.d.ts.map +1 -1
- package/dist/lib/umbrella.js +3 -6
- package/dist/lib/umbrella.js.map +1 -1
- package/package.json +16 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
|
+
# [1.0.0](https://github.com/KenkoGeek/timonel/compare/v0.4.0...v1.0.0) (2025-09-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **ci:** configure GitHub App token for semantic-release bypass - Use RELEASE_TOKEN from npm-prd environment for checkout and semantic-release ([0d385d1](https://github.com/KenkoGeek/timonel/commit/0d385d1084a45de3ab731094e87196239811e6fb))
|
|
7
|
+
* **ci:** disable body-max-line-length for semantic-release compatibility - Set body-max-line-length to 0 (disabled) to allow long changelog entries - Fixes semantic-release commit validation failures - Maintains other commitlint rules for developer commits ([b215f65](https://github.com/KenkoGeek/timonel/commit/b215f65bccb69a1cfca79084e6a9c96954fb478a))
|
|
8
|
+
* **ci:** disable footer line length limit for semantic-release commits ([d5ae4dc](https://github.com/KenkoGeek/timonel/commit/d5ae4dc83e68f8fade4a8289d1ce4e2bae5046dd))
|
|
9
|
+
* **ci:** disable footer-leading-blank for semantic-release compatibility - Set footer-leading-blank to 0 (disabled) to allow semantic-release footer format ([2f8c6c8](https://github.com/KenkoGeek/timonel/commit/2f8c6c863c6aabd1d3f3d8022b43fefecb02f010))
|
|
10
|
+
* **ci:** replace CodeQL with security check in release validation ([#15](https://github.com/KenkoGeek/timonel/issues/15)) ([b8cecea](https://github.com/KenkoGeek/timonel/commit/b8cecea1eaf0bb6af3e6fd2f6bc38c2fb2c09f4d))
|
|
11
|
+
* **ci:** resolve release workflow issues ([#16](https://github.com/KenkoGeek/timonel/issues/16)) ([ed5dc9b](https://github.com/KenkoGeek/timonel/commit/ed5dc9b3d86b531d4495d4d05dd913340333322c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* add manual release workflow with GitHub Actions ([1035b2e](https://github.com/KenkoGeek/timonel/commit/1035b2e18fbb808e57438353c865ecd129d9e04d))
|
|
17
|
+
* add NetworkPolicy helpers for Zero Trust network security ([#13](https://github.com/KenkoGeek/timonel/issues/13)) ([cee3b58](https://github.com/KenkoGeek/timonel/commit/cee3b5876de839ca3cf16dd6ca6e3b76626392ce))
|
|
18
|
+
* **ci:** add required status checks validation to release workflow ([#14](https://github.com/KenkoGeek/timonel/issues/14)) ([7f8665f](https://github.com/KenkoGeek/timonel/commit/7f8665fa908215cc92a4dbefb7fec00de98464bb))
|
|
19
|
+
* **ci:** implement automated semantic release with conventional commits ([02ce189](https://github.com/KenkoGeek/timonel/commit/02ce18943efd8019168b5f9af29be0140a9e1524))
|
|
20
|
+
* **ci:** implement automated semantic release with conventional commits ([bb94fda](https://github.com/KenkoGeek/timonel/commit/bb94fda3e80bf3e010e7b53bdd1794f88060408a))
|
|
21
|
+
* **core:** add NetworkPolicy helpers for Zero Trust network security ([34ac6bd](https://github.com/KenkoGeek/timonel/commit/34ac6bda3956e5fe326b72e9831bd4bb8bc660da))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Performance Improvements
|
|
25
|
+
|
|
26
|
+
* **ci:** homogenize CI/CD workflows and optimize release pipeline ([#17](https://github.com/KenkoGeek/timonel/issues/17)) ([4622d11](https://github.com/KenkoGeek/timonel/commit/4622d113e5753a5ff69c82a1e3784ecf61c34689))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### BREAKING CHANGES
|
|
30
|
+
|
|
31
|
+
* **ci:** ESLint configuration migrated to flat config format
|
|
32
|
+
* **ci:** ESLint configuration migrated to flat config format
|
|
33
|
+
|
|
1
34
|
# Changelog
|
|
2
35
|
|
|
3
36
|
All notable changes to this project will be documented in this file.
|
|
@@ -7,6 +40,57 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
40
|
|
|
8
41
|
## [Unreleased]
|
|
9
42
|
|
|
43
|
+
## [0.4.0] - 2025-09-06
|
|
44
|
+
|
|
45
|
+
### Added (0.4.0)
|
|
46
|
+
|
|
47
|
+
- **Custom Manifest Naming**: Complete implementation for customizable Kubernetes
|
|
48
|
+
manifest file names
|
|
49
|
+
- `manifestName` option in RutterProps to specify custom base names for manifest
|
|
50
|
+
files
|
|
51
|
+
- `singleManifestFile` option to combine all resources into a single manifest
|
|
52
|
+
file
|
|
53
|
+
- Enhanced file organization with descriptive names instead of generic numbered
|
|
54
|
+
files
|
|
55
|
+
- Support for both single file mode (`application.yaml`) and separate files mode
|
|
56
|
+
(`0000-my-app-deployment-web.yaml`)
|
|
57
|
+
- Backward compatibility maintained - default behavior unchanged when options not
|
|
58
|
+
specified
|
|
59
|
+
|
|
60
|
+
### Enhanced (0.4.0)
|
|
61
|
+
|
|
62
|
+
- **HelmChartWriter**: Added `singleFile` property to SynthAsset interface for
|
|
63
|
+
improved file handling
|
|
64
|
+
- **Documentation**: Comprehensive Custom Manifest Naming section added to README
|
|
65
|
+
with examples
|
|
66
|
+
- **Examples**: All examples updated with custom manifest naming demonstrations
|
|
67
|
+
- **AWS 2048 Game**: Enhanced with production-ready AWS features
|
|
68
|
+
- AWS ALB Ingress with health checks and SSL support
|
|
69
|
+
- HorizontalPodAutoscaler (HPA) for CPU-based auto-scaling
|
|
70
|
+
- PodDisruptionBudget (PDB) for high availability during updates
|
|
71
|
+
- Custom manifest naming with `manifestName: 'game-2048'`
|
|
72
|
+
- Multi-environment configuration (dev/staging/prod)
|
|
73
|
+
- **WordPress**: Updated to showcase `manifestName: 'wordpress-app'` and `singleManifestFile: true`
|
|
74
|
+
- Comprehensive AWS integration examples (EBS, EFS, IRSA, Secrets Manager)
|
|
75
|
+
- Auto-scaling with HPA and VPA configurations
|
|
76
|
+
- Production-ready deployment patterns
|
|
77
|
+
- **WordPress Umbrella**: Subcharts updated with custom manifest naming
|
|
78
|
+
- MySQL subchart: `manifestName: 'mysql-database'`, `singleManifestFile: true`
|
|
79
|
+
- WordPress subchart: `manifestName: 'wordpress-app'`, `singleManifestFile: false`
|
|
80
|
+
- **Example Documentation**: All example READMEs enhanced with custom manifest naming references
|
|
81
|
+
and comprehensive deployment instructions
|
|
82
|
+
- **Auto-scaling Features**: Properly documented existing production-ready capabilities
|
|
83
|
+
- HorizontalPodAutoscaler (HPA) with CPU/memory metrics and custom behavior policies
|
|
84
|
+
- VerticalPodAutoscaler (VPA) with resource policies and update modes
|
|
85
|
+
- PodDisruptionBudget (PDB) for high availability during updates
|
|
86
|
+
- **AWS Multi-Cloud Support**: Comprehensive documentation of EKS integration features
|
|
87
|
+
- AWS IRSA ServiceAccount for secure IAM role assumption with regional STS endpoints
|
|
88
|
+
- AWS EBS StorageClass with GP3, IO1, IO2 support, encryption, and IOPS configuration
|
|
89
|
+
- AWS EFS StorageClass for shared storage across pods with access points
|
|
90
|
+
- AWS ALB Ingress with health checks, SSL certificates, and advanced routing
|
|
91
|
+
- AWS Secrets Manager and Parameter Store integration via SecretProviderClass
|
|
92
|
+
- Multi-cloud ServiceAccount with workload identity (AWS IRSA, Azure, GCP)
|
|
93
|
+
|
|
10
94
|
## [0.3.0] - 2025-09-02
|
|
11
95
|
|
|
12
96
|
### Added (0.3.0)
|
|
@@ -184,5 +268,16 @@ const rutter = new Rutter({ meta: { name: 'my-app' } });
|
|
|
184
268
|
- Security audit in CI/CD pipeline
|
|
185
269
|
- Provenance-enabled npm publishing
|
|
186
270
|
|
|
187
|
-
[Unreleased]: https://github.com/KenkoGeek/timonel/compare/v0.
|
|
271
|
+
[Unreleased]: https://github.com/KenkoGeek/timonel/compare/v0.4.0...HEAD
|
|
272
|
+
[0.4.0]: https://github.com/KenkoGeek/timonel/releases/tag/v0.4.0
|
|
273
|
+
[0.3.0]: https://github.com/KenkoGeek/timonel/releases/tag/v0.3.0
|
|
274
|
+
[0.2.1]: https://github.com/KenkoGeek/timonel/releases/tag/v0.2.1
|
|
275
|
+
[0.2.0]: https://github.com/KenkoGeek/timonel/releases/tag/v0.2.0
|
|
276
|
+
[0.1.7]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.7
|
|
277
|
+
[0.1.6]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.6
|
|
278
|
+
[0.1.5]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.5
|
|
279
|
+
[0.1.4]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.4
|
|
280
|
+
[0.1.3]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.3
|
|
281
|
+
[0.1.2]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.2
|
|
282
|
+
[0.1.1]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.1
|
|
188
283
|
[0.1.0]: https://github.com/KenkoGeek/timonel/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -139,6 +139,9 @@ const rutter = new Rutter({
|
|
|
139
139
|
body: `{{- printf "%s-%s" .Chart.Name .Release.Name | trunc 63 | trimSuffix "-" -}}`,
|
|
140
140
|
},
|
|
141
141
|
],
|
|
142
|
+
// Custom manifest naming options
|
|
143
|
+
manifestName: 'my-app-resources', // Custom name for manifest files
|
|
144
|
+
singleManifestFile: true, // Combine all resources into one file
|
|
142
145
|
});
|
|
143
146
|
|
|
144
147
|
rutter.addDeployment({
|
|
@@ -150,19 +153,82 @@ rutter.addDeployment({
|
|
|
150
153
|
|
|
151
154
|
rutter.addService({ name: 'my-app', port: 80 });
|
|
152
155
|
|
|
153
|
-
//
|
|
154
|
-
rutter.
|
|
155
|
-
name: '
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
// Add auto-scaling with HPA and VPA
|
|
157
|
+
rutter.addHorizontalPodAutoscaler({
|
|
158
|
+
name: 'my-app-hpa',
|
|
159
|
+
scaleTargetRef: { apiVersion: 'apps/v1', kind: 'Deployment', name: 'my-app' },
|
|
160
|
+
minReplicas: 1,
|
|
161
|
+
maxReplicas: 10,
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
rutter.addVerticalPodAutoscaler({
|
|
165
|
+
name: 'my-app-vpa',
|
|
166
|
+
targetRef: { apiVersion: 'apps/v1', kind: 'Deployment', name: 'my-app' },
|
|
167
|
+
updatePolicy: { updateMode: 'Auto' },
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
rutter.addPodDisruptionBudget({
|
|
171
|
+
name: 'my-app-pdb',
|
|
172
|
+
minAvailable: 1,
|
|
173
|
+
selector: { matchLabels: { app: 'my-app' } },
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
// Add IRSA ServiceAccount for AWS access
|
|
177
|
+
rutter.addAWSIRSAServiceAccount({
|
|
178
|
+
name: 'my-app-irsa',
|
|
179
|
+
roleArn: 'arn:aws:iam::123456789012:role/MyAppRole',
|
|
180
|
+
stsEndpointType: 'regional',
|
|
181
|
+
tokenExpiration: 3600,
|
|
161
182
|
});
|
|
162
183
|
|
|
163
184
|
rutter.write('dist/charts/my-app');
|
|
164
185
|
```
|
|
165
186
|
|
|
187
|
+
### Custom Manifest Naming
|
|
188
|
+
|
|
189
|
+
Timonel provides flexible options for naming your Kubernetes manifest files:
|
|
190
|
+
|
|
191
|
+
#### Single Manifest File
|
|
192
|
+
|
|
193
|
+
```typescript
|
|
194
|
+
const rutter = new Rutter({
|
|
195
|
+
meta: { name: 'my-app', version: '0.1.0' },
|
|
196
|
+
manifestName: 'application',
|
|
197
|
+
singleManifestFile: true, // All resources in one file
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// Generates: templates/application.yaml
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### Separate Files with Custom Names
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
const rutter = new Rutter({
|
|
207
|
+
meta: { name: 'my-app', version: '0.1.0' },
|
|
208
|
+
manifestName: 'my-app',
|
|
209
|
+
singleManifestFile: false, // Each resource in its own file (default)
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
// Generates:
|
|
213
|
+
// templates/0000-my-app-deployment-web.yaml
|
|
214
|
+
// templates/0001-my-app-service-web.yaml
|
|
215
|
+
// templates/0002-my-app-configmap-config.yaml
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### Default Behavior
|
|
219
|
+
|
|
220
|
+
```typescript
|
|
221
|
+
const rutter = new Rutter({
|
|
222
|
+
meta: { name: 'my-app', version: '0.1.0' },
|
|
223
|
+
// No manifestName specified
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// Generates:
|
|
227
|
+
// templates/0000-deployment-web.yaml
|
|
228
|
+
// templates/0001-service-web.yaml
|
|
229
|
+
// templates/0002-configmap-config.yaml
|
|
230
|
+
```
|
|
231
|
+
|
|
166
232
|
## Umbrella Charts
|
|
167
233
|
|
|
168
234
|
Create umbrella charts that combine multiple subcharts into a single deployable unit:
|
|
@@ -224,7 +290,11 @@ tl umbrella synth ./dist
|
|
|
224
290
|
|
|
225
291
|
The `examples/` directory contains complete working examples:
|
|
226
292
|
|
|
227
|
-
- **aws-game-2048**: AWS 2048 game deployment
|
|
293
|
+
- **aws-game-2048**: Production-ready AWS 2048 game deployment showcasing AWS-specific features
|
|
294
|
+
- AWS ALB Ingress with health checks and SSL support
|
|
295
|
+
- HorizontalPodAutoscaler (HPA) for automatic scaling based on CPU utilization
|
|
296
|
+
- PodDisruptionBudget (PDB) for high availability during updates
|
|
297
|
+
- Multi-environment configuration (dev/staging/prod)
|
|
228
298
|
- **wordpress**: WordPress with MySQL database setup (single chart)
|
|
229
299
|
- **wordpress-umbrella**: WordPress stack using umbrella charts (MySQL + WordPress subcharts)
|
|
230
300
|
|
|
@@ -245,6 +315,354 @@ shared values, and multi-environment support.
|
|
|
245
315
|
(`toString`, `float64`).
|
|
246
316
|
- For numeric fields (ports, replicas), use literal values or template strings with proper casting.
|
|
247
317
|
|
|
318
|
+
## AWS Multi-Cloud Support
|
|
319
|
+
|
|
320
|
+
Timonel provides comprehensive AWS-specific helpers for EKS deployments:
|
|
321
|
+
|
|
322
|
+
### IRSA (IAM Roles for Service Accounts)
|
|
323
|
+
|
|
324
|
+
Securely access AWS services from Kubernetes pods using IAM roles:
|
|
325
|
+
|
|
326
|
+
```typescript
|
|
327
|
+
// Dedicated IRSA ServiceAccount
|
|
328
|
+
rutter.addAWSIRSAServiceAccount({
|
|
329
|
+
name: 'app-s3-access',
|
|
330
|
+
roleArn: 'arn:aws:iam::123456789012:role/AppS3Role',
|
|
331
|
+
audience: 'sts.amazonaws.com', // optional, defaults to sts.amazonaws.com
|
|
332
|
+
stsEndpointType: 'regional', // recommended for better performance
|
|
333
|
+
tokenExpiration: 3600, // optional, token lifetime in seconds
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
// General ServiceAccount with IRSA support
|
|
337
|
+
rutter.addServiceAccount({
|
|
338
|
+
name: 'my-app-sa',
|
|
339
|
+
awsRoleArn: 'arn:aws:iam::123456789012:role/MyAppRole',
|
|
340
|
+
awsStsEndpointType: 'regional',
|
|
341
|
+
awsTokenExpiration: 7200,
|
|
342
|
+
automountServiceAccountToken: true,
|
|
343
|
+
});
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### AWS Storage Classes
|
|
347
|
+
|
|
348
|
+
```typescript
|
|
349
|
+
// EBS GP3 StorageClass
|
|
350
|
+
rutter.addAWSEBSStorageClass({
|
|
351
|
+
name: 'fast-ssd',
|
|
352
|
+
volumeType: 'gp3',
|
|
353
|
+
encrypted: true,
|
|
354
|
+
iops: 3000,
|
|
355
|
+
throughput: 125,
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
// EFS StorageClass for shared storage
|
|
359
|
+
rutter.addAWSEFSStorageClass({
|
|
360
|
+
name: 'shared-storage',
|
|
361
|
+
reclaimPolicy: 'Retain',
|
|
362
|
+
});
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### AWS Load Balancer Controller
|
|
366
|
+
|
|
367
|
+
```typescript
|
|
368
|
+
// ALB Ingress with health checks
|
|
369
|
+
rutter.addAWSALBIngress({
|
|
370
|
+
name: 'app-ingress',
|
|
371
|
+
scheme: 'internet-facing',
|
|
372
|
+
targetType: 'ip',
|
|
373
|
+
healthCheckPath: '/health',
|
|
374
|
+
certificateArn:
|
|
375
|
+
'arn:aws:acm:us-west-2:123456789012:certificate/12345678-1234-1234-1234-123456789012',
|
|
376
|
+
rules: [
|
|
377
|
+
{
|
|
378
|
+
paths: [
|
|
379
|
+
{
|
|
380
|
+
path: '/',
|
|
381
|
+
pathType: 'Prefix',
|
|
382
|
+
backend: { service: { name: 'my-app', port: { number: 80 } } },
|
|
383
|
+
},
|
|
384
|
+
],
|
|
385
|
+
},
|
|
386
|
+
],
|
|
387
|
+
});
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### AWS Secrets Manager and Parameter Store
|
|
391
|
+
|
|
392
|
+
Integrate with AWS Secrets Manager and Parameter Store using the Secrets Store CSI Driver:
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
// Secrets Manager integration
|
|
396
|
+
rutter.addAWSSecretProviderClass({
|
|
397
|
+
name: 'app-secrets',
|
|
398
|
+
region: 'us-west-2',
|
|
399
|
+
objects: [
|
|
400
|
+
{
|
|
401
|
+
objectName: 'prod/myapp/database',
|
|
402
|
+
objectType: 'secretsmanager',
|
|
403
|
+
objectAlias: 'db-credentials',
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
objectName: 'prod/myapp/api-keys',
|
|
407
|
+
objectType: 'secretsmanager',
|
|
408
|
+
jmesPath: '["api_key", "secret_key"]', // Extract specific keys from JSON
|
|
409
|
+
},
|
|
410
|
+
],
|
|
411
|
+
});
|
|
412
|
+
|
|
413
|
+
// Parameter Store integration
|
|
414
|
+
rutter.addAWSSecretProviderClass({
|
|
415
|
+
name: 'app-config',
|
|
416
|
+
region: 'us-west-2',
|
|
417
|
+
objects: [
|
|
418
|
+
{
|
|
419
|
+
objectName: '/myapp/config/debug-mode',
|
|
420
|
+
objectType: 'ssmparameter',
|
|
421
|
+
objectAlias: 'debug-flag',
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
objectName: '/myapp/config/cache-ttl',
|
|
425
|
+
objectType: 'ssmparameter',
|
|
426
|
+
objectAlias: 'cache-timeout',
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
});
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
## Network Security with NetworkPolicies
|
|
433
|
+
|
|
434
|
+
Timonel provides comprehensive NetworkPolicy helpers for implementing Zero Trust network security
|
|
435
|
+
in Kubernetes:
|
|
436
|
+
|
|
437
|
+
### Zero Trust Network Security
|
|
438
|
+
|
|
439
|
+
Implement defense-in-depth with deny-by-default policies:
|
|
440
|
+
|
|
441
|
+
```typescript
|
|
442
|
+
// 1. Deny all traffic by default (recommended starting point)
|
|
443
|
+
rutter.addDenyAllNetworkPolicy('default-deny-all');
|
|
444
|
+
|
|
445
|
+
// 2. Allow specific traffic as needed
|
|
446
|
+
rutter.addAllowFromPodsNetworkPolicy({
|
|
447
|
+
name: 'allow-frontend-to-backend',
|
|
448
|
+
targetPodSelector: { app: 'backend' },
|
|
449
|
+
sourcePodSelector: { app: 'frontend' },
|
|
450
|
+
ports: [{ protocol: 'TCP', port: 8080 }],
|
|
451
|
+
});
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
### Advanced NetworkPolicy Examples
|
|
455
|
+
|
|
456
|
+
#### Multi-tier Application Security
|
|
457
|
+
|
|
458
|
+
```typescript
|
|
459
|
+
// Web tier - allow external traffic on port 80/443
|
|
460
|
+
rutter.addNetworkPolicy({
|
|
461
|
+
name: 'web-tier-policy',
|
|
462
|
+
podSelector: { matchLabels: { tier: 'web' } },
|
|
463
|
+
policyTypes: ['Ingress', 'Egress'],
|
|
464
|
+
ingress: [
|
|
465
|
+
{
|
|
466
|
+
ports: [
|
|
467
|
+
{ protocol: 'TCP', port: 80 },
|
|
468
|
+
{ protocol: 'TCP', port: 443 },
|
|
469
|
+
],
|
|
470
|
+
},
|
|
471
|
+
],
|
|
472
|
+
egress: [
|
|
473
|
+
// Allow access to app tier
|
|
474
|
+
{
|
|
475
|
+
to: [{ podSelector: { matchLabels: { tier: 'app' } } }],
|
|
476
|
+
ports: [{ protocol: 'TCP', port: 8080 }],
|
|
477
|
+
},
|
|
478
|
+
// Allow DNS resolution
|
|
479
|
+
{
|
|
480
|
+
to: [{ namespaceSelector: { matchLabels: { name: 'kube-system' } } }],
|
|
481
|
+
ports: [
|
|
482
|
+
{ protocol: 'UDP', port: 53 },
|
|
483
|
+
{ protocol: 'TCP', port: 53 },
|
|
484
|
+
],
|
|
485
|
+
},
|
|
486
|
+
],
|
|
487
|
+
});
|
|
488
|
+
|
|
489
|
+
// App tier - only allow traffic from web tier
|
|
490
|
+
rutter.addNetworkPolicy({
|
|
491
|
+
name: 'app-tier-policy',
|
|
492
|
+
podSelector: { matchLabels: { tier: 'app' } },
|
|
493
|
+
policyTypes: ['Ingress', 'Egress'],
|
|
494
|
+
ingress: [
|
|
495
|
+
{
|
|
496
|
+
from: [{ podSelector: { matchLabels: { tier: 'web' } } }],
|
|
497
|
+
ports: [{ protocol: 'TCP', port: 8080 }],
|
|
498
|
+
},
|
|
499
|
+
],
|
|
500
|
+
egress: [
|
|
501
|
+
// Allow access to database
|
|
502
|
+
{
|
|
503
|
+
to: [{ podSelector: { matchLabels: { tier: 'database' } } }],
|
|
504
|
+
ports: [{ protocol: 'TCP', port: 5432 }],
|
|
505
|
+
},
|
|
506
|
+
// Allow external API calls (with CIDR restrictions)
|
|
507
|
+
{
|
|
508
|
+
to: [
|
|
509
|
+
{
|
|
510
|
+
ipBlock: {
|
|
511
|
+
cidr: '0.0.0.0/0',
|
|
512
|
+
except: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'],
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
],
|
|
516
|
+
ports: [{ protocol: 'TCP', port: 443 }],
|
|
517
|
+
},
|
|
518
|
+
],
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
// Database tier - most restrictive
|
|
522
|
+
rutter.addNetworkPolicy({
|
|
523
|
+
name: 'database-tier-policy',
|
|
524
|
+
podSelector: { matchLabels: { tier: 'database' } },
|
|
525
|
+
policyTypes: ['Ingress', 'Egress'],
|
|
526
|
+
ingress: [
|
|
527
|
+
{
|
|
528
|
+
from: [{ podSelector: { matchLabels: { tier: 'app' } } }],
|
|
529
|
+
ports: [{ protocol: 'TCP', port: 5432 }],
|
|
530
|
+
},
|
|
531
|
+
],
|
|
532
|
+
egress: [
|
|
533
|
+
// Only allow DNS resolution
|
|
534
|
+
{
|
|
535
|
+
to: [{ namespaceSelector: { matchLabels: { name: 'kube-system' } } }],
|
|
536
|
+
ports: [
|
|
537
|
+
{ protocol: 'UDP', port: 53 },
|
|
538
|
+
{ protocol: 'TCP', port: 53 },
|
|
539
|
+
],
|
|
540
|
+
},
|
|
541
|
+
],
|
|
542
|
+
});
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
#### Cross-Namespace Communication
|
|
546
|
+
|
|
547
|
+
```typescript
|
|
548
|
+
// Allow traffic from monitoring namespace
|
|
549
|
+
rutter.addAllowFromNamespaceNetworkPolicy({
|
|
550
|
+
name: 'allow-monitoring',
|
|
551
|
+
targetPodSelector: { app: 'backend' },
|
|
552
|
+
sourceNamespaceSelector: { name: 'monitoring' },
|
|
553
|
+
ports: [{ protocol: 'TCP', port: 9090 }], // Prometheus metrics
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
// Allow traffic to shared services namespace
|
|
557
|
+
rutter.addNetworkPolicy({
|
|
558
|
+
name: 'allow-to-shared-services',
|
|
559
|
+
podSelector: { matchLabels: { app: 'backend' } },
|
|
560
|
+
policyTypes: ['Egress'],
|
|
561
|
+
egress: [
|
|
562
|
+
{
|
|
563
|
+
to: [
|
|
564
|
+
{
|
|
565
|
+
namespaceSelector: { matchLabels: { name: 'shared-services' } },
|
|
566
|
+
podSelector: { matchLabels: { app: 'redis' } },
|
|
567
|
+
},
|
|
568
|
+
],
|
|
569
|
+
ports: [{ protocol: 'TCP', port: 6379 }],
|
|
570
|
+
},
|
|
571
|
+
],
|
|
572
|
+
});
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Security Best Practices
|
|
576
|
+
|
|
577
|
+
#### 1. Start with Deny-All Policies
|
|
578
|
+
|
|
579
|
+
```typescript
|
|
580
|
+
// Always start with deny-all for maximum security
|
|
581
|
+
rutter.addDenyAllNetworkPolicy('default-deny-all');
|
|
582
|
+
|
|
583
|
+
// Then add specific allow rules
|
|
584
|
+
rutter.addAllowFromPodsNetworkPolicy({
|
|
585
|
+
name: 'allow-specific-communication',
|
|
586
|
+
targetPodSelector: { app: 'api' },
|
|
587
|
+
sourcePodSelector: { app: 'frontend' },
|
|
588
|
+
ports: [{ protocol: 'TCP', port: 8080 }],
|
|
589
|
+
});
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
#### 2. Separate Ingress and Egress Policies
|
|
593
|
+
|
|
594
|
+
```typescript
|
|
595
|
+
// Separate policies for better maintainability
|
|
596
|
+
rutter.addDenyAllIngressNetworkPolicy('deny-all-ingress');
|
|
597
|
+
rutter.addDenyAllEgressNetworkPolicy('deny-all-egress');
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
#### 3. Use CIDR Blocks for External Access
|
|
601
|
+
|
|
602
|
+
```typescript
|
|
603
|
+
// Restrict external access to specific IP ranges
|
|
604
|
+
rutter.addNetworkPolicy({
|
|
605
|
+
name: 'external-api-access',
|
|
606
|
+
podSelector: { matchLabels: { app: 'backend' } },
|
|
607
|
+
policyTypes: ['Egress'],
|
|
608
|
+
egress: [
|
|
609
|
+
{
|
|
610
|
+
to: [
|
|
611
|
+
{
|
|
612
|
+
ipBlock: {
|
|
613
|
+
cidr: '203.0.113.0/24', // Specific external service
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
],
|
|
617
|
+
ports: [{ protocol: 'TCP', port: 443 }],
|
|
618
|
+
},
|
|
619
|
+
],
|
|
620
|
+
});
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
#### 4. Include DNS Resolution
|
|
624
|
+
|
|
625
|
+
```typescript
|
|
626
|
+
// Always allow DNS for name resolution
|
|
627
|
+
const dnsEgressRule = {
|
|
628
|
+
to: [{ namespaceSelector: { matchLabels: { name: 'kube-system' } } }],
|
|
629
|
+
ports: [
|
|
630
|
+
{ protocol: 'UDP', port: 53 },
|
|
631
|
+
{ protocol: 'TCP', port: 53 },
|
|
632
|
+
],
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
rutter.addNetworkPolicy({
|
|
636
|
+
name: 'app-with-dns',
|
|
637
|
+
podSelector: { matchLabels: { app: 'backend' } },
|
|
638
|
+
policyTypes: ['Egress'],
|
|
639
|
+
egress: [dnsEgressRule /* other rules */],
|
|
640
|
+
});
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### Basic NetworkPolicy
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
// Custom NetworkPolicy with full control
|
|
647
|
+
rutter.addNetworkPolicy({
|
|
648
|
+
name: 'custom-policy',
|
|
649
|
+
podSelector: { matchLabels: { app: 'backend' } },
|
|
650
|
+
policyTypes: ['Ingress', 'Egress'],
|
|
651
|
+
ingress: [
|
|
652
|
+
{
|
|
653
|
+
from: [{ podSelector: { matchLabels: { app: 'frontend' } } }],
|
|
654
|
+
ports: [{ protocol: 'TCP', port: 8080 }],
|
|
655
|
+
},
|
|
656
|
+
],
|
|
657
|
+
egress: [
|
|
658
|
+
{
|
|
659
|
+
to: [{ podSelector: { matchLabels: { app: 'database' } } }],
|
|
660
|
+
ports: [{ protocol: 'TCP', port: 5432 }],
|
|
661
|
+
},
|
|
662
|
+
],
|
|
663
|
+
});
|
|
664
|
+
```
|
|
665
|
+
|
|
248
666
|
## Multi-environment values
|
|
249
667
|
|
|
250
668
|
Provide `envValues` in the `Rutter` constructor to automatically create
|
|
@@ -270,9 +688,12 @@ Provide `envValues` in the `Rutter` constructor to automatically create
|
|
|
270
688
|
|
|
271
689
|
## Roadmap
|
|
272
690
|
|
|
273
|
-
-
|
|
691
|
+
- ✅ Auto-scaling helpers (HPA, VPA, PodDisruptionBudget)
|
|
692
|
+
- ✅ AWS multi-cloud support (EBS, EFS, ALB, IRSA, Secrets Manager, Parameter Store)
|
|
693
|
+
- ✅ Custom manifest naming and file organization
|
|
694
|
+
- Azure multi-cloud support (AKS-specific helpers)
|
|
695
|
+
- GCP multi-cloud support (GKE-specific helpers)
|
|
274
696
|
- Richer CLI (resource generators, diff)
|
|
275
|
-
- Enhanced multi-cloud support
|
|
276
697
|
- Template validation and testing utilities
|
|
277
698
|
|
|
278
699
|
## Contributing
|