@enspirit/emb 0.23.0 → 0.24.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.
Files changed (28) hide show
  1. package/README.md +42 -42
  2. package/dist/src/cli/abstract/KubernetesCommand.d.ts +5 -1
  3. package/dist/src/cli/abstract/KubernetesCommand.js +11 -2
  4. package/dist/src/cli/commands/kubernetes/logs.js +7 -12
  5. package/dist/src/cli/commands/kubernetes/ps.js +2 -1
  6. package/dist/src/cli/commands/kubernetes/restart.js +2 -1
  7. package/dist/src/cli/commands/kubernetes/shell.js +7 -10
  8. package/dist/src/config/schema.d.ts +33 -1
  9. package/dist/src/config/schema.json +42 -1
  10. package/dist/src/docker/compose/client.js +2 -2
  11. package/dist/src/docker/compose/operations/ComposeLogsArchiveOperation.d.ts +1 -1
  12. package/dist/src/kubernetes/index.d.ts +1 -0
  13. package/dist/src/kubernetes/index.js +1 -0
  14. package/dist/src/kubernetes/operations/GetComponentPodOperation.d.ts +17 -0
  15. package/dist/src/kubernetes/operations/GetComponentPodOperation.js +77 -0
  16. package/dist/src/kubernetes/operations/GetDeploymentPodsOperation.js +3 -2
  17. package/dist/src/kubernetes/operations/PodExecOperation.d.ts +20 -0
  18. package/dist/src/kubernetes/operations/PodExecOperation.js +158 -0
  19. package/dist/src/kubernetes/operations/index.d.ts +3 -0
  20. package/dist/src/kubernetes/operations/index.js +3 -0
  21. package/dist/src/kubernetes/utils/index.d.ts +1 -0
  22. package/dist/src/kubernetes/utils/index.js +1 -0
  23. package/dist/src/kubernetes/utils/resolveNamespace.d.ts +13 -0
  24. package/dist/src/kubernetes/utils/resolveNamespace.js +12 -0
  25. package/dist/src/monorepo/operations/tasks/RunTasksOperation.d.ts +2 -0
  26. package/dist/src/monorepo/operations/tasks/RunTasksOperation.js +43 -3
  27. package/oclif.manifest.json +142 -145
  28. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ $ npm install -g @enspirit/emb
14
14
  $ emb COMMAND
15
15
  running command...
16
16
  $ emb (--version)
17
- @enspirit/emb/0.23.0 darwin-arm64 node-v22.21.1
17
+ @enspirit/emb/0.24.0 darwin-x64 node-v22.18.0
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -112,7 +112,7 @@ EXAMPLES
112
112
  $ emb clean
113
113
  ```
114
114
 
115
- _See code: [src/commands/clean.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/clean.ts)_
115
+ _See code: [src/commands/clean.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/clean.ts)_
116
116
 
117
117
  ## `emb components`
118
118
 
@@ -137,7 +137,7 @@ EXAMPLES
137
137
  $ emb components
138
138
  ```
139
139
 
140
- _See code: [src/commands/components/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/components/index.ts)_
140
+ _See code: [src/commands/components/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/components/index.ts)_
141
141
 
142
142
  ## `emb components shell SERVICE`
143
143
 
@@ -165,7 +165,7 @@ EXAMPLES
165
165
  $ emb components shell
166
166
  ```
167
167
 
168
- _See code: [src/commands/components/shell.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/components/shell.ts)_
168
+ _See code: [src/commands/components/shell.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/components/shell.ts)_
169
169
 
170
170
  ## `emb config print`
171
171
 
@@ -190,7 +190,7 @@ EXAMPLES
190
190
  $ emb config print
191
191
  ```
192
192
 
193
- _See code: [src/commands/config/print.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/config/print.ts)_
193
+ _See code: [src/commands/config/print.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/config/print.ts)_
194
194
 
195
195
  ## `emb containers`
196
196
 
@@ -215,7 +215,7 @@ EXAMPLES
215
215
  $ emb containers
216
216
  ```
217
217
 
218
- _See code: [src/commands/containers/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/containers/index.ts)_
218
+ _See code: [src/commands/containers/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/containers/index.ts)_
219
219
 
220
220
  ## `emb containers prune`
221
221
 
@@ -239,7 +239,7 @@ EXAMPLES
239
239
  $ emb containers prune
240
240
  ```
241
241
 
