@leverege/build-tools 2.6.7 → 2.6.8
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/repo-init/config.tgz +0 -0
- package/package.json +2 -2
- package/src/helmup +36 -2
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.8",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
"@babel/node": "^7.15.4",
|
|
80
80
|
"@leverege/babel-preset-leverege-node": "^2.0.0",
|
|
81
81
|
"@leverege/eslint-config-leverege": "^3.0.1",
|
|
82
|
-
"npm": "^7.
|
|
82
|
+
"npm": "^7.23.0"
|
|
83
83
|
}
|
|
84
84
|
}
|
package/src/helmup
CHANGED
|
@@ -237,12 +237,46 @@ function getManagedSecret() {
|
|
|
237
237
|
echo $SECRET
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
+
function getProjectIdFromK8sContext() {
|
|
241
|
+
local currContext=`kubectl config current-context`
|
|
242
|
+
|
|
243
|
+
IFS='_'
|
|
244
|
+
read -ra ADDR <<< "$currContext"
|
|
245
|
+
|
|
246
|
+
echo ${ADDR[1]} # project id is the second string split by _
|
|
247
|
+
}
|
|
248
|
+
|
|
240
249
|
# https://github.com/estafette/estafette-gke-preemptible-killer
|
|
241
250
|
function installPreemptibleKiller() {
|
|
251
|
+
PROJECT_ID="$(getProjectIdFromK8sContext)"
|
|
252
|
+
createNamespaceIfNeeded estafette
|
|
242
253
|
helm repo add estafette https://helm.estafette.io &>/dev/null
|
|
243
|
-
helm upgrade --install estafette-gke-preemptible-killer \
|
|
244
|
-
estafette/estafette-gke-preemptible-killer --namespace estafette
|
|
245
254
|
|
|
255
|
+
gcloud iam service-accounts create preemptible-killer \
|
|
256
|
+
--project=$PROJECT_ID \
|
|
257
|
+
--display-name preemptible-killer
|
|
258
|
+
|
|
259
|
+
gcloud iam roles create preemptible_killer \
|
|
260
|
+
--project $PROJECT_ID \
|
|
261
|
+
--title preemptible-killer \
|
|
262
|
+
--description "Delete compute instances" \
|
|
263
|
+
--permissions compute.instances.delete
|
|
264
|
+
|
|
265
|
+
local service_account_email=$(gcloud iam --project=$PROJECT_ID service-accounts list --filter preemptible-killer --format 'value([email])')
|
|
266
|
+
gcloud projects add-iam-policy-binding $PROJECT_ID \
|
|
267
|
+
--member=serviceAccount:${service_account_email} \
|
|
268
|
+
--role=projects/${PROJECT_ID}/roles/preemptible_killer &>/dev/null
|
|
269
|
+
|
|
270
|
+
gcloud iam service-accounts keys create \
|
|
271
|
+
--project=$PROJECT_ID \
|
|
272
|
+
--iam-account $service_account_email \
|
|
273
|
+
google_service_account.json &>/dev/null
|
|
274
|
+
|
|
275
|
+
helm upgrade --install estafette-gke-preemptible-killer \
|
|
276
|
+
estafette/estafette-gke-preemptible-killer \
|
|
277
|
+
--namespace estafette \
|
|
278
|
+
--set extraEnv.BLACKLIST_HOURS="10:00-02:00"
|
|
279
|
+
# --set extraEnv.WHITELIST_HOURS="12:30-13:30"
|
|
246
280
|
}
|
|
247
281
|
|
|
248
282
|
function installTraefik() {
|