@leverege/build-tools 2.0.14 → 2.1.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 +1 -1
- package/src/helmup +28 -8
- package/src/overwhelm +21 -33
package/package.json
CHANGED
package/src/helmup
CHANGED
|
@@ -79,23 +79,21 @@ function installMonitoringCharts(){
|
|
|
79
79
|
fi
|
|
80
80
|
|
|
81
81
|
## Install Prometheus
|
|
82
|
-
helm upgrade --install prometheus
|
|
82
|
+
helm upgrade --install prometheus stable/prometheus \
|
|
83
|
+
--namespace monitoring \
|
|
84
|
+
-f prometheus/values.yaml \
|
|
85
|
+
--version 11.0.0
|
|
83
86
|
|
|
84
87
|
## Installing ES exporter
|
|
85
88
|
helm upgrade --install elasticsearch-exporter stable/elasticsearch-exporter \
|
|
86
89
|
--namespace monitoring \
|
|
87
|
-
|
|
88
|
-
--set-string service.annotations."prometheus\.io/scrape"="true" \
|
|
89
|
-
--set es.uri="http://databases-elasticsearch.default.svc.cluster.local:9200" \
|
|
90
|
+
-f elasticsearch-exporter/values-es-exporter.yaml \
|
|
90
91
|
--version 3.0.0
|
|
91
92
|
|
|
92
93
|
## Install Grafana
|
|
93
94
|
helm upgrade --install grafana stable/grafana \
|
|
94
95
|
--namespace monitoring \
|
|
95
|
-
|
|
96
|
-
--set service.port="9000" \
|
|
97
|
-
--set persistence.enabled="true" \
|
|
98
|
-
--set persistence.storageClassName="ssd" \
|
|
96
|
+
-f grafana/values-grafana.yaml \
|
|
99
97
|
--version 5.0.3
|
|
100
98
|
|
|
101
99
|
## Print out instructions
|
|
@@ -251,6 +249,28 @@ EOK8S
|
|
|
251
249
|
exit 1
|
|
252
250
|
fi
|
|
253
251
|
|
|
252
|
+
OLD_MONITORING="${GITTOP}/values-monitoring.yaml"
|
|
253
|
+
if [ -f "$OLD_MONITORING" ];
|
|
254
|
+
then
|
|
255
|
+
cat<<OLDMON
|
|
256
|
+
|
|
257
|
+
$RED_ERROR Old monitoring setup detected
|
|
258
|
+
|
|
259
|
+
Monitoring now runs in the monitoring namespace, centrally managed via helmup.
|
|
260
|
+
|
|
261
|
+
To migrate to the new setup:
|
|
262
|
+
1) Delete values-monitoring.yaml
|
|
263
|
+
2) Grab prometheus/values-local.yaml from master branch (modify as needed for opsgenie config)
|
|
264
|
+
3) Grab stackdriver-exporter/values-local.yaml from master branch
|
|
265
|
+
4) Create grafana dir => add .nohelm and values-grafana.yaml
|
|
266
|
+
5) Create elasticsearch-exporter dir => add .nohelm and values-es-exporter.yaml
|
|
267
|
+
|
|
268
|
+
Now run helmup monitoring and follow directions.
|
|
269
|
+
|
|
270
|
+
OLDMON
|
|
271
|
+
exit 1
|
|
272
|
+
fi
|
|
273
|
+
|
|
254
274
|
npm run ahoy
|
|
255
275
|
[ $? -ne 0 ] && printf "\n\n***Aborting helmup...\n\n" && exit 1
|
|
256
276
|
|
package/src/overwhelm
CHANGED
|
@@ -200,26 +200,6 @@ const opt = {
|
|
|
200
200
|
|
|
201
201
|
const ahoy = glob.sync( '*/', opt )
|
|
202
202
|
|
|
203
|
-
// Keel supports a "never" policy which will cause it to skip over a release
|
|
204
|
-
// if it is properly set. Adding a .nokeel file to a release directoy will
|
|
205
|
-
// cause the creation of the file if it does not already exist.
|
|
206
|
-
const generateKeelNeverPolicy = ( fileName ) => {
|
|
207
|
-
if ( fs.existsSync( fileName ) ) return
|
|
208
|
-
const neverPolicy = `
|
|
209
|
-
keel:
|
|
210
|
-
# keel policy (all/major/minor/patch/force)
|
|
211
|
-
policy: "never"
|
|
212
|
-
# approvals
|
|
213
|
-
# approvals: 1
|
|
214
|
-
# approvalDeadline: 24
|
|
215
|
-
# # images to track and update
|
|
216
|
-
# images:
|
|
217
|
-
# - repository: never.IMAGE # [1]
|
|
218
|
-
# tag: never.VERSION # [2]
|
|
219
|
-
`
|
|
220
|
-
fs.writeFileSync( fileName, neverPolicy )
|
|
221
|
-
}
|
|
222
|
-
|
|
223
203
|
// Generate the values.yaml files in directories not marked with .nohelm.
|
|
224
204
|
ahoy.forEach( ( dir ) => {
|
|
225
205
|
if ( !fs.existsSync( `${dir}/.nohelm` ) ) {
|
|
@@ -230,10 +210,6 @@ ahoy.forEach( ( dir ) => {
|
|
|
230
210
|
// Add support for localized values for things like keel (or whatever)
|
|
231
211
|
const valuesLocal = `${dir}values-local.yaml`
|
|
232
212
|
|
|
233
|
-
if ( fs.existsSync( `${dir}.nokeel` ) ) {
|
|
234
|
-
generateKeelNeverPolicy( valuesLocal )
|
|
235
|
-
}
|
|
236
|
-
|
|
237
213
|
if ( fs.existsSync( valuesLocal ) ) {
|
|
238
214
|
console.log( ` Local values in ${valuesLocal}` )
|
|
239
215
|
valuesOut += `\n# AHOY => values-local.yaml\n\n`
|
|
@@ -246,10 +222,11 @@ ahoy.forEach( ( dir ) => {
|
|
|
246
222
|
}
|
|
247
223
|
} )
|
|
248
224
|
|
|
225
|
+
|
|
249
226
|
// Set the GCP context for safety!
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
227
|
+
let clusterName = over['CLUSTER_NAME']
|
|
228
|
+
let projectId = over['PROJECT_ID']
|
|
229
|
+
let zone = over['GCE_REGION'] + ( over['GCE_ZONE'] ? `-${over['GCE_ZONE']}` : '' )
|
|
253
230
|
|
|
254
231
|
if ( !clusterName ) {
|
|
255
232
|
console.log( chalk.yellow(
|
|
@@ -278,9 +255,20 @@ ahoy.forEach( ( dir ) => {
|
|
|
278
255
|
} catch (err) { }
|
|
279
256
|
|
|
280
257
|
const currentCtx = kubeout.toString().trim()
|
|
281
|
-
|
|
258
|
+
let desiredCtx = `gke_${projectId}_${zone}_${clusterName}`
|
|
259
|
+
let cmd = `gcloud container clusters get-credentials ${clusterName} --zone ${zone} --project ${projectId}`
|
|
260
|
+
|
|
261
|
+
// Check if we are using AWS
|
|
262
|
+
if(cfgs['CLOUD'] === 'aws'){
|
|
263
|
+
const awsAcctId = cfgs['AWS_ACCT_ID']
|
|
264
|
+
zone = over['AWS_REGION']
|
|
265
|
+
desiredCtx = `arn:aws:eks:${zone}:${awsAcctId}:cluster/${clusterName}`
|
|
266
|
+
cmd = `aws eks --region ${zone} update-kubeconfig --name ${clusterName}`
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// TODO - FETCH AWS CLUSTER CREDENTIALS
|
|
270
|
+
|
|
282
271
|
const matchedCtx = ( currentCtx === desiredCtx )
|
|
283
|
-
const cmd = `gcloud container clusters get-credentials ${clusterName} --zone ${zone} --project ${projectId}`
|
|
284
272
|
|
|
285
273
|
if ( matchedCtx ) {
|
|
286
274
|
console.log( `
|
|
@@ -293,21 +281,21 @@ ahoy.forEach( ( dir ) => {
|
|
|
293
281
|
else {
|
|
294
282
|
console.log( `
|
|
295
283
|
|
|
296
|
-
You are about to change your
|
|
284
|
+
You are about to change your Kubernetes context to:
|
|
297
285
|
CLUSTER_NAME => ${chalk.bold.green(clusterName)}
|
|
298
286
|
PROJECT_ID => ${chalk.bold.green(projectId)}
|
|
299
|
-
|
|
287
|
+
REGION => ${chalk.bold.green(zone)}
|
|
300
288
|
|
|
301
289
|
` )
|
|
302
290
|
}
|
|
303
291
|
const ans = ask.question( `Enter "${chalk.bold.green( 'yes' )}" if you wish to fetch the credentials => ` )
|
|
304
292
|
if ( ans !== 'yes' ) {
|
|
305
293
|
if ( matchedCtx ) {
|
|
306
|
-
console.log( chalk.bold.yellow( `\n\nSkipping a refetch of your
|
|
294
|
+
console.log( chalk.bold.yellow( `\n\nSkipping a refetch of your Kubernetes context and credentials\n\n` ) )
|
|
307
295
|
process.exit( 0 )
|
|
308
296
|
}
|
|
309
297
|
|
|
310
|
-
console.log( chalk.bold.red( `\n\nYour
|
|
298
|
+
console.log( chalk.bold.red( `\n\nYour Kubernetes context and credentials do NOT match - this could be bad!\n\n` ) )
|
|
311
299
|
process.exit( 1 )
|
|
312
300
|
}
|
|
313
301
|
|