242
- _See code: [src/commands/containers/prune.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/containers/prune.ts)_
242
+ _See code: [src/commands/containers/prune.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/containers/prune.ts)_
243
243
 
244
244
  ## `emb down [SERVICE]`
245
245
 
@@ -267,7 +267,7 @@ EXAMPLES
267
267
  $ emb down
268
268
  ```
269
269
 
270
- _See code: [src/commands/down.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/down.ts)_
270
+ _See code: [src/commands/down.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/down.ts)_
271
271
 
272
272
  ## `emb help [COMMAND]`
273
273
 
@@ -313,7 +313,7 @@ EXAMPLES
313
313
  $ emb images
314
314
  ```
315
315
 
316
- _See code: [src/commands/images/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/images/index.ts)_
316
+ _See code: [src/commands/images/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/images/index.ts)_
317
317
 
318
318
  ## `emb images delete`
319
319
 
@@ -338,7 +338,7 @@ EXAMPLES
338
338
  $ emb images delete
339
339
  ```
340
340
 
341
- _See code: [src/commands/images/delete.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/images/delete.ts)_
341
+ _See code: [src/commands/images/delete.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/images/delete.ts)_
342
342
 
343
343
  ## `emb images prune`
344
344
 
@@ -363,7 +363,7 @@ EXAMPLES
363
363
  $ emb images prune
364
364
  ```
365
365
 
366
- _See code: [src/commands/images/prune.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/images/prune.ts)_
366
+ _See code: [src/commands/images/prune.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/images/prune.ts)_
367
367
 
368
368
  ## `emb images push`
369
369
 
@@ -392,7 +392,7 @@ EXAMPLES
392
392
  $ emb images push --registry my.registry.io --retag newtag
393
393
  ```
394
394
 
395
- _See code: [src/commands/images/push.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/images/push.ts)_
395
+ _See code: [src/commands/images/push.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/images/push.ts)_
396
396
 
397
397
  ## `emb kubernetes logs COMPONENT`
398
398
 
@@ -400,7 +400,7 @@ Follow kubernetes logs.
400
400
 
401
401
  ```
402
402
  USAGE
403
- $ emb kubernetes logs COMPONENT -n <value> [--verbose] [-C <value>] [-f]
403
+ $ emb kubernetes logs COMPONENT [--verbose] [-C <value>] [-n <value>] [-f]
404
404
 
405
405
  ARGUMENTS
406
406
  COMPONENT The component you want to see the logs of
@@ -408,7 +408,7 @@ ARGUMENTS
408
408
  FLAGS
409
409
  -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
410
410
  -f, --[no-]follow Follow log output
411
- -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
411
+ -n, --namespace=<value> The Kubernetes namespace to target
412
412
  --[no-]verbose
413
413
 
414
414
  DESCRIPTION
@@ -418,7 +418,7 @@ EXAMPLES
418
418
  $ emb kubernetes logs
419
419
  ```
420
420
 
421
- _See code: [src/commands/kubernetes/logs.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/kubernetes/logs.ts)_
421
+ _See code: [src/commands/kubernetes/logs.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/kubernetes/logs.ts)_
422
422
 
423
423
  ## `emb kubernetes ps`
424
424
 
@@ -426,11 +426,11 @@ Show running pods.
426
426
 
427
427
  ```
428
428
  USAGE
429
- $ emb kubernetes ps -n <value> [--verbose] [-C <value>] [--watch]
429
+ $ emb kubernetes ps [--verbose] [-C <value>] [-n <value>] [--watch]
430
430
 
431
431
  FLAGS
432
432
  -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
433
- -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
433
+ -n, --namespace=<value> The Kubernetes namespace to target
434
434
  --[no-]verbose
435
435
  --[no-]watch
436
436
 
@@ -441,7 +441,7 @@ EXAMPLES
441
441
  $ emb kubernetes ps
442
442
  ```
443
443
 
444
- _See code: [src/commands/kubernetes/ps.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/kubernetes/ps.ts)_
444
+ _See code: [src/commands/kubernetes/ps.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/kubernetes/ps.ts)_
445
445
 
446
446
  ## `emb kubernetes restart [DEPLOYMENT]`
447
447
 
@@ -449,14 +449,14 @@ Restart pods of an instance.
449
449
 
450
450
  ```
451
451
  USAGE
452
- $ emb kubernetes restart [DEPLOYMENT...] -n <value> [--verbose] [-C <value>]
452
+ $ emb kubernetes restart [DEPLOYMENT...] [--verbose] [-C <value>] [-n <value>]
453
453
 
