@leverege/build-tools 2.4.1 → 2.4.3

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.
@@ -35,24 +35,8 @@ function transformGoFormat(input) {
35
35
  return input.replace(/-/g, '_');
36
36
  }
37
37
 
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) {
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": "gcp",
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 (serviceType) {
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: 'service',
134
+ name: 'protocol',
150
135
  type: 'rawlist',
151
- message: 'Does this server need a TCP port open for internal or external access?',
152
- choices: ['none', 'internal', 'external'],
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: ['GCP', 'AWS'],
163
- default: ['GCP']
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
- service,
208
+ protocol,
224
209
  scaler,
225
210
  cloudServices,
226
211
  redisAccess,
227
212
  securityContext,
228
- preemptible
229
- } = templateOpts;
230
- const serviceType = mapServiceToType(service);
231
-
232
- if (serviceType) {
233
- await createServiceYAML(chartSafeName, serviceType);
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, serviceType);
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
  }
@@ -80,7 +80,7 @@ var Packleator = /*#__PURE__*/function () {
80
80
 
81
81
  var args = options.args;
82
82
  this.privatePackages = new Set();
83
- this.args = args ? _objectSpread(_objectSpread({}, args), {}, {
83
+ this.args = args ? _objectSpread({}, args, {
84
84
  output: args.output.substr(-1) === '/' ? args.output.substr(0, args.output.length) : args.output
85
85
  }) : {}; // args || {}
86
86
 
@@ -125,7 +125,7 @@ function _main() {
125
125
  break;
126
126
 
127
127
  case 4:
128
- packleator = new Packleator(_objectSpread(_objectSpread({}, defaultConfig), {}, {
128
+ packleator = new Packleator(_objectSpread({}, defaultConfig, {
129
129
  args: args
130
130
  }));
131
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.4.1",
3
+ "version": "2.4.3",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "scripts": {
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: TCP
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
 
package/src/husky-run DELETED
@@ -1,6 +0,0 @@
1
- #!/bin/bash
2
-
3
- printf "\n***** Running Husky Pre-Checks *****\n\n"
4
-
5
- sleep 3
6
- exit 1