@toa.io/cli 1.0.0-alpha.164 → 1.0.0-alpha.165

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/cli",
3
- "version": "1.0.0-alpha.164",
3
+ "version": "1.0.0-alpha.165",
4
4
  "description": "Toa CLI",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -34,5 +34,5 @@
34
34
  "paseto": "3.1.4",
35
35
  "yargs": "17.6.2"
36
36
  },
37
- "gitHead": "b5c5d885277df7db99885b84b33b8a8634c75f46"
37
+ "gitHead": "c34c88631d176a82bbc039c29a2a95d2d8815ff9"
38
38
  }
@@ -0,0 +1,7 @@
1
+ 'use strict'
2
+
3
+ const { limits } = require('../handlers/limits')
4
+
5
+ exports.command = 'limits'
6
+ exports.desc = 'Get resource limits for all pods in the current Kubernetes context'
7
+ exports.handler = limits
@@ -0,0 +1,19 @@
1
+ 'use strict'
2
+
3
+ /*
4
+ kubectl get pods -o=custom-columns='NAME:.metadata.name,CPU_REQUEST:.spec.containers[*].resources.requests.cpu,CPU_LIMIT:.spec.containers[*].resources.limits.cpu,MEM_REQUEST:.spec.containers[*].resources.requests.memory,MEM_LIMIT:.spec.containers[*].resources.limits.memory'
5
+ */
6
+
7
+ const { spawn } = require('node:child_process')
8
+
9
+ const limits = async (argv) => {
10
+ const args = [
11
+ 'get',
12
+ 'pods',
13
+ '-o=custom-columns=NAME:.metadata.name,CPU:.spec.containers[*].resources.requests.cpu,:.spec.containers[*].resources.limits.cpu,MEM:.spec.containers[*].resources.requests.memory,:.spec.containers[*].resources.limits.memory'
14
+ ]
15
+
16
+ await spawn('kubectl', args, { stdio: 'inherit' })
17
+ }
18
+
19
+ exports.limits = limits