454
454
  ARGUMENTS
455
455
  [DEPLOYMENT...] The deployment(s) to restart
456
456
 
457
457
  FLAGS
458
458
  -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
459
- -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
459
+ -n, --namespace=<value> The Kubernetes namespace to target
460
460
  --[no-]verbose
461
461
 
462
462
  DESCRIPTION
@@ -466,7 +466,7 @@ EXAMPLES
466
466
  $ emb kubernetes restart
467
467
  ```
468
468
 
469
- _See code: [src/commands/kubernetes/restart.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/kubernetes/restart.ts)_
469
+ _See code: [src/commands/kubernetes/restart.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/kubernetes/restart.ts)_
470
470
 
471
471
  ## `emb kubernetes shell COMPONENT`
472
472
 
@@ -474,14 +474,14 @@ Get a shell on a deployed component.
474
474
 
475
475
  ```
476
476
  USAGE
477
- $ emb kubernetes shell COMPONENT -n <value> [--verbose] [-C <value>] [-s <value>]
477
+ $ emb kubernetes shell COMPONENT [--verbose] [-C <value>] [-n <value>] [-s <value>]
478
478
 
479
479
  ARGUMENTS
480
480
  COMPONENT The component you want to get a shell on
481
481
 
482
482
  FLAGS
483
483
  -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
484
- -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
484
+ -n, --namespace=<value> The Kubernetes namespace to target
485
485
  -s, --shell=<value> [default: bash] The shell to run
486
486
  --[no-]verbose
487
487
 
@@ -495,7 +495,7 @@ EXAMPLES
495
495
  $ emb kubernetes shell
496
496
  ```
497
497
 
498
- _See code: [src/commands/kubernetes/shell.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/kubernetes/shell.ts)_
498
+ _See code: [src/commands/kubernetes/shell.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/kubernetes/shell.ts)_
499
499
 
500
500
  ## `emb logs [SERVICE]`
501
501
 
@@ -526,7 +526,7 @@ EXAMPLES
526
526
  $ emb logs --no-follow backend
527
527
  ```
528
528
 
529
- _See code: [src/commands/logs/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/logs/index.ts)_
529
+ _See code: [src/commands/logs/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/logs/index.ts)_
530
530
 
531
531
  ## `emb logs archive [SERVICE]`
532
532
 
@@ -562,7 +562,7 @@ EXAMPLES
562
562
  $ emb logs archive --tail 1000
563
563
  ```
564
564
 
565
- _See code: [src/commands/logs/archive.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/logs/archive.ts)_
565
+ _See code: [src/commands/logs/archive.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/logs/archive.ts)_
566
566
 
567
567
  ## `emb ps`
568
568
 
@@ -585,7 +585,7 @@ EXAMPLES
585
585
  $ emb ps
586
586
  ```
587
587
 
588
- _See code: [src/commands/ps.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/ps.ts)_
588
+ _See code: [src/commands/ps.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/ps.ts)_
589
589
 
590
590
  ## `emb resources`
591
591
 
@@ -610,7 +610,7 @@ EXAMPLES
610
610
  $ emb resources
611
611
  ```
612
612
 
613
- _See code: [src/commands/resources/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/resources/index.ts)_
613
+ _See code: [src/commands/resources/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/resources/index.ts)_
614
614
 
615
615
  ## `emb resources build [COMPONENT]`
616
616
 
@@ -640,7 +640,7 @@ EXAMPLES
640
640
  $ emb resources build build --flavor development
641
641
  ```
642
642
 
643
- _See code: [src/commands/resources/build.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/resources/build.ts)_
643
+ _See code: [src/commands/resources/build.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/resources/build.ts)_
644
644
 
645
645
  ## `emb restart [SERVICE]`
646
646
 
@@ -668,7 +668,7 @@ EXAMPLES
668
668
  $ emb restart
669
669
  ```
670
670
 
671
- _See code: [src/commands/restart.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/restart.ts)_
671
+ _See code: [src/commands/restart.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/restart.ts)_
672
672
 
673
673
  ## `emb run TASK`
674
674
 
@@ -676,7 +676,7 @@ Run tasks.
676
676
 
677
677
  ```
678
678
  USAGE
