@leverege/build-tools 2.9.6 → 2.10.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/lib/server/overwhelm.js +16 -3
- package/lib/server/repo-init/config.tgz +0 -0
- package/lib/web/overwhelm.js +16 -3
- package/package.json +4 -10
- package/src/circleate +17 -16
- package/src/helmup +16 -2
- package/src/overwhelm.js +7 -2
- package/lib/server/helmify/files.js +0 -24
- package/lib/server/helmify/helm.js +0 -246
- package/lib/server/helmify/index.js +0 -46
- package/src/helm-repos-reload +0 -21
- package/src/helminit-dp +0 -177
- package/src/helminit-scaler +0 -20
- package/src/helminit-svc +0 -22
- package/src/iam-roles +0 -70
- package/src/install-traefik +0 -42
package/lib/server/overwhelm.js
CHANGED
|
@@ -53,12 +53,20 @@ const optionsDefinitions = [
|
|
|
53
53
|
alias: 't',
|
|
54
54
|
type: Boolean,
|
|
55
55
|
default: false
|
|
56
|
-
},
|
|
56
|
+
}, // checks overwhelm context
|
|
57
|
+
{
|
|
57
58
|
name: 'fetchctx',
|
|
58
59
|
alias: 'f',
|
|
59
60
|
type: Boolean,
|
|
60
61
|
default: false
|
|
61
|
-
},
|
|
62
|
+
}, // fetch and set k8s context
|
|
63
|
+
{
|
|
64
|
+
name: 'matchk8s',
|
|
65
|
+
alias: 'm',
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false
|
|
68
|
+
}, // checks k8s context
|
|
69
|
+
{
|
|
62
70
|
name: 'verbose',
|
|
63
71
|
alias: 'v',
|
|
64
72
|
type: Boolean,
|
|
@@ -377,7 +385,12 @@ if (cfgs.CLOUD === 'aws') {
|
|
|
377
385
|
} // TODO - FETCH AWS CLUSTER CREDENTIALS
|
|
378
386
|
|
|
379
387
|
|
|
380
|
-
const matchedCtx = currentCtx === desiredCtx;
|
|
388
|
+
const matchedCtx = currentCtx === desiredCtx;
|
|
389
|
+
|
|
390
|
+
if (args.matchk8s) {
|
|
391
|
+
process.exit(matchedCtx ? 0 : 1);
|
|
392
|
+
} // just fetch the context and exit if -f is specified
|
|
393
|
+
|
|
381
394
|
|
|
382
395
|
if (args.fetchctx) {
|
|
383
396
|
if (!matchedCtx) {
|
|
Binary file
|
package/lib/web/overwhelm.js
CHANGED
|
@@ -53,12 +53,20 @@ const optionsDefinitions = [
|
|
|
53
53
|
alias: 't',
|
|
54
54
|
type: Boolean,
|
|
55
55
|
default: false
|
|
56
|
-
},
|
|
56
|
+
}, // checks overwhelm context
|
|
57
|
+
{
|
|
57
58
|
name: 'fetchctx',
|
|
58
59
|
alias: 'f',
|
|
59
60
|
type: Boolean,
|
|
60
61
|
default: false
|
|
61
|
-
},
|
|
62
|
+
}, // fetch and set k8s context
|
|
63
|
+
{
|
|
64
|
+
name: 'matchk8s',
|
|
65
|
+
alias: 'm',
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: false
|
|
68
|
+
}, // checks k8s context
|
|
69
|
+
{
|
|
62
70
|
name: 'verbose',
|
|
63
71
|
alias: 'v',
|
|
64
72
|
type: Boolean,
|
|
@@ -377,7 +385,12 @@ if (cfgs.CLOUD === 'aws') {
|
|
|
377
385
|
} // TODO - FETCH AWS CLUSTER CREDENTIALS
|
|
378
386
|
|
|
379
387
|
|
|
380
|
-
const matchedCtx = currentCtx === desiredCtx;
|
|
388
|
+
const matchedCtx = currentCtx === desiredCtx;
|
|
389
|
+
|
|
390
|
+
if (args.matchk8s) {
|
|
391
|
+
process.exit(matchedCtx ? 0 : 1);
|
|
392
|
+
} // just fetch the context and exit if -f is specified
|
|
393
|
+
|
|
381
394
|
|
|
382
395
|
if (args.fetchctx) {
|
|
383
396
|
if (!matchedCtx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -29,12 +29,7 @@
|
|
|
29
29
|
"getfbcfg": "src/getfbcfg.js",
|
|
30
30
|
"getjson": "src/getjson.js",
|
|
31
31
|
"git-tar": "src/git-tar",
|
|
32
|
-
"helm-repos-reload": "src/helm-repos-reload",
|
|
33
32
|
"helmdn": "src/helmdn",
|
|
34
|
-
"xhelmify": "lib/server/helmify/index.js",
|
|
35
|
-
"helminit-dp": "src/helminit-dp",
|
|
36
|
-
"helminit-scaler": "src/helminit-scaler",
|
|
37
|
-
"helminit-svc": "src/helminit-svc",
|
|
38
33
|
"helmup": "src/helmup",
|
|
39
34
|
"helmwhat": "src/helmup",
|
|
40
35
|
"k8scale": "src/k8scale",
|
|
@@ -54,7 +49,6 @@
|
|
|
54
49
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
55
50
|
"dependencies": {
|
|
56
51
|
"chalk": "^4.1.2",
|
|
57
|
-
"clear": "^0.1.0",
|
|
58
52
|
"clipboardy": "^2.3.0",
|
|
59
53
|
"command-line-args": "^5.2.1",
|
|
60
54
|
"command-line-usage": "^6.1.1",
|
|
@@ -63,7 +57,7 @@
|
|
|
63
57
|
"execa": "^5.1.1",
|
|
64
58
|
"figlet": "^1.5.2",
|
|
65
59
|
"glob": "^7.2.0",
|
|
66
|
-
"inquirer": "^8.2.
|
|
60
|
+
"inquirer": "^8.2.1",
|
|
67
61
|
"js-yaml": "^4.1.0",
|
|
68
62
|
"ncp": "^2.0.0",
|
|
69
63
|
"npm-registry-fetch": "^11.0.0",
|
|
@@ -76,10 +70,10 @@
|
|
|
76
70
|
},
|
|
77
71
|
"devDependencies": {
|
|
78
72
|
"@babel/cli": "^7.17.6",
|
|
79
|
-
"@babel/core": "^7.17.
|
|
73
|
+
"@babel/core": "^7.17.7",
|
|
80
74
|
"@babel/node": "^7.16.8",
|
|
81
75
|
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
82
76
|
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
83
|
-
"npm": "^8.5.
|
|
77
|
+
"npm": "^8.5.4"
|
|
84
78
|
}
|
|
85
79
|
}
|
package/src/circleate
CHANGED
|
@@ -10,6 +10,7 @@ if [ "$1" != "server" ] && [ "$1" != "ui" ] && [ "$1" != "lib" ]; then
|
|
|
10
10
|
fi
|
|
11
11
|
|
|
12
12
|
repo_type=$1
|
|
13
|
+
NODE_VERSION="gallium"
|
|
13
14
|
|
|
14
15
|
check_circle_config(){
|
|
15
16
|
if [ -d "./.circleci" ];
|
|
@@ -53,7 +54,7 @@ executors:
|
|
|
53
54
|
jobs:
|
|
54
55
|
install:
|
|
55
56
|
docker:
|
|
56
|
-
- image: circleci/node
|
|
57
|
+
- image: circleci/node:$NODE_VERSION
|
|
57
58
|
steps:
|
|
58
59
|
- checkout
|
|
59
60
|
- restore_cache:
|
|
@@ -79,7 +80,7 @@ jobs:
|
|
|
79
80
|
|
|
80
81
|
security-check:
|
|
81
82
|
docker:
|
|
82
|
-
- image: circleci/node
|
|
83
|
+
- image: circleci/node:$NODE_VERSION
|
|
83
84
|
steps:
|
|
84
85
|
- checkout
|
|
85
86
|
- attach_workspace:
|
|
@@ -90,7 +91,7 @@ jobs:
|
|
|
90
91
|
|
|
91
92
|
license-check:
|
|
92
93
|
docker:
|
|
93
|
-
- image: circleci/node
|
|
94
|
+
- image: circleci/node:$NODE_VERSION
|
|
94
95
|
steps:
|
|
95
96
|
- checkout
|
|
96
97
|
- attach_workspace:
|
|
@@ -105,7 +106,7 @@ jobs:
|
|
|
105
106
|
|
|
106
107
|
lint:
|
|
107
108
|
docker:
|
|
108
|
-
- image: circleci/node
|
|
109
|
+
- image: circleci/node:$NODE_VERSION
|
|
109
110
|
steps:
|
|
110
111
|
- checkout
|
|
111
112
|
- attach_workspace:
|
|
@@ -119,7 +120,7 @@ jobs:
|
|
|
119
120
|
|
|
120
121
|
docs:
|
|
121
122
|
docker:
|
|
122
|
-
- image: circleci/node
|
|
123
|
+
- image: circleci/node:$NODE_VERSION
|
|
123
124
|
steps:
|
|
124
125
|
- checkout
|
|
125
126
|
- attach_workspace:
|
|
@@ -136,7 +137,7 @@ jobs:
|
|
|
136
137
|
environment:
|
|
137
138
|
TZ: 'America/New_York'
|
|
138
139
|
docker:
|
|
139
|
-
- image: circleci/node
|
|
140
|
+
- image: circleci/node:$NODE_VERSION
|
|
140
141
|
# IF YOU NEED ANY OF THESE, UNCOMMENT TO USE
|
|
141
142
|
# - image: redis
|
|
142
143
|
# - image: circleci/mysql:5.7
|
|
@@ -181,7 +182,7 @@ jobs:
|
|
|
181
182
|
build:
|
|
182
183
|
# build should make dist image and prepare docker file
|
|
183
184
|
docker:
|
|
184
|
-
- image: circleci/node
|
|
185
|
+
- image: circleci/node:$NODE_VERSION
|
|
185
186
|
|
|
186
187
|
steps:
|
|
187
188
|
- checkout
|
|
@@ -263,7 +264,7 @@ version: 2.1
|
|
|
263
264
|
jobs:
|
|
264
265
|
install:
|
|
265
266
|
docker:
|
|
266
|
-
- image: circleci/node
|
|
267
|
+
- image: circleci/node:$NODE_VERSION
|
|
267
268
|
steps:
|
|
268
269
|
- checkout
|
|
269
270
|
- restore_cache:
|
|
@@ -289,7 +290,7 @@ jobs:
|
|
|
289
290
|
|
|
290
291
|
security-check:
|
|
291
292
|
docker:
|
|
292
|
-
- image: circleci/node
|
|
293
|
+
- image: circleci/node:$NODE_VERSION
|
|
293
294
|
steps:
|
|
294
295
|
- checkout
|
|
295
296
|
- attach_workspace:
|
|
@@ -300,7 +301,7 @@ jobs:
|
|
|
300
301
|
|
|
301
302
|
license-check:
|
|
302
303
|
docker:
|
|
303
|
-
- image: circleci/node
|
|
304
|
+
- image: circleci/node:$NODE_VERSION
|
|
304
305
|
steps:
|
|
305
306
|
- checkout
|
|
306
307
|
- attach_workspace:
|
|
@@ -315,7 +316,7 @@ jobs:
|
|
|
315
316
|
|
|
316
317
|
lint:
|
|
317
318
|
docker:
|
|
318
|
-
- image: circleci/node
|
|
319
|
+
- image: circleci/node:$NODE_VERSION
|
|
319
320
|
steps:
|
|
320
321
|
- checkout
|
|
321
322
|
- attach_workspace:
|
|
@@ -329,7 +330,7 @@ jobs:
|
|
|
329
330
|
|
|
330
331
|
docs:
|
|
331
332
|
docker:
|
|
332
|
-
- image: circleci/node
|
|
333
|
+
- image: circleci/node:$NODE_VERSION
|
|
333
334
|
steps:
|
|
334
335
|
- checkout
|
|
335
336
|
- attach_workspace:
|
|
@@ -346,7 +347,7 @@ jobs:
|
|
|
346
347
|
environment:
|
|
347
348
|
TZ: 'America/New_York'
|
|
348
349
|
docker:
|
|
349
|
-
- image: circleci/node
|
|
350
|
+
- image: circleci/node:$NODE_VERSION
|
|
350
351
|
# IF YOU NEED ANY OF THESE, UNCOMMENT TO USE
|
|
351
352
|
# - image: redis
|
|
352
353
|
# - image: circleci/mysql:5.7
|
|
@@ -476,7 +477,7 @@ jobs:
|
|
|
476
477
|
|
|
477
478
|
build:
|
|
478
479
|
docker:
|
|
479
|
-
- image: circleci/node
|
|
480
|
+
- image: circleci/node:$NODE_VERSION
|
|
480
481
|
steps:
|
|
481
482
|
- checkout
|
|
482
483
|
- restore_cache:
|
|
@@ -510,7 +511,7 @@ jobs:
|
|
|
510
511
|
|
|
511
512
|
deploy-dev:
|
|
512
513
|
docker:
|
|
513
|
-
- image: circleci/node
|
|
514
|
+
- image: circleci/node:$NODE_VERSION
|
|
514
515
|
steps:
|
|
515
516
|
- attach_workspace:
|
|
516
517
|
at: ~/project
|
|
@@ -521,7 +522,7 @@ jobs:
|
|
|
521
522
|
|
|
522
523
|
deploy-prod:
|
|
523
524
|
docker:
|
|
524
|
-
- image: circleci/node
|
|
525
|
+
- image: circleci/node:$NODE_VERSION
|
|
525
526
|
steps:
|
|
526
527
|
- attach_workspace:
|
|
527
528
|
at: ~/project
|
package/src/helmup
CHANGED
|
@@ -518,6 +518,7 @@ function getServiceAndChartVersion() {
|
|
|
518
518
|
|
|
519
519
|
SERVICE=
|
|
520
520
|
CHARTVER=
|
|
521
|
+
FROM_VERSIONS=
|
|
521
522
|
# Allows chart version from command line via <deployment>/<x.y.z>
|
|
522
523
|
IFS="/" read SERVICE CHARTVER <<< "$1"
|
|
523
524
|
|
|
@@ -547,12 +548,23 @@ DEPRECATED_CHART
|
|
|
547
548
|
if [ -f "$VERSIONS" ];
|
|
548
549
|
then
|
|
549
550
|
CHARTVER=`node -e "charts=require('$VERSIONS');console.log( charts['$SERVICE']?.chart || '' )"`
|
|
551
|
+
[ ! -z "${CHARTVER}" ] && FROM_VERSIONS=1
|
|
550
552
|
fi
|
|
551
553
|
}
|
|
552
554
|
|
|
555
|
+
doHelmup() {
|
|
556
|
+
local helmup="$1"
|
|
557
|
+
local doing="Helming => `color g \"$HELMUP\"`"
|
|
558
|
+
local from=
|
|
559
|
+
[ ! -z "$FROM_VERSIONS" ] && from="`color y \"<= from Versions.json\"`"
|
|
560
|
+
printf "$doing $from\n"
|
|
561
|
+
$HELMUP
|
|
562
|
+
}
|
|
563
|
+
|
|
553
564
|
# not a fan of global vars but bash forced me to - set by getServiceAndChartVersion
|
|
554
565
|
SERVICE=
|
|
555
566
|
CHARTVER=
|
|
567
|
+
FROM_VERSIONS=
|
|
556
568
|
function doInstall() {
|
|
557
569
|
|
|
558
570
|
helm repo remove stable &> /dev/null # stable was deprecated
|
|
@@ -645,7 +657,7 @@ function doInstall() {
|
|
|
645
657
|
transponder-*)
|
|
646
658
|
# transponders use the same chart but different deployment name
|
|
647
659
|
HELMUP="helm upgrade --install $SERVICE leverege/transponder --values $SERVICE/values.yaml $CHARTVER $WHAT"
|
|
648
|
-
|
|
660
|
+
doHelmup "$HELMUP"
|
|
649
661
|
;;
|
|
650
662
|
|
|
651
663
|
"traefik")
|
|
@@ -672,6 +684,8 @@ function doInstall() {
|
|
|
672
684
|
fi
|
|
673
685
|
|
|
674
686
|
printf "\n--------------------------------------------------------------\nCharting $SERVICE\n"
|
|
687
|
+
service-man --from-helmup --create-service $SERVICE
|
|
688
|
+
|
|
675
689
|
# By default the museum chart name will be the same as the service, but
|
|
676
690
|
# we have the flexibility to override the naming when the charts are
|
|
677
691
|
# reference by the downstream repositories via the .helmup-charmuseum file.
|
|
@@ -683,7 +697,7 @@ function doInstall() {
|
|
|
683
697
|
printf "\n$YELO_WARN Local chartmuseum name override from ${SERVICE} to ${MUSEUM}\n"
|
|
684
698
|
fi
|
|
685
699
|
HELMUP="helm upgrade --install $SERVICE leverege/$MUSEUM -f $SERVICE/values.yaml $CHARTVER $WHAT"
|
|
686
|
-
|
|
700
|
+
doHelmup $HELMUP
|
|
687
701
|
SAVERR=$?
|
|
688
702
|
if [ $SAVERR -ne 0 ];
|
|
689
703
|
then
|
package/src/overwhelm.js
CHANGED
|
@@ -20,8 +20,9 @@ const optionsDefinitions = [
|
|
|
20
20
|
{ name : 'key', alias : 'k', type : String },
|
|
21
21
|
{ name : 'export', alias : 'e', type : Boolean, default : false },
|
|
22
22
|
{ name : 'continue', alias : 'c', type : Boolean, default : false },
|
|
23
|
-
{ name : 'checkctx', alias : 't', type : Boolean, default : false },
|
|
24
|
-
{ name : 'fetchctx', alias : 'f', type : Boolean, default : false },
|
|
23
|
+
{ name : 'checkctx', alias : 't', type : Boolean, default : false }, // checks overwhelm context
|
|
24
|
+
{ name : 'fetchctx', alias : 'f', type : Boolean, default : false }, // fetch and set k8s context
|
|
25
|
+
{ name : 'matchk8s', alias : 'm', type : Boolean, default : false }, // checks k8s context
|
|
25
26
|
{ name : 'verbose', alias : 'v', type : Boolean, default : false },
|
|
26
27
|
/* eslint-enable no-multi-spaces */
|
|
27
28
|
]
|
|
@@ -331,6 +332,10 @@ if ( cfgs.CLOUD === 'aws' ) {
|
|
|
331
332
|
|
|
332
333
|
const matchedCtx = ( currentCtx === desiredCtx )
|
|
333
334
|
|
|
335
|
+
if ( args.matchk8s ) {
|
|
336
|
+
process.exit( matchedCtx ? 0 : 1 )
|
|
337
|
+
}
|
|
338
|
+
|
|
334
339
|
// just fetch the context and exit if -f is specified
|
|
335
340
|
if ( args.fetchctx ) {
|
|
336
341
|
if ( !matchedCtx ) {
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
const inquirer = require('inquirer');
|
|
8
|
-
|
|
9
|
-
module.exports = {
|
|
10
|
-
getCurrentDirectoryBase: () => {
|
|
11
|
-
return path.basename(process.cwd());
|
|
12
|
-
},
|
|
13
|
-
directoryExists: filePath => {
|
|
14
|
-
return fs.existsSync(filePath);
|
|
15
|
-
},
|
|
16
|
-
overwriteDirectory: dirName => {
|
|
17
|
-
const question = [{
|
|
18
|
-
name: 'overwriteDirectory',
|
|
19
|
-
type: 'confirm',
|
|
20
|
-
message: `Overwrite existing ${dirName} directory?`
|
|
21
|
-
}];
|
|
22
|
-
return inquirer.prompt(question);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
const fsp = fs.promises;
|
|
6
|
-
|
|
7
|
-
const path = require('path');
|
|
8
|
-
|
|
9
|
-
const inquirer = require('inquirer');
|
|
10
|
-
|
|
11
|
-
const chalk = require('chalk');
|
|
12
|
-
|
|
13
|
-
const execa = require('execa');
|
|
14
|
-
|
|
15
|
-
const yaml = require('js-yaml');
|
|
16
|
-
|
|
17
|
-
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
18
|
-
|
|
19
|
-
const packageJson = require(`${packageJsonPath}`);
|
|
20
|
-
|
|
21
|
-
function sanitizePackageName(name) {
|
|
22
|
-
let validName = name; // Remove npm lib name (e.g. @leverege)
|
|
23
|
-
|
|
24
|
-
const isNpm = name.startsWith('@');
|
|
25
|
-
|
|
26
|
-
if (isNpm) {
|
|
27
|
-
const splitStr = name.split('/');
|
|
28
|
-
validName = splitStr[1]; // returns name after npm domain
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return validName;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function transformGoFormat(input) {
|
|
35
|
-
return input.replace(/-/g, '_');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function createValuesYAML(name, version, redisAccess, securityContext, preemptible, protocol, scaler, cloud) {
|
|
39
|
-
const openPort = protocol !== 'none';
|
|
40
|
-
const portFromEnv = process.env.PORT || process.env.SERVER_PORT;
|
|
41
|
-
const portNumber = parseInt(portFromEnv) || 8080;
|
|
42
|
-
let values = {
|
|
43
|
-
[name]: {
|
|
44
|
-
"VERSION": `v${version}`,
|
|
45
|
-
"PREEMPTIBLE": preemptible,
|
|
46
|
-
...(openPort && {
|
|
47
|
-
port: portNumber
|
|
48
|
-
})
|
|
49
|
-
},
|
|
50
|
-
"probes": {
|
|
51
|
-
"enabled": "false"
|
|
52
|
-
},
|
|
53
|
-
"redisClient": {
|
|
54
|
-
"label": redisAccess
|
|
55
|
-
},
|
|
56
|
-
"securityContext": {
|
|
57
|
-
"readOnlyRootFs": !securityContext
|
|
58
|
-
},
|
|
59
|
-
"cloud": {
|
|
60
|
-
"provider": cloud,
|
|
61
|
-
"project": "",
|
|
62
|
-
"region": "",
|
|
63
|
-
"sqlInstance": ""
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const scalerValues = {
|
|
67
|
-
"horizontalScaler": {
|
|
68
|
-
"minReplicas": 1,
|
|
69
|
-
"maxReplicas": 3,
|
|
70
|
-
"maxCPU": 75
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
if (scaler) {
|
|
75
|
-
values = Object.assign(values, scalerValues);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
try {
|
|
79
|
-
await fsp.writeFile('helm/values.yaml', yaml.dump(values), 'utf8');
|
|
80
|
-
} catch (err) {
|
|
81
|
-
console.error('Failed to create values.yaml file', chalk.red.bold('ERROR'));
|
|
82
|
-
process.exit(1);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
async function createChartYAML(chart) {
|
|
87
|
-
try {
|
|
88
|
-
await fsp.writeFile('helm/Chart.yaml', yaml.dump(chart), 'utf8');
|
|
89
|
-
} catch (err) {
|
|
90
|
-
console.error(`${chalk.red.bold('ERROR')} Failed to create Chart.yaml file\n`, err);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
async function createServiceYAML(name, serviceType, protocol) {
|
|
96
|
-
try {
|
|
97
|
-
await execa('helminit-svc', [name, serviceType, protocol]);
|
|
98
|
-
} catch (err) {
|
|
99
|
-
console.error('Failed to create service.yaml file', chalk.red.bold('ERROR'));
|
|
100
|
-
process.exit(1);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
async function createDeploymentYAML(name, enableFirebase, enableBigQuery, protocol) {
|
|
105
|
-
try {
|
|
106
|
-
await execa('helminit-dp', [name, enableFirebase, enableBigQuery, protocol]);
|
|
107
|
-
} catch (err) {
|
|
108
|
-
console.error('Failed to create deployment.yaml file', chalk.red.bold('ERROR'));
|
|
109
|
-
process.exit(1);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
async function createScalerYAML(name) {
|
|
114
|
-
try {
|
|
115
|
-
await execa('helminit-scaler', [name]);
|
|
116
|
-
} catch (err) {
|
|
117
|
-
console.error('Failed to create scaler.yaml file', chalk.red.bold('ERROR'));
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
async function createTemplates() {
|
|
123
|
-
const helmQuestions = [{
|
|
124
|
-
name: 'redisAccess',
|
|
125
|
-
type: 'confirm',
|
|
126
|
-
message: 'Does this chart need access to Redis (e.g. cache, limit, lock options)?'
|
|
127
|
-
}, {
|
|
128
|
-
name: 'preemptible',
|
|
129
|
-
type: 'confirm',
|
|
130
|
-
message: 'Is this server stateless and can survive occasional unavailability?'
|
|
131
|
-
}, {
|
|
132
|
-
name: 'securityContext',
|
|
133
|
-
type: 'confirm',
|
|
134
|
-
message: 'Does this server need special write access to filesystem?',
|
|
135
|
-
default: false
|
|
136
|
-
}, {
|
|
137
|
-
name: 'protocol',
|
|
138
|
-
type: 'rawlist',
|
|
139
|
-
message: 'Does this server require a TCP or UDP port open for communication?',
|
|
140
|
-
choices: ['none', 'UDP', 'TCP'],
|
|
141
|
-
default: ['none']
|
|
142
|
-
}, {
|
|
143
|
-
name: 'scaler',
|
|
144
|
-
type: 'confirm',
|
|
145
|
-
message: 'Does this server need horizontal scaling?'
|
|
146
|
-
}, {
|
|
147
|
-
name: 'cloud',
|
|
148
|
-
type: 'rawlist',
|
|
149
|
-
message: 'By default, which cloud platform will this server be deployed on?',
|
|
150
|
-
choices: ['gcp', 'aws'],
|
|
151
|
-
default: ['gcp']
|
|
152
|
-
}, {
|
|
153
|
-
name: 'cloudServices',
|
|
154
|
-
type: 'checkbox',
|
|
155
|
-
message: 'Which these cloud services does this server need? (space to choose, enter to submit)',
|
|
156
|
-
choices: ['firebase', 'bigquery']
|
|
157
|
-
}];
|
|
158
|
-
const helmOptions = await inquirer.prompt(helmQuestions);
|
|
159
|
-
return helmOptions;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
module.exports = {
|
|
163
|
-
bootstrap: async () => {
|
|
164
|
-
let name = sanitizePackageName(packageJson.name);
|
|
165
|
-
const appVersion = packageJson.version;
|
|
166
|
-
const keepNameQuestion = [{
|
|
167
|
-
name: 'keepPackageName',
|
|
168
|
-
type: 'confirm',
|
|
169
|
-
message: `Helm chart name will default to ${name}. Do you want to keep the default setting?`
|
|
170
|
-
}];
|
|
171
|
-
const keepName = await inquirer.prompt(keepNameQuestion);
|
|
172
|
-
|
|
173
|
-
if (!keepName.keepPackageName) {
|
|
174
|
-
const keepNameQuestion = [{
|
|
175
|
-
name: 'renamePackage',
|
|
176
|
-
type: 'input',
|
|
177
|
-
message: 'Please enter a new name for the Helm chart',
|
|
178
|
-
validate: str => {
|
|
179
|
-
const helmRegex = RegExp('^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])+$');
|
|
180
|
-
|
|
181
|
-
if (helmRegex.test(str)) {
|
|
182
|
-
return true;
|
|
183
|
-
} else {
|
|
184
|
-
return 'Special characters are not allowed. Please enter a valid name.';
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}];
|
|
188
|
-
const newName = await inquirer.prompt(keepNameQuestion);
|
|
189
|
-
name = newName.renamePackage;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
console.log(chalk.green(`\nBootstrapping a new Helm chart for ${name}...\n`));
|
|
193
|
-
const chart = {
|
|
194
|
-
name,
|
|
195
|
-
version: '1.0.0',
|
|
196
|
-
appVersion,
|
|
197
|
-
apiVersion: 'v2'
|
|
198
|
-
};
|
|
199
|
-
const chartSafeName = transformGoFormat(name);
|
|
200
|
-
|
|
201
|
-
try {
|
|
202
|
-
await execa('mkdir', ['helm']);
|
|
203
|
-
await execa('mkdir', ['helm/templates']);
|
|
204
|
-
} catch (err) {
|
|
205
|
-
console.error('Failed to create directories', chalk.red.bold('ERROR'));
|
|
206
|
-
process.exit(1);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
await createChartYAML(chart);
|
|
210
|
-
const templateOpts = await createTemplates();
|
|
211
|
-
const {
|
|
212
|
-
protocol,
|
|
213
|
-
scaler,
|
|
214
|
-
cloudServices,
|
|
215
|
-
redisAccess,
|
|
216
|
-
securityContext,
|
|
217
|
-
preemptible,
|
|
218
|
-
cloud
|
|
219
|
-
} = templateOpts; // Based on protocol, ask about serviceType
|
|
220
|
-
|
|
221
|
-
if (protocol !== 'none') {
|
|
222
|
-
const servicesQ = [{
|
|
223
|
-
name: 'service',
|
|
224
|
-
type: 'rawlist',
|
|
225
|
-
message: 'What kind of service does your server need (choose ClusterIP unless you need special access)?',
|
|
226
|
-
choices: ['ClusterIP', 'NodePort', 'LoadBalancer'],
|
|
227
|
-
default: ['ClusterIP']
|
|
228
|
-
}];
|
|
229
|
-
const ans = await inquirer.prompt(servicesQ);
|
|
230
|
-
const serviceType = ans.service;
|
|
231
|
-
await createServiceYAML(chartSafeName, serviceType, protocol);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
if (scaler) {
|
|
235
|
-
await createScalerYAML(chartSafeName);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const enableFirebase = cloudServices.includes('firebase');
|
|
239
|
-
const enableBigQuery = cloudServices.includes('bigquery');
|
|
240
|
-
const tcpOrUdp = protocol == 'none' ? 'TCP' : protocol;
|
|
241
|
-
await createDeploymentYAML(name, enableFirebase, enableBigQuery, tcpOrUdp);
|
|
242
|
-
await createValuesYAML(chartSafeName, appVersion, redisAccess, securityContext, preemptible, protocol, scaler, cloud);
|
|
243
|
-
console.log(chalk.green.bold(`\n\n Helm chart for ${name} is now ready \n`));
|
|
244
|
-
console.log(chalk.yellow.bold('Add any additional env vars to value.yaml and deployment.yaml prior to deployment'));
|
|
245
|
-
}
|
|
246
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
|
|
4
|
-
require('dotenv').config(); // attempt to autodetect envs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const chalk = require('chalk');
|
|
8
|
-
|
|
9
|
-
const clear = require('clear');
|
|
10
|
-
|
|
11
|
-
const figlet = require('figlet');
|
|
12
|
-
|
|
13
|
-
const execa = require('execa');
|
|
14
|
-
|
|
15
|
-
const files = require('./files');
|
|
16
|
-
|
|
17
|
-
const helm = require('./helm');
|
|
18
|
-
|
|
19
|
-
clear();
|
|
20
|
-
console.log(chalk.yellow(figlet.textSync('Helmify', {
|
|
21
|
-
horizontalLayout: 'full'
|
|
22
|
-
})));
|
|
23
|
-
|
|
24
|
-
const run = async () => {
|
|
25
|
-
if (files.directoryExists('helm')) {
|
|
26
|
-
console.log(chalk.red.bold('\nDetected existing Helm configs\n'));
|
|
27
|
-
const overwrite = await files.overwriteDirectory('Helm');
|
|
28
|
-
|
|
29
|
-
if (!overwrite.overwriteDirectory) {
|
|
30
|
-
console.log(chalk.green('\nNo changes made - exiting... \n'));
|
|
31
|
-
process.exit();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
console.log(chalk.yellow.bold('\nDeleting existing Helm directory...\n'));
|
|
35
|
-
const deleteHelmDir = await execa('rm', ['-rf', 'helm']);
|
|
36
|
-
|
|
37
|
-
if (deleteHelmDir.failed) {
|
|
38
|
-
console.log(chalk.red.bold('\nFailed to delete existing Helm directory\n'));
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
helm.bootstrap();
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
run();
|
package/src/helm-repos-reload
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
function reloadRepo()
|
|
4
|
-
{
|
|
5
|
-
local NAME=$1
|
|
6
|
-
local URL=$2
|
|
7
|
-
|
|
8
|
-
printf "Reloading => %-10s %s\n" $NAME $URL
|
|
9
|
-
helm repo remove $NAME &> /dev/null
|
|
10
|
-
helm repo add $NAME $URL &> /dev/null
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
reloadRepo leverege https://chartmuseum.leverege.com
|
|
14
|
-
reloadRepo elastic https://helm.elastic.co
|
|
15
|
-
reloadRepo bitnami https://charts.bitnami.com/bitnami
|
|
16
|
-
reloadRepo traefik https://containous.github.io/traefik-helm-chart
|
|
17
|
-
reloadRepo vmware-tanzu https://vmware-tanzu.github.io/helm-charts
|
|
18
|
-
|
|
19
|
-
printf "\n"
|
|
20
|
-
helm repo ls
|
|
21
|
-
printf "\n"
|
package/src/helminit-dp
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
dockerName=$1
|
|
4
|
-
chartName=${dockerName//-/_}
|
|
5
|
-
|
|
6
|
-
enableFirebase=$2
|
|
7
|
-
enableBigQuery=$3
|
|
8
|
-
protocol=$4
|
|
9
|
-
|
|
10
|
-
if [ "$enableFirebase" = true ] ; then
|
|
11
|
-
firebaseVolume="
|
|
12
|
-
- name: rt-firebase-key
|
|
13
|
-
secret:
|
|
14
|
-
secretName: rt-data
|
|
15
|
-
- name: model-firebase-key
|
|
16
|
-
secret:
|
|
17
|
-
secretName: model-data
|
|
18
|
-
- name: model-firebase-config
|
|
19
|
-
secret:
|
|
20
|
-
secretName: model-data-config
|
|
21
|
-
- name: rt-firebase-config
|
|
22
|
-
secret:
|
|
23
|
-
secretName: rt-data-config"
|
|
24
|
-
|
|
25
|
-
firebaseVolumeMount='
|
|
26
|
-
- name: model-firebase-key
|
|
27
|
-
mountPath: "/home/node/.gcp/model-data"
|
|
28
|
-
- name: rt-firebase-key
|
|
29
|
-
mountPath: "/home/node/.gcp/rt-data"
|
|
30
|
-
- name: model-firebase-config
|
|
31
|
-
mountPath: "/home/node/.gcp/model-data-config"
|
|
32
|
-
- name: rt-firebase-config
|
|
33
|
-
mountPath: "/home/node/.gcp/rt-data-config"'
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
if [ "$enableBigQuery" = true ] ; then
|
|
37
|
-
bigQueryVolume="
|
|
38
|
-
- name: big-query
|
|
39
|
-
secret:
|
|
40
|
-
secretName: big-query"
|
|
41
|
-
|
|
42
|
-
bigQueryVolumeMount='
|
|
43
|
-
- name: big-query
|
|
44
|
-
mountPath: "/home/node/.gcp/bigquery"'
|
|
45
|
-
fi
|
|
46
|
-
|
|
47
|
-
touch helm/templates/deployment.yaml
|
|
48
|
-
|
|
49
|
-
cat<<EODEPLOYMENT > helm/templates/deployment.yaml
|
|
50
|
-
{{- if .Values.cloud.provider -}}
|
|
51
|
-
{{- \$provider := .Values.cloud.provider -}}
|
|
52
|
-
apiVersion: apps/v1
|
|
53
|
-
kind: Deployment
|
|
54
|
-
metadata:
|
|
55
|
-
name: {{ .Chart.Name }}
|
|
56
|
-
labels:
|
|
57
|
-
app: {{ .Chart.Name }}
|
|
58
|
-
chart/version: {{ .Chart.Version }}
|
|
59
|
-
chart/appVersion: {{ .Chart.AppVersion }}
|
|
60
|
-
redis-client: {{ .Values.redisClient.label | quote }}
|
|
61
|
-
spec:
|
|
62
|
-
selector:
|
|
63
|
-
matchLabels:
|
|
64
|
-
app: {{ .Chart.Name }}
|
|
65
|
-
template:
|
|
66
|
-
metadata:
|
|
67
|
-
labels:
|
|
68
|
-
app: {{ .Chart.Name }}
|
|
69
|
-
chart/version: {{ .Chart.Version }}
|
|
70
|
-
chart/appVersion: {{ .Chart.AppVersion }}
|
|
71
|
-
redis-client: {{ .Values.redisClient.label | quote }}
|
|
72
|
-
annotations:
|
|
73
|
-
prometheus.io/port: '5111'
|
|
74
|
-
prometheus.io/scrape: 'true'
|
|
75
|
-
configmap.reloader.stakater.com/reload: "default-configs"
|
|
76
|
-
spec:
|
|
77
|
-
volumes: $firebaseVolume $bigQueryVolume
|
|
78
|
-
{{- if eq \$provider "gcp" }}
|
|
79
|
-
- name: pubsub-key
|
|
80
|
-
secret:
|
|
81
|
-
secretName: pubsub
|
|
82
|
-
{{- else if eq \$provider "aws" }}
|
|
83
|
-
- name: sns-sqs-key
|
|
84
|
-
secret:
|
|
85
|
-
secretName: sns-sqs
|
|
86
|
-
{{- end }}
|
|
87
|
-
- name: tmpfs
|
|
88
|
-
emptyDir: {}
|
|
89
|
-
{{- if .Values.$chartName.PREEMPTIBLE }}
|
|
90
|
-
tolerations:
|
|
91
|
-
- key: "preemptible"
|
|
92
|
-
operator: "Equal"
|
|
93
|
-
value: "true"
|
|
94
|
-
effect: "NoSchedule"
|
|
95
|
-
affinity:
|
|
96
|
-
nodeAffinity:
|
|
97
|
-
preferredDuringSchedulingIgnoredDuringExecution:
|
|
98
|
-
- preference:
|
|
99
|
-
matchExpressions:
|
|
100
|
-
- key: cloud.google.com/gke-preemptible
|
|
101
|
-
operator: Exists
|
|
102
|
-
weight: 100
|
|
103
|
-
{{- end }}
|
|
104
|
-
containers:
|
|
105
|
-
- name: {{ .Chart.Name }}
|
|
106
|
-
imagePullPolicy: Always
|
|
107
|
-
image: gcr.io/leverege-docker-images/$dockerName:{{ .Values.$chartName.VERSION }}
|
|
108
|
-
securityContext:
|
|
109
|
-
readOnlyRootFilesystem: {{ .Values.securityContext.readOnlyRootFs }}
|
|
110
|
-
runAsNonRoot: true
|
|
111
|
-
runAsUser: 1000
|
|
112
|
-
allowPrivilegeEscalation: false
|
|
113
|
-
{{- if .Values.probes }}{{ if .Values.probes.enabled }}
|
|
114
|
-
readinessProbe:
|
|
115
|
-
httpGet:
|
|
116
|
-
path: /healthz
|
|
117
|
-
port: api
|
|
118
|
-
initialDelaySeconds: 10
|
|
119
|
-
livenessProbe:
|
|
120
|
-
httpGet:
|
|
121
|
-
path: /livenessProbe
|
|
122
|
-
port: api
|
|
123
|
-
initialDelaySeconds: 15
|
|
124
|
-
periodSeconds: 60
|
|
125
|
-
{{- end }}{{ end }}
|
|
126
|
-
ports:
|
|
127
|
-
{{- if .Values.$chartName.port }}
|
|
128
|
-
- name: api
|
|
129
|
-
containerPort: {{ .Values.$chartName.port }}
|
|
130
|
-
protocol: $protocol
|
|
131
|
-
{{- end }}
|
|
132
|
-
- name: node-metrics
|
|
133
|
-
containerPort: 5111
|
|
134
|
-
resources:
|
|
135
|
-
requests:
|
|
136
|
-
cpu: "50m"
|
|
137
|
-
memory: "128Mi"
|
|
138
|
-
limits:
|
|
139
|
-
cpu: "100m"
|
|
140
|
-
memory: "256Mi"
|
|
141
|
-
volumeMounts: $firebaseVolumeMount $bigQueryVolumeMount
|
|
142
|
-
{{- if eq \$provider "gcp" }}
|
|
143
|
-
- name: pubsub-key
|
|
144
|
-
mountPath: "/home/node/.gcp/pubsub"
|
|
145
|
-
{{- else if eq \$provider "aws" }}
|
|
146
|
-
- name: sns-sqs-key
|
|
147
|
-
mountPath: "/home/node/.aws"
|
|
148
|
-
{{- end }}
|
|
149
|
-
- name: tmpfs
|
|
150
|
-
mountPath: "/tmp"
|
|
151
|
-
envFrom:
|
|
152
|
-
- configMapRef:
|
|
153
|
-
name: default-configs
|
|
154
|
-
env:
|
|
155
|
-
# UNCOMMENT THE FOLLOWING FOR ENV VARIABLES
|
|
156
|
-
# Assuming you have the following lines in values.yaml =>
|
|
157
|
-
#
|
|
158
|
-
# $chartName:
|
|
159
|
-
# MY_ENV_VARIABLE: hello-world
|
|
160
|
-
#
|
|
161
|
-
#
|
|
162
|
-
# - name: MY_ENV_VARIABLE
|
|
163
|
-
# value: {{ .Values.$chartName.MY_ENV_VARIABLE }}
|
|
164
|
-
#
|
|
165
|
-
#
|
|
166
|
-
# UNCOMMENT THE FOLLOWING FOR MOUNTING SECRETS
|
|
167
|
-
# Assuming you ran =>
|
|
168
|
-
# kubectl create secret generic my-secret --from-literal=my-password=password123
|
|
169
|
-
#
|
|
170
|
-
# - name: ENV_SECRET_NAME
|
|
171
|
-
# valueFrom:
|
|
172
|
-
# secretKeyRef:
|
|
173
|
-
# name: my-secret
|
|
174
|
-
# key: my-password
|
|
175
|
-
|
|
176
|
-
{{- end -}}
|
|
177
|
-
EODEPLOYMENT
|
package/src/helminit-scaler
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
chartName=$1
|
|
4
|
-
|
|
5
|
-
touch helm/templates/scaler.yaml
|
|
6
|
-
|
|
7
|
-
cat<<EOSCALER > helm/templates/scaler.yaml
|
|
8
|
-
apiVersion: autoscaling/v1
|
|
9
|
-
kind: HorizontalPodAutoscaler
|
|
10
|
-
metadata:
|
|
11
|
-
name: {{ .Chart.Name }}
|
|
12
|
-
spec:
|
|
13
|
-
scaleTargetRef:
|
|
14
|
-
apiVersion: apps/v1
|
|
15
|
-
kind: Deployment
|
|
16
|
-
name: {{ .Chart.Name }}
|
|
17
|
-
minReplicas: {{ .Values.horizontalScaler.minReplicas }}
|
|
18
|
-
maxReplicas: {{ .Values.horizontalScaler.maxReplicas }}
|
|
19
|
-
targetCPUUtilizationPercentage: {{ .Values.horizontalScaler.maxCPU }}
|
|
20
|
-
EOSCALER
|
package/src/helminit-svc
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
chartName=$1
|
|
4
|
-
serviceType=$2
|
|
5
|
-
protocol=$3
|
|
6
|
-
|
|
7
|
-
touch helm/templates/service.yaml
|
|
8
|
-
|
|
9
|
-
cat<<EOSERVICE > helm/templates/service.yaml
|
|
10
|
-
kind: Service
|
|
11
|
-
apiVersion: v1
|
|
12
|
-
metadata:
|
|
13
|
-
name: {{ .Chart.Name }}
|
|
14
|
-
spec:
|
|
15
|
-
type: $serviceType
|
|
16
|
-
selector:
|
|
17
|
-
app: {{ .Chart.Name }}
|
|
18
|
-
ports:
|
|
19
|
-
- protocol: $protocol
|
|
20
|
-
port: {{ .Values.$chartName.port }}
|
|
21
|
-
targetPort: api
|
|
22
|
-
EOSERVICE
|
package/src/iam-roles
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const chalk = require( 'chalk' )
|
|
4
|
-
const execa = require( 'execa' )
|
|
5
|
-
|
|
6
|
-
const condir = ( log, thing, depth = 8 ) => {
|
|
7
|
-
console.dir( { log, thing }, { depth, colors : true } ) // eslint-disable-line
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const PLATFORM=[
|
|
11
|
-
"authz-server",
|
|
12
|
-
"api-server",
|
|
13
|
-
"db-curator",
|
|
14
|
-
"emailer",
|
|
15
|
-
"geotile-server",
|
|
16
|
-
"imagine",
|
|
17
|
-
"message-processor",
|
|
18
|
-
"messenger",
|
|
19
|
-
"reason",
|
|
20
|
-
"resource-server",
|
|
21
|
-
"scheduler",
|
|
22
|
-
"transponder-bq",
|
|
23
|
-
"transponder-rt",
|
|
24
|
-
"transponder-postgres",
|
|
25
|
-
]
|
|
26
|
-
|
|
27
|
-
// gcloud projects get-iam-policy ${PROJECT} \
|
|
28
|
-
// --flatten="bindings[].members" \
|
|
29
|
-
// --filter="bindings.members:${SVCACCT}@prd-recovr-auto.iam.gserviceaccount.com" \
|
|
30
|
-
// --format="table(bindings.role)"
|
|
31
|
-
|
|
32
|
-
const gcloudProject = 'prd-recovr-auto'
|
|
33
|
-
const gcloudFetchIam = [ 'projects', 'get-iam-policy', gcloudProject, '--format=json' ]
|
|
34
|
-
|
|
35
|
-
const runner = async ( x, y ) => {
|
|
36
|
-
const patternSvcAcct = new RegExp( /(?<type>serviceAccount):(?<sa>\S+)@(?<project>\S+).iam.gserviceaccount.com/ )
|
|
37
|
-
const patternUser = new RegExp( /(?<type>user):(?<email>\S+)/ )
|
|
38
|
-
try {
|
|
39
|
-
const { stdout } = await execa( 'gcloud', gcloudFetchIam )
|
|
40
|
-
const bindings = JSON.parse( stdout ).bindings
|
|
41
|
-
// condir( 'All Bindings', bindings )// XXX
|
|
42
|
-
const iamRoles = {}
|
|
43
|
-
bindings.forEach( binding => {
|
|
44
|
-
const role = binding.role.replace( 'roles/', '' )
|
|
45
|
-
for( let i = 0; i < binding.members.length; i++ ) {
|
|
46
|
-
const member = binding.members[i]
|
|
47
|
-
const svcacct = member.match( patternSvcAcct )
|
|
48
|
-
if ( svcacct?.groups ) {
|
|
49
|
-
const { type, sa } = svcacct.groups
|
|
50
|
-
iamRoles[ sa ] = iamRoles[ sa ] || []
|
|
51
|
-
iamRoles[ sa ].push( role )
|
|
52
|
-
continue
|
|
53
|
-
}
|
|
54
|
-
const user = member.match( patternUser )
|
|
55
|
-
if ( user?.groups ) {
|
|
56
|
-
const { type, email } = user.groups
|
|
57
|
-
iamRoles[ email ] = iamRoles[ email ] || []
|
|
58
|
-
iamRoles[ email ].push( role )
|
|
59
|
-
continue
|
|
60
|
-
}
|
|
61
|
-
console.log( `Dont Care? [${member}]` )
|
|
62
|
-
}
|
|
63
|
-
} )
|
|
64
|
-
console.log( iamRoles )
|
|
65
|
-
} catch ( err ) {
|
|
66
|
-
console.log( err, 'what went wrong?' )
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
runner()
|
package/src/install-traefik
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
#
|
|
3
|
-
cat<<TRAEFIK_CERT
|
|
4
|
-
|
|
5
|
-
*** This is currently informational only ***
|
|
6
|
-
|
|
7
|
-
overwhelm
|
|
8
|
-
helm repo add traefik https://containous.github.io/traefik-helm-chart
|
|
9
|
-
helm repo add jetstack https://charts.jetstack.io
|
|
10
|
-
helm repo update
|
|
11
|
-
|
|
12
|
-
kubectl create namespace cert-manager
|
|
13
|
-
kubectl create secret generic cloudflare --namespace cert-manager \
|
|
14
|
-
--from-literal=dns-token="CLOUD FLARE API TOKEN KEEWEB"
|
|
15
|
-
|
|
16
|
-
kubectl create namespace traefik
|
|
17
|
-
kubectl create secret generic cloudflare --namespace traefik \
|
|
18
|
-
--from-literal=dns-token="CLOUD FLARE API TOKEN KEEWEB"
|
|
19
|
-
|
|
20
|
-
helm install --namespace traefik traefik traefik/traefik -f traefik/traefik-values.yaml
|
|
21
|
-
|
|
22
|
-
helm install \
|
|
23
|
-
cert-manager jetstack/cert-manager \
|
|
24
|
-
--namespace cert-manager \
|
|
25
|
-
--version v1.1.0 \
|
|
26
|
-
--set installCRDs=true
|
|
27
|
-
|
|
28
|
-
# cloudflare->User Profile->API Tokens or get key out of keeweb
|
|
29
|
-
# API Token Permissions
|
|
30
|
-
# Zone - DNS - Edit
|
|
31
|
-
# Zone - Zone - Read
|
|
32
|
-
# Zone Resources:
|
|
33
|
-
# Include - All Zones
|
|
34
|
-
# this token is a cox2m token
|
|
35
|
-
kubectl apply --namespace cert-manager -f cert-manager
|
|
36
|
-
|
|
37
|
-
# to describe the cert
|
|
38
|
-
kubectl describe certificate --namespace cert-manager
|
|
39
|
-
|
|
40
|
-
# to delete the issuer
|
|
41
|
-
kubectl -n cert-manager delete clusterissuer <issuer name?>
|
|
42
|
-
TRAEFIK_CERT
|