@leverege/build-tools 2.3.3 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.3.3",
3
+ "version": "2.4.0",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,6 +28,7 @@
28
28
  "helminit-dp": "src/helminit-dp",
29
29
  "helminit-scaler": "src/helminit-scaler",
30
30
  "helmup": "src/helmup",
31
+ "k8scale": "k8scale",
31
32
  "k8x": "src/k8x",
32
33
  "npm-link": "src/npm-link",
33
34
  "npm-unlink": "src/npm-unlink",
package/src/husky-run ADDED
@@ -0,0 +1,6 @@
1
+ #!/bin/bash
2
+
3
+ printf "\n***** Running Husky Pre-Checks *****\n\n"
4
+
5
+ sleep 3
6
+ exit 1
package/src/k8scale ADDED
@@ -0,0 +1,44 @@
1
+ #!/bin/bash
2
+
3
+ # Simple ANSI color coded string generator.
4
+ function color() {
5
+ local color=
6
+ case "$1" in
7
+ 'g') color="92m" ;; # green
8
+ 'c') color="96m" ;; # lt blue
9
+ 'y') color="93m" ;; # yellow
10
+ 'r') color="91m" ;; # red
11
+ 'toast') color="1;3;7;91;103;5m" ;;
12
+ esac
13
+ printf "\e[$color$2\e[0m"
14
+ }
15
+
16
+ GITTOP=`git rev-parse --show-toplevel` && cd $GITTOP
17
+
18
+ overwhelm
19
+ [ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
20
+
21
+ REPLICAS=
22
+ DIRECTION=$1 && shift
23
+ case $DIRECTION in
24
+ up)
25
+ REPLICAS=1
26
+ ;;
27
+ dn|down)
28
+ REPLICAS=0
29
+ DIRECTION=down
30
+ ;;
31
+ *)
32
+ printf "Usage: `color g 'k8scale <up|dn|down> [deployment-list]'`\n\n" && exit 1
33
+ esac
34
+
35
+ printf " scaled => `color g $DIRECTION`\n\n"
36
+ for DEPLOYMENT in "$@";
37
+ do
38
+ IFS="/" read SERVICE <<< "$DEPLOYMENT" # strip trailing /
39
+ RESULTS="`color g SUCCESS`"
40
+ kubectl scale --replicas=$REPLICAS deployment $SERVICE &>/dev/null
41
+ [ $? -eq 1 ] && RESULTS="`color r FAILURE`"
42
+ printf " $RESULTS => $SERVICE\n"
43
+ done
44
+ printf "\n\n"