679
- $ emb run TASK... [--json] [--verbose] [-C <value>] [-x container|local] [-a]
679
+ $ emb run TASK... [--json] [--verbose] [-C <value>] [-x container|kubernetes|local] [-a]
680
680
 
681
681
  ARGUMENTS
682
682
  TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
@@ -685,7 +685,7 @@ FLAGS
685
685
  -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
686
686
  -a, --all-matching Run all tasks matching (when multiple matches)
687
687
  -x, --executor=<option> Where to run the task. (experimental!)
688
- <options: container|local>
688
+ <options: container|kubernetes|local>
689
689
  --[no-]verbose
690
690
 
691
691
  GLOBAL FLAGS
@@ -726,7 +726,7 @@ EXAMPLES
726
726
  $ emb secrets --json
727
727
  ```
728
728
 
729
- _See code: [src/commands/secrets/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/secrets/index.ts)_
729
+ _See code: [src/commands/secrets/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/secrets/index.ts)_
730
730
 
731
731
  ## `emb secrets providers`
732
732
 
@@ -751,7 +751,7 @@ EXAMPLES
751
751
  $ emb secrets providers
752
752
  ```
753
753
 
754
- _See code: [src/commands/secrets/providers.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/secrets/providers.ts)_
754
+ _See code: [src/commands/secrets/providers.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/secrets/providers.ts)_
755
755
 
756
756
  ## `emb secrets validate`
757
757
 
@@ -781,7 +781,7 @@ EXAMPLES
781
781
  $ emb secrets validate --json
782
782
  ```
783
783
 
784
- _See code: [src/commands/secrets/validate.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/secrets/validate.ts)_
784
+ _See code: [src/commands/secrets/validate.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/secrets/validate.ts)_
785
785
 
786
786
  ## `emb shell SERVICE`
787
787
 
@@ -834,7 +834,7 @@ EXAMPLES
834
834
  $ emb start
835
835
  ```
836
836
 
837
- _See code: [src/commands/start.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/start.ts)_
837
+ _See code: [src/commands/start.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/start.ts)_
838
838
 
839
839
  ## `emb stop [SERVICE]`
840
840
 
@@ -862,7 +862,7 @@ EXAMPLES
862
862
  $ emb stop
863
863
  ```
864
864
 
865
- _See code: [src/commands/stop.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/stop.ts)_
865
+ _See code: [src/commands/stop.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/stop.ts)_
866
866
 
867
867
  ## `emb tasks`
868
868
 
@@ -886,7 +886,7 @@ EXAMPLES
886
886
  $ emb tasks
887
887
  ```
888
888
 
889
- _See code: [src/commands/tasks/index.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/tasks/index.ts)_
889
+ _See code: [src/commands/tasks/index.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/tasks/index.ts)_
890
890
 
891
891
  ## `emb tasks run TASK`
892
892
 
@@ -894,7 +894,7 @@ Run tasks.
894
894
 
895
895
  ```
896
896
  USAGE
897
- $ emb tasks run TASK... [--json] [--verbose] [-C <value>] [-x container|local] [-a]
897
+ $ emb tasks run TASK... [--json] [--verbose] [-C <value>] [-x container|kubernetes|local] [-a]
898
898
 
899
899
  ARGUMENTS
900
900
  TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
@@ -903,7 +903,7 @@ FLAGS
903
903
  -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
904
904
  -a, --all-matching Run all tasks matching (when multiple matches)
905
905
  -x, --executor=<option> Where to run the task. (experimental!)
906
- <options: container|local>
906
+ <options: container|kubernetes|local>
907
907
  --[no-]verbose
908
908
 
909
909
  GLOBAL FLAGS
@@ -919,7 +919,7 @@ EXAMPLES
919
919
  $ emb tasks run
920
920
  ```
921
921
 
922
- _See code: [src/commands/tasks/run.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/tasks/run.ts)_
922
+ _See code: [src/commands/tasks/run.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/tasks/run.ts)_
923
923
 
924
924
  ## `emb up [SERVICE]`
925
925
 
@@ -948,7 +948,7 @@ EXAMPLES
948
948
  $ emb up
