@leverege/build-tools 2.4.2 → 2.4.4
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 +30 -36
- package/package.json +1 -1
- package/src/helminit-svc +2 -1
- package/src/helmup +1 -0
|
@@ -35,24 +35,8 @@ function transformGoFormat(input) {
|
|
|
35
35
|
return input.replace(/-/g, '_');
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function
|
|
39
|
-
|
|
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) {
|
|
55
|
-
const openPort = serviceType !== 'none';
|
|
38
|
+
async function createValuesYAML(name, version, redisAccess, securityContext, preemptible, protocol, scaler, cloud) {
|
|
39
|
+
const openPort = protocol !== 'none';
|
|
56
40
|
const portFromEnv = process.env.PORT || process.env.SERVER_PORT;
|
|
57
41
|
const portNumber = parseInt(portFromEnv) || 8080;
|
|
58
42
|
let values = {
|
|
@@ -70,7 +54,7 @@ async function createValuesYAML(name, version, redisAccess, securityContext, pre
|
|
|
70
54
|
"readOnlyRootFs": !securityContext
|
|
71
55
|
},
|
|
72
56
|
"cloud": {
|
|
73
|
-
"provider":
|
|
57
|
+
"provider": cloud,
|
|
74
58
|
"project": "",
|
|
75
59
|
"region": "",
|
|
76
60
|
"sqlInstance": ""
|
|
@@ -84,7 +68,7 @@ async function createValuesYAML(name, version, redisAccess, securityContext, pre
|
|
|
84
68
|
}
|
|
85
69
|
};
|
|
86
70
|
|
|
87
|
-
if (
|
|
71
|
+
if (scaler) {
|
|
88
72
|
values = Object.assign(values, scalerValues);
|
|
89
73
|
}
|
|
90
74
|
|
|
@@ -105,9 +89,9 @@ async function createChartYAML(chart) {
|
|
|
105
89
|
}
|
|
106
90
|
}
|
|
107
91
|
|
|
108
|
-
async function createServiceYAML(name, serviceType) {
|
|
92
|
+
async function createServiceYAML(name, serviceType, protocol) {
|
|
109
93
|
try {
|
|
110
|
-
await execa('helminit-svc', [name, serviceType]);
|
|
94
|
+
await execa('helminit-svc', [name, serviceType, protocol]);
|
|
111
95
|
} catch (err) {
|
|
112
96
|
console.error('Failed to create service.yaml file', chalk.red.bold('ERROR'));
|
|
113
97
|
process.exit(1);
|
|
@@ -144,12 +128,13 @@ async function createTemplates() {
|
|
|
144
128
|
}, {
|
|
145
129
|
name: 'securityContext',
|
|
146
130
|
type: 'confirm',
|
|
147
|
-
message: 'Does this server need special write access to filesystem?'
|
|
131
|
+
message: 'Does this server need special write access to filesystem?',
|
|
132
|
+
default: false
|
|
148
133
|
}, {
|
|
149
|
-
name: '
|
|
134
|
+
name: 'protocol',
|
|
150
135
|
type: 'rawlist',
|
|
151
|
-
message: 'Does this server
|
|
152
|
-
choices: ['none', '
|
|
136
|
+
message: 'Does this server require a TCP or UDP port open for communication?',
|
|
137
|
+
choices: ['none', 'UDP', 'TCP'],
|
|
153
138
|
default: ['none']
|
|
154
139
|
}, {
|
|
155
140
|
name: 'scaler',
|
|
@@ -159,8 +144,8 @@ async function createTemplates() {
|
|
|
159
144
|
name: 'cloud',
|
|
160
145
|
type: 'rawlist',
|
|
161
146
|
message: 'By default, which cloud platform will this server be deployed on?',
|
|
162
|
-
choices: ['
|
|
163
|
-
default: ['
|
|
147
|
+
choices: ['gcp', 'aws'],
|
|
148
|
+
default: ['gcp']
|
|
164
149
|
}, {
|
|
165
150
|
name: 'cloudServices',
|
|
166
151
|
type: 'checkbox',
|
|
@@ -220,17 +205,26 @@ module.exports = {
|
|
|
220
205
|
await createChartYAML(chart);
|
|
221
206
|
const templateOpts = await createTemplates();
|
|
222
207
|
const {
|
|
223
|
-
|
|
208
|
+
protocol,
|
|
224
209
|
scaler,
|
|
225
210
|
cloudServices,
|
|
226
211
|
redisAccess,
|
|
227
212
|
securityContext,
|
|
228
|
-
preemptible
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (
|
|
233
|
-
|
|
213
|
+
preemptible,
|
|
214
|
+
cloud
|
|
215
|
+
} = templateOpts; // Based on protocol, ask about serviceType
|
|
216
|
+
|
|
217
|
+
if (protocol !== 'none') {
|
|
218
|
+
const servicesQ = [{
|
|
219
|
+
name: 'service',
|
|
220
|
+
type: 'rawlist',
|
|
221
|
+
message: 'What kind of service does your server need (ClusterIP for internal, NodePort/LB for external)?',
|
|
222
|
+
choices: ['ClusterIP', 'NodePort', 'LoadBalancer'],
|
|
223
|
+
default: ['ClusterIP']
|
|
224
|
+
}];
|
|
225
|
+
const ans = await inquirer.prompt(servicesQ);
|
|
226
|
+
const serviceType = ans.service;
|
|
227
|
+
await createServiceYAML(chartSafeName, serviceType, protocol);
|
|
234
228
|
}
|
|
235
229
|
|
|
236
230
|
if (scaler) {
|
|
@@ -240,7 +234,7 @@ module.exports = {
|
|
|
240
234
|
const enableFirebase = cloudServices.includes('firebase');
|
|
241
235
|
const enableBigQuery = cloudServices.includes('bigquery');
|
|
242
236
|
await createDeploymentYAML(name, enableFirebase, enableBigQuery);
|
|
243
|
-
await createValuesYAML(chartSafeName, appVersion, redisAccess, securityContext, preemptible,
|
|
237
|
+
await createValuesYAML(chartSafeName, appVersion, redisAccess, securityContext, preemptible, protocol, scaler, cloud);
|
|
244
238
|
console.log(chalk.green.bold(`\n\n Helm chart for ${name} is now ready \n`));
|
|
245
239
|
console.log(chalk.yellow.bold('Add any additional env vars to value.yaml and deployment.yaml prior to deployment'));
|
|
246
240
|
}
|
package/package.json
CHANGED
package/src/helminit-svc
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
chartName=$1
|
|
4
4
|
serviceType=$2
|
|
5
|
+
protocol=$3
|
|
5
6
|
|
|
6
7
|
touch helm/templates/service.yaml
|
|
7
8
|
|
|
@@ -15,7 +16,7 @@ spec:
|
|
|
15
16
|
selector:
|
|
16
17
|
app: {{ .Chart.Name }}
|
|
17
18
|
ports:
|
|
18
|
-
- protocol:
|
|
19
|
+
- protocol: $protocol
|
|
19
20
|
port: {{ .Values.$chartName.port }}
|
|
20
21
|
targetPort: api
|
|
21
22
|
EOSERVICE
|
package/src/helmup
CHANGED
|
@@ -298,6 +298,7 @@ function installVelero() {
|
|
|
298
298
|
--set "initContainers[0].volumeMounts[0].name"="plugins" \
|
|
299
299
|
--set schedules.timescale.schedule="0 3 * * *" \
|
|
300
300
|
--set schedules.timescale.template.ttl="720h" \
|
|
301
|
+
--set schedules.timescale.template.labelSelector.matchLabels.release="timescale-db" \
|
|
301
302
|
--set schedules.timescale.template.labelSelector.matchLabels.app="postgresql" \
|
|
302
303
|
--set schedules.timescale.template.snapshotVolumes="true"
|
|
303
304
|
|