@leverege/build-tools 2.2.10 → 2.2.11
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/helmify/helm.js +32 -5
- package/package.json +1 -1
- package/src/helminit-svc +1 -1
|
@@ -35,11 +35,27 @@ function transformGoFormat(input) {
|
|
|
35
35
|
return input.replace(/-/g, '_');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
function mapServiceToType(service) {
|
|
39
|
+
switch (service) {
|
|
40
|
+
case 'none':
|
|
41
|
+
return null;
|
|
42
|
+
|
|
43
|
+
case 'internal':
|
|
44
|
+
return 'ClusterIP';
|
|
45
|
+
|
|
46
|
+
case 'external':
|
|
47
|
+
return 'NodePort';
|
|
48
|
+
|
|
49
|
+
default:
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function createValuesYAML(name, version, redisAccess, securityContext, preemptible, serviceType) {
|
|
39
55
|
const openPort = service !== 'none';
|
|
40
56
|
const portFromEnv = process.env.PORT || process.env.SERVER_PORT;
|
|
41
57
|
const portNumber = parseInt(portFromEnv) || 8080;
|
|
42
|
-
|
|
58
|
+
let values = {
|
|
43
59
|
[name]: {
|
|
44
60
|
"VERSION": version,
|
|
45
61
|
"PREMPTIBLE": preemptible,
|
|
@@ -60,6 +76,17 @@ async function createValuesYAML(name, version, redisAccess, securityContext, pre
|
|
|
60
76
|
"sqlInstance": ""
|
|
61
77
|
}
|
|
62
78
|
};
|
|
79
|
+
const scalerValues = {
|
|
80
|
+
"horizontalScaler": {
|
|
81
|
+
"minReplicas": 1,
|
|
82
|
+
"maxReplicas": 3,
|
|
83
|
+
"maxCPU": 75
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
if (serviceType) {
|
|
88
|
+
values = Object.assign(values, scalerValues);
|
|
89
|
+
}
|
|
63
90
|
|
|
64
91
|
try {
|
|
65
92
|
await fsp.writeFile('helm/values.yaml', yaml.safeDump(values), 'utf8');
|
|
@@ -200,9 +227,9 @@ module.exports = {
|
|
|
200
227
|
securityContext,
|
|
201
228
|
preemptible
|
|
202
229
|
} = templateOpts;
|
|
230
|
+
const serviceType = mapServiceToType(service);
|
|
203
231
|
|
|
204
|
-
if (
|
|
205
|
-
const serviceType = service === 'internal' ? 'ClusterIP' : 'NodePort';
|
|
232
|
+
if (serviceType) {
|
|
206
233
|
await createServiceYAML(chartSafeName, serviceType);
|
|
207
234
|
}
|
|
208
235
|
|
|
@@ -213,7 +240,7 @@ module.exports = {
|
|
|
213
240
|
const enableFirebase = cloudServices.includes('firebase');
|
|
214
241
|
const enableBigQuery = cloudServices.includes('bigquery');
|
|
215
242
|
await createDeploymentYAML(name, enableFirebase, enableBigQuery);
|
|
216
|
-
await createValuesYAML(chartSafeName, appVersion, redisAccess, securityContext, preemptible,
|
|
243
|
+
await createValuesYAML(chartSafeName, appVersion, redisAccess, securityContext, preemptible, serviceType);
|
|
217
244
|
console.log(chalk.green.bold(`\n\n Helm chart for ${name} is now ready \n`));
|
|
218
245
|
console.log(chalk.yellow.bold('Add any additional env vars to value.yaml and deployment.yaml prior to deployment'));
|
|
219
246
|
}
|
package/package.json
CHANGED