949
949
  ```
950
950
 
951
- _See code: [src/commands/up.ts](https://github.com/enspirit/emb/blob/v0.23.0/src/commands/up.ts)_
951
+ _See code: [src/commands/up.ts](https://github.com/enspirit/emb/blob/v0.24.0/src/commands/up.ts)_
952
952
 
953
953
  ## `emb update [CHANNEL]`
954
954
 
@@ -1,8 +1,12 @@
1
1
  import { BaseCommand } from './BaseCommand.js';
2
2
  export declare abstract class KubernetesCommand extends BaseCommand {
3
3
  static baseFlags: {
4
- namespace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
4
+ namespace: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
5
5
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
6
  root: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
7
  };
8
+ /**
9
+ * Resolves the namespace using CLI flag > K8S_NAMESPACE env > config > 'default'
10
+ */
11
+ protected resolveNamespace(cliFlag?: string): string;
8
12
  }
@@ -1,4 +1,5 @@
1
1
  import { Flags } from '@oclif/core';
2
+ import { resolveNamespace } from '../../kubernetes/utils/index.js';
2
3
  import { BaseCommand } from './BaseCommand.js';
3
4
  export class KubernetesCommand extends BaseCommand {
4
5
  static baseFlags = {
@@ -8,8 +9,16 @@ export class KubernetesCommand extends BaseCommand {
8
9
  description: 'The Kubernetes namespace to target',
9
10
  aliases: ['ns'],
10
11
  char: 'n',
11
- required: true,
12
- env: 'K8S_NAMESPACE',
12
+ required: false,
13
13
  }),
14
14
  };
15
+ /**
16
+ * Resolves the namespace using CLI flag > K8S_NAMESPACE env > config > 'default'
17
+ */
18
+ resolveNamespace(cliFlag) {
19
+ return resolveNamespace({
20
+ cliFlag,
21
+ config: this.context.monorepo.config.defaults?.kubernetes?.namespace,
22
+ });
23
+ }
15
24
  }
@@ -2,7 +2,7 @@ import { Log } from '@kubernetes/client-node';
2
2
  import { Args, Flags } from '@oclif/core';
3
3
  import { PassThrough } from 'node:stream';
4
4
  import { KubernetesCommand } from '../../index.js';
5
- import { GetDeploymentPodsOperation } from '../../../kubernetes/operations/GetDeploymentPodsOperation.js';
5
+ import { GetComponentPodOperation } from '../../../kubernetes/operations/index.js';
6
6
  export default class KubernetesLogs extends KubernetesCommand {
7
7
  static description = 'Follow kubernetes logs.';
8
8
  static enableJsonFlag = false;
@@ -26,23 +26,18 @@ export default class KubernetesLogs extends KubernetesCommand {
26
26
  async run() {
27
27
  const { flags, args } = await this.parse(KubernetesLogs);
28
28
  const { monorepo, kubernetes } = this.context;
29
- // Check the component name is valid (would raise otherwise)
30
- monorepo.component(args.component);
31
- const pods = await monorepo.run(new GetDeploymentPodsOperation(), {
32
- namespace: flags.namespace,
33
- deployment: args.component,
29
+ const namespace = this.resolveNamespace(flags.namespace);
30
+ const component = monorepo.component(args.component);
31
+ const { pod, container } = await monorepo.run(new GetComponentPodOperation(), {
32
+ namespace,
33
+ component,
34
34
  });
35
- if (pods.length === 0) {
36
- throw new Error(`No running pod found for component ${args.component}`);
37
- }
38
35
  const k8sLogs = new Log(kubernetes.config);
39
36
  const transform = new PassThrough();
40
37
  transform.on('data', (chunk) => {
41
38
  process.stdout.write(chunk);
42
39
  });
43
- const pod = pods[0];
44
- const container = pod.spec.containers[0];
45
- await k8sLogs.log(flags.namespace, pod.metadata.name, container.name, transform, {
40
+ await k8sLogs.log(namespace, pod.metadata.name, container, transform, {
46
41
  follow: flags.follow,
47
42
  tailLines: 50,
48
43
  pretty: false,
@@ -15,8 +15,9 @@ export default class KPSCommand extends KubernetesCommand {
15
15
  async run() {
16
16
  const { flags } = await this.parse(KPSCommand);
17
17
  const { kubernetes } = getContext();
18
+ const namespace = this.resolveNamespace(flags.namespace);
18
19
  const { items } = await kubernetes.core.listNamespacedPod({
19
- namespace: flags.namespace,
20
+ namespace,
20
21
  });
21
22
  const pods = items.map((i) => {
22
23
  const restarts = i.status?.containerStatuses
@@ -14,8 +14,9 @@ export default class KRestartCommand extends KubernetesCommand {
14
14
  async run() {
15
15
  const { flags, argv } = await this.parse(KRestartCommand);
16
16
  const { monorepo } = getContext();
17
+ const namespace = this.resolveNamespace(flags.namespace);
17
18
  await monorepo.run(new PodsRestartOperation(), {
18
- namespace: flags.namespace,
19
+ namespace,
19
20
  deployments: argv.length > 0 ? argv : undefined,
20
21
  });
21
22
  }
@@ -1,7 +1,7 @@
1
1
  import { Exec } from '@kubernetes/client-node';
2
2
  import { Args, Flags } from '@oclif/core';
3
3
  import { getContext, KubernetesCommand } from '../../index.js';
4
- import { GetDeploymentPodsOperation } from '../../../kubernetes/operations/GetDeploymentPodsOperation.js';
4
+ import { GetComponentPodOperation } from '../../../kubernetes/operations/index.js';
5
5
  import { enableRawMode } from '../../../utils/streams.js';
6
6
  export default class PodShellCommand extends KubernetesCommand {
7
7
  static aliases = ['shell'];
@@ -26,18 +26,15 @@ export default class PodShellCommand extends KubernetesCommand {
26
26
  async run() {
27
27
  const { flags, args } = await this.parse(PodShellCommand);
28
28
  const { monorepo, kubernetes } = await getContext();
29
- const pods = await monorepo.run(new GetDeploymentPodsOperation(), {
30
- namespace: flags.namespace,
31
- deployment: args.component,
29
+ const namespace = this.resolveNamespace(flags.namespace);
30
+ const component = monorepo.component(args.component);
31
+ const { pod, container } = await monorepo.run(new GetComponentPodOperation(), {
32
+ namespace,
33
+ component,
32
34
  });
33
- if (pods.length === 0) {
34
- throw new Error(`No running pod found for component ${args.component}`);
35
- }
36
- const pod = pods[0];
37
- const container = pod.spec.containers[0];
38
35
  const exec = new Exec(kubernetes.config);
39
36
  enableRawMode(process.stdin);
40
- const res = await exec.exec(flags.namespace, pod.metadata.name, container.name, [flags.shell], process.stdout, process.stderr, process.stdin, true);
37
+ const res = await exec.exec(namespace, pod.metadata.name, container, [flags.shell], process.stdout, process.stderr, process.stdin, true);
41
38
  res.on('close', () => {
42
39
  // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
43
40
  process.exit(0);
@@ -18,7 +18,7 @@ export type TaskConfig = TaskConfig1 & {
18
18
  [k: string]: unknown;
19
19
  };
20
20
  pre?: QualifiedIdentifier[];
21
- executors?: ("local" | "container")[];
21
+ executors?: ("local" | "container" | "kubernetes")[];
22
22
  /**
23
23
  * Whether the task is interactive (requires TTY)
24
24
  */
@@ -107,6 +107,24 @@ export interface DefaultsConfig {
107
107
  };
108
108
  [k: string]: unknown;
109
109
  };
110
+ kubernetes?: KubernetesConfig;
111
+ }
112
+ /**
113
+ * Kubernetes configuration for the project
114
+ */
115
+ export interface KubernetesConfig {
116
+ /**
117
+ * Default Kubernetes namespace to use
118
+ */
119
+ namespace?: string;
120
+ /**
121
+ * Kubernetes context to use from kubeconfig
122
+ */
123
+ context?: string;
124
+ /**
125
+ * Label name used in pod selectors. Defaults to 'app.kubernetes.io/component'
126
+ */
127
+ selectorLabel?: string;
110
128
  }
111
129
  export interface ComponentConfig {
112
130
  /**
@@ -126,6 +144,7 @@ export interface ComponentConfig {
126
144
  flavors?: {
127
145
  [k: string]: ComponentFlavorConfig;
128
146
  };
147
+ kubernetes?: ComponentKubernetesConfig;
129
148
  }
130
149
  export interface ComponentFlavorConfig {
131
150
  patches?: JsonPatchOperation[];
@@ -154,6 +173,19 @@ export interface JsonPatchCopyOperation {
154
173
  path: string;
155
174
  from: string;
156
175
  }
176
+ /**
177
+ * Kubernetes configuration for a component
178
+ */
179
+ export interface ComponentKubernetesConfig {
180
+ /**
181
+ * Label selector to find pods (e.g., 'app=api,tier=backend'). Defaults to '{componentLabel}={component}'
182
+ */
183
+ selector?: string;
184
+ /**
185
+ * Container name for multi-container pods
186
+ */
187
+ container?: string;
188
+ }
157
189
  export interface ProjectFlavorConfig {
158
190
  patches?: JsonPatchOperation[];
159
191
  }
@@ -71,6 +71,40 @@
71
71
  "type": "string",
72
72
  "pattern": "^([a-zA-Z]+[\\w._-]+:)?[a-zA-Z]+[\\w._-]+$"
73
73
  },
74
+ "KubernetesConfig": {
75
+ "type": "object",
76
+ "description": "Kubernetes configuration for the project",
77
+ "properties": {
78
+ "namespace": {
79
+ "type": "string",
80
+ "description": "Default Kubernetes namespace to use"
81
+ },
82
+ "context": {
83
+ "type": "string",
84
+ "description": "Kubernetes context to use from kubeconfig"
85
+ },
86
+ "selectorLabel": {
87
+ "type": "string",
88
+ "description": "Label name used in pod selectors. Defaults to 'app.kubernetes.io/component'"
89
+ }
90
+ },
91
+ "additionalProperties": false
92
+ },
93
+ "ComponentKubernetesConfig": {
94
+ "type": "object",
95
+ "description": "Kubernetes configuration for a component",
96
+ "properties": {
97
+ "selector": {
98
+ "type": "string",
99
+ "description": "Label selector to find pods (e.g., 'app=api,tier=backend'). Defaults to '{componentLabel}={component}'"
100
+ },
101
+ "container": {
102
+ "type": "string",
103
+ "description": "Container name for multi-container pods"
104
+ }
105
+ },
106
+ "additionalProperties": false
107
+ },
74
108
  "DefaultsConfig": {
75
109
  "type": "object",
76
110
  "description": "Default settings for build aspects",
@@ -103,6 +137,9 @@
103
137
  }
104
138
  }
105
139
  }
140
+ },
141
+ "kubernetes": {
142
+ "$ref": "#/definitions/KubernetesConfig"
106
143
  }
107
144
  }
108
145
  },
@@ -138,7 +175,8 @@
138
175
  "items": {
139
176
  "anyOf": [
140
177
  { "const": "local" },
141
- { "const": "container" }
178
+ { "const": "container" },
179
+ { "const": "kubernetes" }
142
180
  ]
143
181
  }
144
182
  },
@@ -200,6 +238,9 @@
200
238
  "additionalProperties": {
201
239
  "$ref": "#/definitions/ComponentFlavorConfig"
202
240
  }
241
+ },
242
+ "kubernetes": {
243
+ "$ref": "#/definitions/ComponentKubernetesConfig"
203
244
  }
204
245
  },
205
246
  "additionalProperties": false
@@ -23,7 +23,7 @@ export class DockerComposeClient {
23
23
  async validateService(serviceName) {
24
24
  await this.init();
25
25
  if (!this.services?.has(serviceName)) {
26
- const available = Array.from(this.services?.keys() ?? []).join(', ');
26
+ const available = [...(this.services?.keys() ?? [])].join(', ');
27
27
  throw new Error(`Unknown service '${serviceName}'. Available services: ${available || 'none'}`);
28
28
  }
29
29
  return serviceName;
@@ -44,7 +44,7 @@ export class DockerComposeClient {
44
44
  */
45
45
  async getServiceNames() {
46
46
  await this.init();
47
- return Array.from(this.services?.keys() ?? []);
47
+ return [...(this.services?.keys() ?? [])];
48
48
  }
49
49
  async getContainer(serviceName, options = DefaultGetContainerOptions) {
50
50
  const getOptions = { ...DefaultGetContainerOptions, ...options };
@@ -7,8 +7,8 @@ export declare const ComposeLogsArchiveOperationInputSchema: z.ZodOptional<z.Zod
7
7
  tail: z.ZodOptional<z.ZodNumber>;
8
8
  }, z.core.$strip>>;
9
9
  export interface ArchivedLogFile {
10
- service: string;
11
10
  path: string;
11
+ service: string;
12
12
  }
13
13
  export declare class ComposeLogsArchiveOperation extends AbstractOperation<typeof ComposeLogsArchiveOperationInputSchema, ArchivedLogFile[]> {
14
14
  constructor();
@@ -1,2 +1,3 @@
1
1
  export * from './client.js';
2
2
  export * from './operations/index.js';
3
+ export * from './utils/index.js';