@leverege/build-tools 2.66.2 → 2.66.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/package.json +4 -4
- package/src/.swo +0 -0
- package/src/bash-funcs +10 -0
- package/src/helm-audit.mjs +116 -0
- package/src/helm-charts/api-server/values-local.yaml +5 -2
- package/src/helm-charts/authz-server/values-local.yaml +4 -1
- package/src/helm-charts/cnpg-db-tsdb-basic/cluster.yaml.ovh +1 -1
- package/src/helm-charts/db-curator/values-local.yaml +2 -2
- package/src/helm-charts/elasticsearch8/helmup.plugin +2 -1
- package/src/helm-charts/emailer/values-local.yaml +6 -3
- package/src/helm-charts/fota-server/values-local.yaml +1 -1
- package/src/helm-charts/geotile-server/values-local.yaml +6 -3
- package/src/helm-charts/imagine/values-local.yaml +3 -0
- package/src/helm-charts/message-processor/values-local.yaml +2 -2
- package/src/helm-charts/messenger/values-local.yaml +5 -2
- package/src/helm-charts/overdose/values-local.yaml +3 -0
- package/src/helm-charts/prom-operator/helmup.plugin +12 -5
- package/src/helm-charts/prom-operator/prometheus-adapter.yaml +18 -0
- package/src/helm-charts/prom-operator/prometheus-stack.yaml.ovh +51 -10
- package/src/helm-charts/prom-operator/rules/cadvisor-rules.yaml +21 -6
- package/src/helm-charts/prom-operator/rules/elasticsearch-rules.yaml +1 -1
- package/src/helm-charts/prom-operator/rules/kubestate-rules.yaml +5 -7
- package/src/helm-charts/prom-operator/rules/prometheus-rules.yaml +1 -1
- package/src/helm-charts/prom-operator/stackdriver-exporter-gpu-rules.yaml +44 -0
- package/src/helm-charts/prom-operator/stackdriver-exporter.yaml.ovh +15 -12
- package/src/helm-charts/pubsub-pulse/values-local.yaml +5 -3
- package/src/helm-charts/pusher/values-local.yaml +3 -0
- package/src/helm-charts/reason/values-local.yaml +4 -1
- package/src/helm-charts/redis/.nohelm +0 -0
- package/src/helm-charts/redis/helmup.plugin +2 -2
- package/src/helm-charts/resource-server/values-local.yaml +9 -4
- package/src/helm-charts/rule-engine/values-local.yaml +4 -1
- package/src/helm-charts/transponder-bq/values-local.yaml +5 -2
- package/src/helm-charts/transponder-dh/values-local.yaml +5 -2
- package/src/helm-charts/transponder-rt/values-local.yaml +5 -2
- package/src/helm-charts/transponder-tsdb/values-local.yaml +5 -2
- package/src/helm-charts/vin-decoder-server/values-local.yaml +3 -0
- package/src/helmup.sh +27 -4
- package/src/push-my-chart.mjs +17 -8
- package/src/helm-charts/prom-operator/grafana-dashboards/cloudnative-pg.json +0 -9190
- package/src/helm-charts/prom-operator/grafana-dashboards/redis.json +0 -1513
- package/src/helm-charts/prom-operator/grafana-dashboards/stackdriver.json +0 -624
- package/src/helm-charts/prom-operator/grafana-dashboards/traefik-op.json +0 -1386
- /package/src/helm-charts/{cert-manager → deprecated/cert-manager}/.nohelm +0 -0
- /package/src/helm-charts/{cert-manager → deprecated/cert-manager}/cert-manager-local.yaml.ovh +0 -0
- /package/src/helm-charts/{cert-manager → deprecated/cert-manager}/gitignore +0 -0
- /package/src/helm-charts/{cert-manager → deprecated/cert-manager}/helmup.plugin +0 -0
- /package/src/helm-charts/{grafana → deprecated/grafana}/.nohelm +0 -0
- /package/src/helm-charts/{grafana → deprecated/grafana}/gitignore +0 -0
- /package/src/helm-charts/{grafana → deprecated/grafana}/grafana-local.yaml.ovh +0 -0
- /package/src/helm-charts/{grafana → deprecated/grafana}/helmup.plugin +0 -0
- /package/src/helm-charts/{postgres → deprecated/postgres}/.nohelm +0 -0
- /package/src/helm-charts/{postgres → deprecated/postgres}/helmup.plugin +0 -0
- /package/src/helm-charts/{postgres → deprecated/postgres}/postgres-local.yaml +0 -0
- /package/src/helm-charts/{prometheus → deprecated/prometheus}/helmup.plugin +0 -0
- /package/src/helm-charts/{prometheus → deprecated/prometheus}/values-local.yaml +0 -0
- /package/src/helm-charts/{stackdriver-exporter → deprecated/stackdriver-exporter}/helmup.plugin +0 -0
- /package/src/helm-charts/{stackdriver-exporter → deprecated/stackdriver-exporter}/values-local.yaml +0 -0
- /package/src/helm-charts/{timescale-db → deprecated/timescale-db}/.nohelm +0 -0
- /package/src/helm-charts/{timescale-db → deprecated/timescale-db}/helmup.plugin +0 -0
- /package/src/helm-charts/{timescale-db → deprecated/timescale-db}/timescale-db-local.yaml +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.66.
|
|
3
|
+
"version": "2.66.4",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
"deepmerge": "^4.3.1",
|
|
70
70
|
"enquirer": "^2.4.1",
|
|
71
71
|
"execa": "^9.5.2",
|
|
72
|
-
"glob": "^11.0.
|
|
72
|
+
"glob": "^11.0.2",
|
|
73
73
|
"handlebars": "^4.7.8",
|
|
74
|
-
"ignore": "^7.0.
|
|
75
|
-
"inquirer": "^12.
|
|
74
|
+
"ignore": "^7.0.4",
|
|
75
|
+
"inquirer": "^12.6.0",
|
|
76
76
|
"js-yaml": "^4.1.0",
|
|
77
77
|
"jsdoc": "^4.0.4",
|
|
78
78
|
"ms": "^2.1.3",
|
package/src/.swo
ADDED
|
Binary file
|
package/src/bash-funcs
CHANGED
|
@@ -215,3 +215,13 @@ PLUGIN_NOEXEC
|
|
|
215
215
|
sendToSlack "$PLUGIN"
|
|
216
216
|
return 0
|
|
217
217
|
}
|
|
218
|
+
|
|
219
|
+
# simple enforcement of necessary tools that need to be installed
|
|
220
|
+
function commandChecker() {
|
|
221
|
+
for cmd in "$@"; do
|
|
222
|
+
command -v "$cmd" &> $DEVNULL
|
|
223
|
+
exitOnError $? "the `color g $cmd` command is required but not installed please install it and try again"
|
|
224
|
+
done
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
commandChecker git helm kubectl service-man
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// helm-audit.mjs
|
|
4
|
+
// Node.js version of helm-audit.sh to display deployed chart/image/audit info
|
|
5
|
+
|
|
6
|
+
import { shellCmd, log, debug } from './Utils.mjs'
|
|
7
|
+
import ora from 'ora'
|
|
8
|
+
import pLimit from 'p-limit'
|
|
9
|
+
import chalk from 'chalk'
|
|
10
|
+
|
|
11
|
+
const spinner = ora('Gathering Helm release info...').start()
|
|
12
|
+
const limit = pLimit(5) // limit concurrent shellCmds to avoid API overload
|
|
13
|
+
const OMIT_NAMESPACES = new Set(['estafette'])
|
|
14
|
+
|
|
15
|
+
async function getHelmReleases() {
|
|
16
|
+
const json = await shellCmd('helm list -A -o json')
|
|
17
|
+
return JSON.parse(json).filter(r => !OMIT_NAMESPACES.has(r.namespace))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function getDeployedImageTag(ns, release) {
|
|
21
|
+
try {
|
|
22
|
+
const image = await shellCmd(`kubectl get deployment -n ${ns} -l app.kubernetes.io/instance=${release} -o jsonpath={.items[0].spec.template.spec.containers[0].image}`)
|
|
23
|
+
const tag = image.trim().split(':')[1]
|
|
24
|
+
return tag && tag !== 'not found' ? tag : ''
|
|
25
|
+
} catch {
|
|
26
|
+
return ''
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function getChartAppVersion(ns, release) {
|
|
31
|
+
try {
|
|
32
|
+
const metadata = await shellCmd(`helm get metadata ${release} -n ${ns}`)
|
|
33
|
+
const match = metadata.match(/^APP_VERSION:\s*(.*?)\s*$/m)
|
|
34
|
+
return match ? match[1].trim() : '(unknown)'
|
|
35
|
+
} catch {
|
|
36
|
+
return '(unknown)'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function getHelmValue(ns, release, key) {
|
|
41
|
+
try {
|
|
42
|
+
const values = await shellCmd(`helm get values ${release} -n ${ns} -o json`)
|
|
43
|
+
const parsed = JSON.parse(values)
|
|
44
|
+
return parsed.helmup?.[key] || ''
|
|
45
|
+
} catch {
|
|
46
|
+
return ''
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function normalizeTag(tag) {
|
|
51
|
+
return tag?.replace(/^v/, '').toLowerCase() || ''
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function formatRow(name, chartVersion, appVersion, imageTag, deployT, culprit) {
|
|
55
|
+
const release = chalk.green(name.slice(0, 25).padEnd(32))
|
|
56
|
+
const chartVer = chalk.cyan(chartVersion.padEnd(18))
|
|
57
|
+
const appVer = chalk.cyan(appVersion.padEnd(18))
|
|
58
|
+
const normApp = normalizeTag(appVersion)
|
|
59
|
+
const normImage = normalizeTag(imageTag)
|
|
60
|
+
|
|
61
|
+
let imageFormatted = imageTag.padEnd(20)
|
|
62
|
+
if (normImage && normApp && normImage === normApp) {
|
|
63
|
+
imageFormatted = chalk.green(imageFormatted)
|
|
64
|
+
} else if (imageTag) {
|
|
65
|
+
imageFormatted = chalk.red(imageFormatted)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const deployInfo = deployT ? chalk.gray(`${deployT} by ${culprit || '(unknown)'}`) : ''
|
|
69
|
+
return ` ${release}${chartVer}${appVer}${imageFormatted}${deployInfo}`
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function audit() {
|
|
73
|
+
spinner.text = 'Fetching release metadata...'
|
|
74
|
+
const releases = await getHelmReleases()
|
|
75
|
+
|
|
76
|
+
// sort by namespace, then release name
|
|
77
|
+
releases.sort((a, b) => {
|
|
78
|
+
const nsCompare = a.namespace.localeCompare(b.namespace)
|
|
79
|
+
return nsCompare !== 0 ? nsCompare : a.name.localeCompare(b.name)
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
spinner.text = 'Gathering chart, image, and audit metadata...'
|
|
83
|
+
|
|
84
|
+
const rows = await Promise.all(releases.map(({ name, namespace, chart }) => limit(async () => {
|
|
85
|
+
const chartVersion = chart?.split('-').pop() || '(unknown)'
|
|
86
|
+
const [appVersion, imageTag, deployT, culprit] = await Promise.all([
|
|
87
|
+
getChartAppVersion(namespace, name),
|
|
88
|
+
getDeployedImageTag(namespace, name),
|
|
89
|
+
getHelmValue(namespace, name, 'deployT'),
|
|
90
|
+
getHelmValue(namespace, name, 'culprit'),
|
|
91
|
+
])
|
|
92
|
+
return {
|
|
93
|
+
row: formatRow(name, chartVersion, appVersion, imageTag, deployT, culprit),
|
|
94
|
+
namespace
|
|
95
|
+
}
|
|
96
|
+
})))
|
|
97
|
+
|
|
98
|
+
spinner.stop()
|
|
99
|
+
log(`${'RELEASE'.padEnd(34)}${'CHART VERSION'.padEnd(18)}${'APP VERSION'.padEnd(18)}${'IMAGE TAG'.padEnd(20)}DEPLOY INFO`)
|
|
100
|
+
|
|
101
|
+
let lastNamespace = ''
|
|
102
|
+
for (const { row, namespace } of rows) {
|
|
103
|
+
if (namespace !== lastNamespace) {
|
|
104
|
+
if (lastNamespace !== '') log('')
|
|
105
|
+
log(chalk.bold.green(namespace))
|
|
106
|
+
lastNamespace = namespace
|
|
107
|
+
}
|
|
108
|
+
log(row)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
audit().catch(err => {
|
|
113
|
+
spinner.stop()
|
|
114
|
+
console.error(err)
|
|
115
|
+
process.exit(1)
|
|
116
|
+
})
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
# - node tools/UpdateESMappingV2.js
|
|
6
6
|
#
|
|
7
7
|
image:
|
|
8
|
-
tag: # v5.
|
|
8
|
+
tag: # v5.25.4
|
|
9
9
|
|
|
10
10
|
config:
|
|
11
11
|
LOG_CONFIG: '{"type":"pino","level":"warn"}'
|
|
@@ -28,10 +28,13 @@ psqlSecurity:
|
|
|
28
28
|
TSDB_DENSE_SECRET_NAME: "cnpg-db-tsdb-dense-postgres-pw"
|
|
29
29
|
TSDB_DENSE_SECRET_KEY: "password"
|
|
30
30
|
|
|
31
|
+
serviceMonitor:
|
|
32
|
+
enabled: true
|
|
33
|
+
|
|
31
34
|
autoscaling:
|
|
32
35
|
minReplicas: 3
|
|
33
36
|
maxReplicas: 12
|
|
34
37
|
maxCPU: 80
|
|
35
38
|
|
|
36
39
|
ingressRoute:
|
|
37
|
-
host:
|
|
40
|
+
host: ${PROJECT_ID}-imagine-api.${HOST}.com
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
# - npm run sequelizeRunMigrations
|
|
5
5
|
#
|
|
6
6
|
image:
|
|
7
|
-
tag: # v2.
|
|
7
|
+
tag: # v2.5.0
|
|
8
8
|
|
|
9
9
|
config:
|
|
10
10
|
LOG_CONFIG: '{"type":"pino","level":"warn"}'
|
|
11
11
|
|
|
12
12
|
# CNPG override
|
|
13
13
|
SQL_HOST: "cnpg-db-psql-stack-rw.cnpg-operands" # vs postgres-postgresql
|
|
14
|
+
|
|
15
|
+
serviceMonitor:
|
|
16
|
+
enabled: true
|
|
@@ -18,7 +18,7 @@ spec:
|
|
|
18
18
|
postInitTemplateSQL:
|
|
19
19
|
- CREATE EXTENSION timescaledb;
|
|
20
20
|
- CREATE EXTENSION jsquery;
|
|
21
|
-
- CREATE
|
|
21
|
+
- CREATE EXTENSION pg_stat_statements;
|
|
22
22
|
- CREATE DATABASE imagine;
|
|
23
23
|
# - CREATE DATABASE app; # for the operator restores
|
|
24
24
|
# - CREATE ROLE app; # same
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
#
|
|
3
3
|
showInstalling "Elastic Search 8"
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# *** WARNING TO FUTURE SELF *** v22 of the chart is ES v9!!!
|
|
6
|
+
[ -z "$ELASTIC_CHART_VERSION" ] && ELASTIC_CHART_VERSION="21.6.3"
|
|
6
7
|
|
|
7
8
|
OCI_CHART="oci://registry-1.docker.io/bitnamicharts/elasticsearch"
|
|
8
9
|
|
|
@@ -4,6 +4,9 @@ image:
|
|
|
4
4
|
config:
|
|
5
5
|
LOG_CONFIG: '{"type":"pino","level":"warn"}'
|
|
6
6
|
|
|
7
|
-
API_UI_URL: "
|
|
8
|
-
MAIL_GUN_DOMAIN: "
|
|
9
|
-
MAIL_GUN_DEFAULT_SENDER: "no-reply
|
|
7
|
+
API_UI_URL: "${PROJECT_ID}.web.app"
|
|
8
|
+
MAIL_GUN_DOMAIN: "${MAIL_GUN_DOMAIN}"
|
|
9
|
+
MAIL_GUN_DEFAULT_SENDER: "no-reply@${MAIL_GUN_DOMAIN}"
|
|
10
|
+
|
|
11
|
+
serviceMonitor:
|
|
12
|
+
enabled: true
|
|
@@ -2,6 +2,9 @@ image:
|
|
|
2
2
|
tag: # v2.3.0
|
|
3
3
|
|
|
4
4
|
config:
|
|
5
|
-
UPLOADER_TYPE: "
|
|
6
|
-
UPLOADER_PROJECT_ID: "
|
|
7
|
-
UPLOADER_BUCKET: "
|
|
5
|
+
UPLOADER_TYPE: "${BUCKET_TYPE}"
|
|
6
|
+
UPLOADER_PROJECT_ID: "${PROJECT_ID}"
|
|
7
|
+
UPLOADER_BUCKET: "${PROJECT_ID}-geotile-server"
|
|
8
|
+
|
|
9
|
+
serviceMonitor:
|
|
10
|
+
enabled: true
|
|
@@ -3,28 +3,35 @@
|
|
|
3
3
|
showInstalling "The Prometheus Operator and Components"
|
|
4
4
|
addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
|
|
5
5
|
|
|
6
|
-
showInstalling "The Prometheus Operator (kube-prometheus-stack)"
|
|
7
|
-
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="70"
|
|
8
|
-
|
|
9
6
|
NS="--namespace prometheus"
|
|
10
7
|
|
|
8
|
+
showInstalling "The Prometheus Operator (kube-prometheus-stack)"
|
|
9
|
+
[ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="72"
|
|
10
|
+
|
|
11
11
|
# https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
|
|
12
12
|
helm upgrade $NS --install prometheus-stack prometheus-community/kube-prometheus-stack \
|
|
13
13
|
--values prom-operator/prometheus-stack.yaml \
|
|
14
14
|
--version $PROMETHEUS_STACK_CHART_VERSION $HELM_WHAT
|
|
15
15
|
|
|
16
16
|
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-elasticsearch-exporter
|
|
17
|
-
showInstalling "The Elasticsearch Exporter (prom-operator)"
|
|
17
|
+
showInstalling "The Elasticsearch Exporter (prom-operator ES metrics exports)"
|
|
18
18
|
[ -z "$ELASTICSEARCH_EXPORTER_CHART_VERSION" ] && ELASTICSEARCH_EXPORTER_CHART_VERSION="6"
|
|
19
19
|
helm upgrade $NS --install elasticsearch8-exporter prometheus-community/prometheus-elasticsearch-exporter \
|
|
20
20
|
--values prom-operator/elasticsearch-exporter.yaml \
|
|
21
21
|
--version $ELASTICSEARCH_EXPORTER_CHART_VERSION $HELM_WHAT
|
|
22
22
|
|
|
23
23
|
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-stackdriver-exporter
|
|
24
|
-
showInstalling "The Stackdriver Exporter (prom-operator)"
|
|
24
|
+
showInstalling "The Stackdriver Exporter (prom-operator GKE metrics exports)"
|
|
25
25
|
[ -z "$STACKDRIVER_EXPORTER_CHART_VERSION" ] && STACKDRIVER_EXPORTER_CHART_VERSION="4"
|
|
26
26
|
helm upgrade $NS --install stackdriver-exporter prometheus-community/prometheus-stackdriver-exporter \
|
|
27
27
|
--values prom-operator/stackdriver-exporter.yaml \
|
|
28
28
|
--version $STACKDRIVER_EXPORTER_CHART_VERSION $HELM_WHAT
|
|
29
29
|
|
|
30
|
+
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-adapter
|
|
31
|
+
showInstalling "The Prometheus Adapter (prom-operator custom HPA metrics)"
|
|
32
|
+
[ -z "$PROMETHEUS_ADAPTER_CHART_VERSION" ] && PROMETHEUS_ADAPTER_CHART_VERSION="4"
|
|
33
|
+
helm upgrade $NS --install prometheus-adapter prometheus-community/prometheus-adapter \
|
|
34
|
+
--values prom-operator/prometheus-adapter.yaml \
|
|
35
|
+
--version $PROMETHEUS_ADAPTER_CHART_VERSION $HELM_WHAT
|
|
36
|
+
|
|
30
37
|
removeHelmRepo prometheus-community
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
fullnameOverride: "prometheus-stack-adapter"
|
|
2
|
+
|
|
3
|
+
prometheus:
|
|
4
|
+
url: "http://prometheus-operated.prometheus.svc"
|
|
5
|
+
port: 9090
|
|
6
|
+
|
|
7
|
+
rules:
|
|
8
|
+
custom:
|
|
9
|
+
- seriesQuery: 'gpu_duty_cycle_percent{namespace!="",pod!=""}'
|
|
10
|
+
resources:
|
|
11
|
+
overrides:
|
|
12
|
+
namespace: {resource: "namespace"}
|
|
13
|
+
pod: {resource: "pod"}
|
|
14
|
+
name:
|
|
15
|
+
matches: "gpu_duty_cycle_percent"
|
|
16
|
+
as: "gpu_duty_cycle_percent"
|
|
17
|
+
metricsQuery: |
|
|
18
|
+
avg(gpu_duty_cycle_percent{<<.LabelMatchers>>}) by (<<.GroupBy>>)
|
|
@@ -82,7 +82,7 @@ grafana:
|
|
|
82
82
|
entryPoints:
|
|
83
83
|
- websecure
|
|
84
84
|
routes:
|
|
85
|
-
- match: Host(`${PROJECT_NAME}-
|
|
85
|
+
- match: Host(`${PROJECT_NAME}-monitoring.${HOST}.com`)
|
|
86
86
|
kind: Rule
|
|
87
87
|
services:
|
|
88
88
|
- name: prometheus-stack-grafana
|
|
@@ -114,16 +114,57 @@ alertmanager:
|
|
|
114
114
|
slack_configs:
|
|
115
115
|
- channel: "${SLACK_CHANNEL}"
|
|
116
116
|
api_url: "${SLACK_HOOK_URL}"
|
|
117
|
-
username: "${
|
|
118
|
-
fallback: "${PROJECT_NAME} - {{ .CommonAnnotations.summary }}"
|
|
119
|
-
title: "{{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
|
|
120
|
-
title_link: "https://bitbucket.org/leverege/sre-playbook/src/master/"
|
|
117
|
+
username: "${PROJECT_ID}"
|
|
121
118
|
send_resolved: true
|
|
119
|
+
title: '{{ .CommonLabels.alertname }} alert'
|
|
120
|
+
title_link: '#'
|
|
121
|
+
color: >-
|
|
122
|
+
{{- if eq .Status "resolved" -}}
|
|
123
|
+
good
|
|
124
|
+
{{- else if eq .CommonLabels.severity "critical" -}}
|
|
125
|
+
danger
|
|
126
|
+
{{- else if eq .CommonLabels.severity "warning" -}}
|
|
127
|
+
warning
|
|
128
|
+
{{- else if eq .CommonLabels.severity "info" -}}
|
|
129
|
+
#439FE0
|
|
130
|
+
{{- else -}}
|
|
131
|
+
#CCCCCC
|
|
132
|
+
{{- end }}
|
|
122
133
|
text: |-
|
|
123
134
|
{{ range .Alerts }}
|
|
124
|
-
|
|
125
|
-
*
|
|
126
|
-
|
|
135
|
+
{{- if eq .Status "resolved" }}
|
|
136
|
+
:white_check_mark: *Resolved:* {{ .Annotations.summary }}
|
|
137
|
+
{{- else if eq .Labels.severity "critical" }}
|
|
138
|
+
:fire: *Critical:* {{ .Annotations.summary }}
|
|
139
|
+
{{- else if eq .Labels.severity "warning" }}
|
|
140
|
+
:warning: *Warning:* {{ .Annotations.summary }}
|
|
141
|
+
{{- else if eq .Labels.severity "info" }}
|
|
142
|
+
:information_source: *Info:* {{ .Annotations.summary }}
|
|
143
|
+
{{- else }}
|
|
144
|
+
:grey_question: *Alert:* {{ .Annotations.summary }}
|
|
145
|
+
{{- end }}
|
|
146
|
+
|
|
147
|
+
*Description:* {{ .Annotations.description }}
|
|
148
|
+
|
|
149
|
+
{{- if .Annotations.runbook_url }}
|
|
150
|
+
*Runbook:* <{{ .Annotations.runbook_url }}|Open Playbook>
|
|
151
|
+
{{- end }}
|
|
152
|
+
|
|
153
|
+
{{- if .Labels.pod }}
|
|
154
|
+
*Pod Link:* *<https://console.cloud.google.com/kubernetes/pod/${GCE_REGION}/${CLUSTER_NAME}/{{ .Labels.namespace }}/{{ .Labels.pod }}?project=${PROJECT_ID}|`{{ .Labels.pod }}`>*
|
|
155
|
+
{{- end }}
|
|
156
|
+
|
|
157
|
+
*Status:* `{{ .Status }}` | *Severity:* `{{ .Labels.severity }}` {{- if .Labels.container }} *Container:* `{{ .Labels.container }}` {{- end }}
|
|
158
|
+
|
|
159
|
+
{{- if .Annotations.dashboard }}
|
|
160
|
+
*Dashboard:* <{{ .Annotations.dashboard }}|View Dashboard>
|
|
161
|
+
{{- end }}
|
|
162
|
+
|
|
163
|
+
*Labels:*
|
|
164
|
+
{{- range $k, $v := .Labels }}
|
|
165
|
+
• `{{ $k }} = {{ $v }}`
|
|
166
|
+
{{- end }}
|
|
167
|
+
---
|
|
127
168
|
{{ end }}
|
|
128
169
|
- name: slack-watchdog
|
|
129
170
|
slack_configs:
|
|
@@ -156,10 +197,10 @@ alertmanager:
|
|
|
156
197
|
group_interval: 5m
|
|
157
198
|
group_by:
|
|
158
199
|
- alertname
|
|
159
|
-
-
|
|
200
|
+
- namespace
|
|
160
201
|
receiver: slack
|
|
161
202
|
routes:
|
|
162
|
-
-
|
|
203
|
+
- match_re:
|
|
163
204
|
alertname: "Watchdog"
|
|
164
205
|
receiver: slack-watchdog
|
|
165
206
|
- match:
|
|
@@ -64,16 +64,31 @@ spec:
|
|
|
64
64
|
VALUE = {{ $value }}
|
|
65
65
|
LABELS = {{ $labels }}
|
|
66
66
|
- alert: ContainerHighThrottleRate
|
|
67
|
-
expr:
|
|
67
|
+
expr: |
|
|
68
|
+
(
|
|
69
|
+
(
|
|
70
|
+
sum by (container, pod, namespace) (increase(container_cpu_cfs_throttled_periods_total{container!=""}[5m]))
|
|
71
|
+
/
|
|
72
|
+
sum by (container, pod, namespace) (increase(container_cpu_cfs_periods_total{container!=""}[5m]))
|
|
73
|
+
)
|
|
74
|
+
and on (pod, namespace)
|
|
75
|
+
(
|
|
76
|
+
time() - kube_pod_start_time > 60
|
|
77
|
+
)
|
|
78
|
+
) > 0.3
|
|
68
79
|
for: 5m
|
|
69
80
|
labels:
|
|
70
81
|
severity: warning
|
|
82
|
+
namespace: '{{ $labels.namespace }}'
|
|
83
|
+
pod: '{{ $labels.pod }}'
|
|
84
|
+
container: '{{ $labels.container }}'
|
|
71
85
|
annotations:
|
|
72
|
-
summary:
|
|
73
|
-
description:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
86
|
+
summary: Pod experiencing high CPU throttling
|
|
87
|
+
description: |
|
|
88
|
+
{{ $labels.pod }} was throttled
|
|
89
|
+
- Verify Kubernetes CPU resource *requests* and *limits* for the container.
|
|
90
|
+
- Check if recent pod startup or autoscaling events could explain transient throttling.
|
|
91
|
+
- Persistent throttling indicates the container needs higher CPU limits or node sizing adjustment.
|
|
77
92
|
# - alert: ContainerHighLowChangeCpuUsage
|
|
78
93
|
# expr: (abs((sum by (instance, name) (rate(container_cpu_usage_seconds_total{name!=""}[1m])) * 100) - (sum by (instance, name) (rate(container_cpu_usage_seconds_total{name!=""}[1m] offset 1m)) * 100)) or abs((sum by (instance, name) (rate(container_cpu_usage_seconds_total{name!=""}[1m])) * 100) - (sum by (instance, name) (rate(container_cpu_usage_seconds_total{name!=""}[5m] offset 1m)) * 100))) > 25
|
|
79
94
|
# for: 0m
|
|
@@ -174,7 +174,7 @@ spec:
|
|
|
174
174
|
VALUE = {{ $value }}
|
|
175
175
|
LABELS = {{ $labels }}
|
|
176
176
|
- alert: ElasticsearchHighIndexingLatency
|
|
177
|
-
expr: elasticsearch_indices_indexing_index_time_seconds_total / elasticsearch_indices_indexing_index_total > 0.0005
|
|
177
|
+
expr: elasticsearch_indices_indexing_index_time_seconds_total / elasticsearch_indices_indexing_index_total > 0.002 # awesome was 0.0005
|
|
178
178
|
for: 10m
|
|
179
179
|
labels:
|
|
180
180
|
severity: warning
|
|
@@ -172,8 +172,8 @@ spec:
|
|
|
172
172
|
summary: Kubernetes HPA scale inability (instance {{ $labels.instance }})
|
|
173
173
|
description: |-
|
|
174
174
|
HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is unable to scale
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
# VALUE = {{ $value }}
|
|
176
|
+
# LABELS = {{ $labels }}
|
|
177
177
|
- alert: KubernetesHpaMetricsUnavailability
|
|
178
178
|
expr: kube_horizontalpodautoscaler_status_condition{status="false", condition="ScalingActive"} == 1
|
|
179
179
|
for: 0m
|
|
@@ -183,8 +183,8 @@ spec:
|
|
|
183
183
|
summary: Kubernetes HPA metrics unavailability (instance {{ $labels.instance }})
|
|
184
184
|
description: |-
|
|
185
185
|
HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is unable to collect metrics
|
|
186
|
-
VALUE = {{ $value }}
|
|
187
186
|
LABELS = {{ $labels }}
|
|
187
|
+
# VALUE = {{ $value }}
|
|
188
188
|
- alert: KubernetesHpaScaleMaximum
|
|
189
189
|
expr: (kube_horizontalpodautoscaler_status_desired_replicas >= kube_horizontalpodautoscaler_spec_max_replicas) and (kube_horizontalpodautoscaler_spec_max_replicas > 1) and (kube_horizontalpodautoscaler_spec_min_replicas != kube_horizontalpodautoscaler_spec_max_replicas)
|
|
190
190
|
for: 2m
|
|
@@ -193,9 +193,7 @@ spec:
|
|
|
193
193
|
annotations:
|
|
194
194
|
summary: Kubernetes HPA scale maximum (instance {{ $labels.instance }})
|
|
195
195
|
description: |-
|
|
196
|
-
HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} has hit
|
|
197
|
-
VALUE = {{ $value }}
|
|
198
|
-
LABELS = {{ $labels }}
|
|
196
|
+
HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} has hit max replica pods of {{ $value }}
|
|
199
197
|
- alert: KubernetesHpaUnderutilized
|
|
200
198
|
expr: max(quantile_over_time(0.5, kube_horizontalpodautoscaler_status_desired_replicas[1d]) == kube_horizontalpodautoscaler_spec_min_replicas) by (horizontalpodautoscaler) > 3
|
|
201
199
|
for: 0m
|
|
@@ -385,7 +383,7 @@ spec:
|
|
|
385
383
|
LABELS = {{ $labels }}
|
|
386
384
|
- alert: KubernetesApiServerLatency
|
|
387
385
|
expr: histogram_quantile(0.99, sum(rate(apiserver_request_duration_seconds_bucket{verb!~"(?:CONNECT|WATCHLIST|WATCH|PROXY)"} [10m])) WITHOUT (subresource)) > 1
|
|
388
|
-
for:
|
|
386
|
+
for: 15m
|
|
389
387
|
labels:
|
|
390
388
|
severity: warning
|
|
391
389
|
annotations:
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#
|
|
2
|
+
# these custom rules exist to essentially boil down the GPU information provided
|
|
3
|
+
# by the stackdriver exporter into a form that is a little more humand readable
|
|
4
|
+
# in an attempt to keep the grafana / alert manager rules a little less "verbose"
|
|
5
|
+
#
|
|
6
|
+
# In a nutshell, we take metrics in the form of:
|
|
7
|
+
# stackdriver_k_8_s_container_kubernetes_io_container_accelerator_duty_cycle
|
|
8
|
+
# and create boiled down metrics in the form of:
|
|
9
|
+
# gpu_duty_cycle_percent
|
|
10
|
+
#
|
|
11
|
+
apiVersion: monitoring.coreos.com/v1
|
|
12
|
+
kind: PrometheusRule
|
|
13
|
+
metadata:
|
|
14
|
+
name: prometheus-stack-kube-prom-stackdriver.gpu-rules
|
|
15
|
+
namespace: prometheus
|
|
16
|
+
labels:
|
|
17
|
+
release: prometheus-stack # or whatever your Prometheus release name is
|
|
18
|
+
spec:
|
|
19
|
+
groups:
|
|
20
|
+
- name: gpu.rules
|
|
21
|
+
interval: 1m
|
|
22
|
+
rules:
|
|
23
|
+
- record: "gpu_duty_cycle_percent"
|
|
24
|
+
expr: |
|
|
25
|
+
label_replace(
|
|
26
|
+
label_replace(
|
|
27
|
+
avg by (
|
|
28
|
+
pod_name,
|
|
29
|
+
namespace_name,
|
|
30
|
+
container_name,
|
|
31
|
+
accelerator_id,
|
|
32
|
+
model,
|
|
33
|
+
make
|
|
34
|
+
) (
|
|
35
|
+
stackdriver_k_8_s_container_kubernetes_io_container_accelerator_duty_cycle
|
|
36
|
+
),
|
|
37
|
+
"namespace", "$1", "namespace_name", "(.*)"
|
|
38
|
+
),
|
|
39
|
+
"pod", "$1", "pod_name", "(.*)"
|
|
40
|
+
)
|
|
41
|
+
labels:
|
|
42
|
+
source: "stackdriver"
|
|
43
|
+
metric_type: "derived"
|
|
44
|
+
subsystem: "gpu"
|
|
@@ -8,24 +8,27 @@ stackdriver:
|
|
|
8
8
|
projectId: "${PROJECT_NAME}"
|
|
9
9
|
metrics:
|
|
10
10
|
typePrefixes: >
|
|
11
|
-
|
|
11
|
+
agent.googleapis.com/cpu/utilization,
|
|
12
|
+
agent.googleapis.com/memory/bytes_used,
|
|
13
|
+
container.googleapis.com/accelerator/duty_cycle,
|
|
14
|
+
container.googleapis.com/accelerator/memory_usage,
|
|
15
|
+
container.googleapis.com/accelerator/request_count,
|
|
16
|
+
firebasedatabase.googleapis.com/io/database_load,
|
|
17
|
+
firebasedatabase.googleapis.com/network/active_connections,
|
|
18
|
+
firebasedatabase.googleapis.com/network/sent_bytes_count,
|
|
19
|
+
kubernetes.io/container/accelerator/duty_cycle,
|
|
20
|
+
kubernetes.io/container/accelerator/memory_total,
|
|
21
|
+
kubernetes.io/container/accelerator/memory_used,
|
|
22
|
+
monitoring.googleapis.com/uptime_check/check_passed,
|
|
12
23
|
pubsub.googleapis.com/subscription/num_undelivered_messages,
|
|
24
|
+
pubsub.googleapis.com/subscription/oldest_unacked_message_age,
|
|
13
25
|
pubsub.googleapis.com/subscription/pull_ack_request_count,
|
|
14
26
|
pubsub.googleapis.com/subscription/streaming_pull_ack_request_count,
|
|
15
27
|
pubsub.googleapis.com/topic/message_sizes,
|
|
16
28
|
pubsub.googleapis.com/topic/send_request_count,
|
|
17
|
-
|
|
18
|
-
firebasedatabase.googleapis.com/network/sent_bytes_count,
|
|
19
|
-
firebasedatabase.googleapis.com/network/active_connections,
|
|
20
|
-
container.googleapis.com/accelerator/duty_cycle,
|
|
21
|
-
container.googleapis.com/accelerator/memory_usage,
|
|
22
|
-
container.googleapis.com/accelerator/request_count,
|
|
23
|
-
agent.googleapis.com/memory/bytes_used,
|
|
24
|
-
agent.googleapis.com/cpu/utilization,
|
|
29
|
+
quota.googleapis.com/allocation/usage,
|
|
25
30
|
storage.googleapis.com/network/received_bytes_count,
|
|
26
|
-
storage.googleapis.com/network/sent_bytes_count
|
|
27
|
-
monitoring.googleapis.com/uptime_check/check_passed,
|
|
28
|
-
quota.googleapis.com/allocation/usage
|
|
31
|
+
storage.googleapis.com/network/sent_bytes_count
|
|
29
32
|
|
|
30
33
|
# https://artifacthub.io/packages/helm/prometheus-community/prometheus-stackdriver-exporter?modal=values&path=serviceMonitor
|
|
31
34
|
serviceMonitor:
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
image:
|
|
2
|
-
tag: #
|
|
3
|
-
# registry: us-docker.pkg.dev/leverege-registry/leverege/images
|
|
2
|
+
tag: # v4.1.1
|
|
4
3
|
|
|
5
4
|
config:
|
|
6
5
|
pulseDelay: "1000"
|
|
7
6
|
LOG_CONFIG: '{"type":"pino","level":"warn"}'
|
|
8
|
-
IMAGINE_API_URL: "https
|
|
7
|
+
IMAGINE_API_URL: "https://${PROJECT_ID}-imagine-api.${HOST}.com"
|
|
8
|
+
|
|
9
|
+
serviceMonitor:
|
|
10
|
+
enabled: true
|