@leverege/build-tools 2.64.0 → 2.65.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.
@@ -0,0 +1,393 @@
1
+ apiVersion: monitoring.coreos.com/v1
2
+ kind: PrometheusRule
3
+ metadata:
4
+ name: kubestate-exporter
5
+ spec:
6
+ groups:
7
+ - name: KubestateExporter-rules
8
+ rules:
9
+ - alert: KubernetesNodeNotReady
10
+ expr: kube_node_status_condition{condition="Ready",status="true"} == 0
11
+ for: 10m
12
+ labels:
13
+ severity: critical
14
+ annotations:
15
+ summary: Kubernetes Node ready (node {{ $labels.node }})
16
+ description: |-
17
+ Node {{ $labels.node }} has been unready for a long time
18
+ VALUE = {{ $value }}
19
+ LABELS = {{ $labels }}
20
+ - alert: KubernetesNodeMemoryPressure
21
+ expr: kube_node_status_condition{condition="MemoryPressure",status="true"} == 1
22
+ for: 2m
23
+ labels:
24
+ severity: critical
25
+ annotations:
26
+ summary: Kubernetes memory pressure (node {{ $labels.node }})
27
+ description: |-
28
+ Node {{ $labels.node }} has MemoryPressure condition
29
+ VALUE = {{ $value }}
30
+ LABELS = {{ $labels }}
31
+ - alert: KubernetesNodeDiskPressure
32
+ expr: kube_node_status_condition{condition="DiskPressure",status="true"} == 1
33
+ for: 2m
34
+ labels:
35
+ severity: critical
36
+ annotations:
37
+ summary: Kubernetes disk pressure (node {{ $labels.node }})
38
+ description: |-
39
+ Node {{ $labels.node }} has DiskPressure condition
40
+ VALUE = {{ $value }}
41
+ LABELS = {{ $labels }}
42
+ - alert: KubernetesNodeNetworkUnavailable
43
+ expr: kube_node_status_condition{condition="NetworkUnavailable",status="true"} == 1
44
+ for: 2m
45
+ labels:
46
+ severity: critical
47
+ annotations:
48
+ summary: Kubernetes Node network unavailable (instance {{ $labels.instance }})
49
+ description: |-
50
+ Node {{ $labels.node }} has NetworkUnavailable condition
51
+ VALUE = {{ $value }}
52
+ LABELS = {{ $labels }}
53
+ - alert: KubernetesNodeOutOfPodCapacity
54
+ expr: sum by (node) ((kube_pod_status_phase{phase="Running"} == 1) + on(uid, instance) group_left(node) (0 * kube_pod_info{pod_template_hash=""})) / sum by (node) (kube_node_status_allocatable{resource="pods"}) * 100 > 90
55
+ for: 2m
56
+ labels:
57
+ severity: warning
58
+ annotations:
59
+ summary: Kubernetes Node out of pod capacity (instance {{ $labels.instance }})
60
+ description: |-
61
+ Node {{ $labels.node }} is out of pod capacity
62
+ VALUE = {{ $value }}
63
+ LABELS = {{ $labels }}
64
+ - alert: KubernetesContainerOomKiller
65
+ expr: (kube_pod_container_status_restarts_total - kube_pod_container_status_restarts_total offset 10m >= 1) and ignoring (reason) min_over_time(kube_pod_container_status_last_terminated_reason{reason="OOMKilled"}[10m]) == 1
66
+ for: 0m
67
+ labels:
68
+ severity: warning
69
+ annotations:
70
+ summary: Kubernetes container oom killer ({{ $labels.namespace }}/{{ $labels.pod }}:{{ $labels.container }})
71
+ description: |-
72
+ Container {{ $labels.container }} in pod {{ $labels.namespace }}/{{ $labels.pod }} has been OOMKilled {{ $value }} times in the last 10 minutes.
73
+ VALUE = {{ $value }}
74
+ LABELS = {{ $labels }}
75
+ - alert: KubernetesJobFailed
76
+ expr: kube_job_status_failed > 0
77
+ for: 0m
78
+ labels:
79
+ severity: warning
80
+ annotations:
81
+ summary: Kubernetes Job failed ({{ $labels.namespace }}/{{ $labels.job_name }})
82
+ description: |-
83
+ Job {{ $labels.namespace }}/{{ $labels.job_name }} failed to complete
84
+ VALUE = {{ $value }}
85
+ LABELS = {{ $labels }}
86
+ - alert: KubernetesJobNotStarting
87
+ expr: kube_job_status_active == 0 and kube_job_status_failed == 0 and kube_job_status_succeeded == 0 and (time() - kube_job_status_start_time) > 600
88
+ for: 0m
89
+ labels:
90
+ severity: warning
91
+ annotations:
92
+ summary: Kubernetes Job not starting ({{ $labels.namespace }}/{{ $labels.job_name }})
93
+ description: |-
94
+ Job {{ $labels.namespace }}/{{ $labels.job_name }} did not start for 10 minutes
95
+ VALUE = {{ $value }}
96
+ LABELS = {{ $labels }}
97
+ - alert: KubernetesCronjobSuspended
98
+ expr: kube_cronjob_spec_suspend != 0
99
+ for: 0m
100
+ labels:
101
+ severity: warning
102
+ annotations:
103
+ summary: Kubernetes CronJob suspended ({{ $labels.namespace }}/{{ $labels.cronjob }})
104
+ description: |-
105
+ CronJob {{ $labels.namespace }}/{{ $labels.cronjob }} is suspended
106
+ VALUE = {{ $value }}
107
+ LABELS = {{ $labels }}
108
+ - alert: KubernetesPersistentvolumeclaimPending
109
+ expr: kube_persistentvolumeclaim_status_phase{phase="Pending"} == 1
110
+ for: 2m
111
+ labels:
112
+ severity: warning
113
+ annotations:
114
+ summary: Kubernetes PersistentVolumeClaim pending ({{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }})
115
+ description: |-
116
+ PersistentVolumeClaim {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is pending
117
+ VALUE = {{ $value }}
118
+ LABELS = {{ $labels }}
119
+ - alert: KubernetesVolumeOutOfDiskSpace
120
+ expr: kubelet_volume_stats_available_bytes / kubelet_volume_stats_capacity_bytes * 100 < 10
121
+ for: 2m
122
+ labels:
123
+ severity: warning
124
+ annotations:
125
+ summary: Kubernetes Volume out of disk space (instance {{ $labels.instance }})
126
+ description: |-
127
+ Volume is almost full (< 10% left)
128
+ VALUE = {{ $value }}
129
+ LABELS = {{ $labels }}
130
+ - alert: KubernetesVolumeFullInFourDays
131
+ expr: predict_linear(kubelet_volume_stats_available_bytes[6h:5m], 4 * 24 * 3600) < 0
132
+ for: 0m
133
+ labels:
134
+ severity: critical
135
+ annotations:
136
+ summary: Kubernetes Volume full in four days (instance {{ $labels.instance }})
137
+ description: |-
138
+ Volume under {{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }} is expected to fill up within four days. Currently {{ $value | humanize }}% is available.
139
+ VALUE = {{ $value }}
140
+ LABELS = {{ $labels }}
141
+ - alert: KubernetesPersistentvolumeError
142
+ expr: kube_persistentvolume_status_phase{phase=~"Failed|Pending", job="kube-state-metrics"} > 0
143
+ for: 0m
144
+ labels:
145
+ severity: critical
146
+ annotations:
147
+ summary: Kubernetes PersistentVolumeClaim pending ({{ $labels.namespace }}/{{ $labels.persistentvolumeclaim }})
148
+ description: |-
149
+ Persistent volume {{ $labels.persistentvolume }} is in bad state
150
+ VALUE = {{ $value }}
151
+ LABELS = {{ $labels }}
152
+ - alert: KubernetesStatefulsetDown
153
+ expr: kube_statefulset_replicas != kube_statefulset_status_replicas_ready > 0
154
+ for: 1m
155
+ labels:
156
+ severity: critical
157
+ annotations:
158
+ summary: Kubernetes StatefulSet down ({{ $labels.namespace }}/{{ $labels.statefulset }})
159
+ description: |-
160
+ StatefulSet {{ $labels.namespace }}/{{ $labels.statefulset }} went down
161
+ VALUE = {{ $value }}
162
+ LABELS = {{ $labels }}
163
+ - alert: KubernetesHpaScaleInability
164
+ expr: (kube_horizontalpodautoscaler_spec_max_replicas - kube_horizontalpodautoscaler_status_desired_replicas) * on (horizontalpodautoscaler,namespace) (kube_horizontalpodautoscaler_status_condition{condition="ScalingLimited", status="true"} == 1) == 0
165
+ for: 2m
166
+ labels:
167
+ severity: warning
168
+ annotations:
169
+ summary: Kubernetes HPA scale inability (instance {{ $labels.instance }})
170
+ description: |-
171
+ HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is unable to scale
172
+ VALUE = {{ $value }}
173
+ LABELS = {{ $labels }}
174
+ - alert: KubernetesHpaMetricsUnavailability
175
+ expr: kube_horizontalpodautoscaler_status_condition{status="false", condition="ScalingActive"} == 1
176
+ for: 0m
177
+ labels:
178
+ severity: warning
179
+ annotations:
180
+ summary: Kubernetes HPA metrics unavailability (instance {{ $labels.instance }})
181
+ description: |-
182
+ HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is unable to collect metrics
183
+ VALUE = {{ $value }}
184
+ LABELS = {{ $labels }}
185
+ - alert: KubernetesHpaScaleMaximum
186
+ 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)
187
+ for: 2m
188
+ labels:
189
+ severity: info
190
+ annotations:
191
+ summary: Kubernetes HPA scale maximum (instance {{ $labels.instance }})
192
+ description: |-
193
+ HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} has hit maximum number of desired pods
194
+ VALUE = {{ $value }}
195
+ LABELS = {{ $labels }}
196
+ - alert: KubernetesHpaUnderutilized
197
+ expr: max(quantile_over_time(0.5, kube_horizontalpodautoscaler_status_desired_replicas[1d]) == kube_horizontalpodautoscaler_spec_min_replicas) by (horizontalpodautoscaler) > 3
198
+ for: 0m
199
+ labels:
200
+ severity: info
201
+ annotations:
202
+ summary: Kubernetes HPA underutilized (instance {{ $labels.instance }})
203
+ description: |-
204
+ HPA {{ $labels.namespace }}/{{ $labels.horizontalpodautoscaler }} is constantly at minimum replicas for 50% of the time. Potential cost saving here.
205
+ VALUE = {{ $value }}
206
+ LABELS = {{ $labels }}
207
+ - alert: KubernetesPodNotHealthy
208
+ expr: sum by (namespace, pod) (kube_pod_status_phase{phase=~"Pending|Unknown|Failed"}) > 0
209
+ for: 15m
210
+ labels:
211
+ severity: critical
212
+ annotations:
213
+ summary: Kubernetes Pod not healthy ({{ $labels.namespace }}/{{ $labels.pod }})
214
+ description: |-
215
+ Pod {{ $labels.namespace }}/{{ $labels.pod }} has been in a non-running state for longer than 15 minutes.
216
+ VALUE = {{ $value }}
217
+ LABELS = {{ $labels }}
218
+ - alert: KubernetesPodCrashLooping
219
+ expr: increase(kube_pod_container_status_restarts_total[1m]) > 3
220
+ for: 2m
221
+ labels:
222
+ severity: warning
223
+ annotations:
224
+ summary: Kubernetes pod crash looping ({{ $labels.namespace }}/{{ $labels.pod }})
225
+ description: |-
226
+ Pod {{ $labels.namespace }}/{{ $labels.pod }} is crash looping
227
+ VALUE = {{ $value }}
228
+ LABELS = {{ $labels }}
229
+ - alert: KubernetesReplicasetReplicasMismatch
230
+ expr: kube_replicaset_spec_replicas != kube_replicaset_status_ready_replicas
231
+ for: 10m
232
+ labels:
233
+ severity: warning
234
+ annotations:
235
+ summary: Kubernetes ReplicasSet mismatch ({{ $labels.namespace }}/{{ $labels.replicaset }})
236
+ description: |-
237
+ ReplicaSet {{ $labels.namespace }}/{{ $labels.replicaset }} replicas mismatch
238
+ VALUE = {{ $value }}
239
+ LABELS = {{ $labels }}
240
+ - alert: KubernetesDeploymentReplicasMismatch
241
+ expr: kube_deployment_spec_replicas != kube_deployment_status_replicas_available
242
+ for: 10m
243
+ labels:
244
+ severity: warning
245
+ annotations:
246
+ summary: Kubernetes Deployment replicas mismatch ({{ $labels.namespace }}/{{ $labels.deployment }})
247
+ description: |-
248
+ Deployment {{ $labels.namespace }}/{{ $labels.deployment }} replicas mismatch
249
+ VALUE = {{ $value }}
250
+ LABELS = {{ $labels }}
251
+ - alert: KubernetesStatefulsetReplicasMismatch
252
+ expr: kube_statefulset_status_replicas_ready != kube_statefulset_status_replicas
253
+ for: 10m
254
+ labels:
255
+ severity: warning
256
+ annotations:
257
+ summary: Kubernetes StatefulSet replicas mismatch (instance {{ $labels.instance }})
258
+ description: |-
259
+ StatefulSet does not match the expected number of replicas.
260
+ VALUE = {{ $value }}
261
+ LABELS = {{ $labels }}
262
+ - alert: KubernetesDeploymentGenerationMismatch
263
+ expr: kube_deployment_status_observed_generation != kube_deployment_metadata_generation
264
+ for: 10m
265
+ labels:
266
+ severity: critical
267
+ annotations:
268
+ summary: Kubernetes Deployment generation mismatch ({{ $labels.namespace }}/{{ $labels.deployment }})
269
+ description: |-
270
+ Deployment {{ $labels.namespace }}/{{ $labels.deployment }} has failed but has not been rolled back.
271
+ VALUE = {{ $value }}
272
+ LABELS = {{ $labels }}
273
+ - alert: KubernetesStatefulsetGenerationMismatch
274
+ expr: kube_statefulset_status_observed_generation != kube_statefulset_metadata_generation
275
+ for: 10m
276
+ labels:
277
+ severity: critical
278
+ annotations:
279
+ summary: Kubernetes StatefulSet generation mismatch ({{ $labels.namespace }}/{{ $labels.statefulset }})
280
+ description: |-
281
+ StatefulSet {{ $labels.namespace }}/{{ $labels.statefulset }} has failed but has not been rolled back.
282
+ VALUE = {{ $value }}
283
+ LABELS = {{ $labels }}
284
+ - alert: KubernetesStatefulsetUpdateNotRolledOut
285
+ expr: max without (revision) (kube_statefulset_status_current_revision unless kube_statefulset_status_update_revision) * (kube_statefulset_replicas != kube_statefulset_status_replicas_updated)
286
+ for: 10m
287
+ labels:
288
+ severity: warning
289
+ annotations:
290
+ summary: Kubernetes StatefulSet update not rolled out ({{ $labels.namespace }}/{{ $labels.statefulset }})
291
+ description: |-
292
+ StatefulSet {{ $labels.namespace }}/{{ $labels.statefulset }} update has not been rolled out.
293
+ VALUE = {{ $value }}
294
+ LABELS = {{ $labels }}
295
+ - alert: KubernetesDaemonsetRolloutStuck
296
+ expr: kube_daemonset_status_number_ready / kube_daemonset_status_desired_number_scheduled * 100 < 100 or kube_daemonset_status_desired_number_scheduled - kube_daemonset_status_current_number_scheduled > 0
297
+ for: 10m
298
+ labels:
299
+ severity: warning
300
+ annotations:
301
+ summary: Kubernetes DaemonSet rollout stuck ({{ $labels.namespace }}/{{ $labels.daemonset }})
302
+ description: |-
303
+ Some Pods of DaemonSet {{ $labels.namespace }}/{{ $labels.daemonset }} are not scheduled or not ready
304
+ VALUE = {{ $value }}
305
+ LABELS = {{ $labels }}
306
+ - alert: KubernetesDaemonsetMisscheduled
307
+ expr: kube_daemonset_status_number_misscheduled > 0
308
+ for: 1m
309
+ labels:
310
+ severity: critical
311
+ annotations:
312
+ summary: Kubernetes DaemonSet misscheduled ({{ $labels.namespace }}/{{ $labels.daemonset }})
313
+ description: |-
314
+ Some Pods of DaemonSet {{ $labels.namespace }}/{{ $labels.daemonset }} are running where they are not supposed to run
315
+ VALUE = {{ $value }}
316
+ LABELS = {{ $labels }}
317
+ - alert: KubernetesCronjobTooLong
318
+ expr: time() - kube_cronjob_next_schedule_time > 3600
319
+ for: 0m
320
+ labels:
321
+ severity: warning
322
+ annotations:
323
+ summary: Kubernetes CronJob too long ({{ $labels.namespace }}/{{ $labels.cronjob }})
324
+ description: |-
325
+ CronJob {{ $labels.namespace }}/{{ $labels.cronjob }} is taking more than 1h to complete.
326
+ VALUE = {{ $value }}
327
+ LABELS = {{ $labels }}
328
+ - alert: KubernetesJobSlowCompletion
329
+ expr: kube_job_spec_completions - kube_job_status_succeeded - kube_job_status_failed > 0
330
+ for: 12h
331
+ labels:
332
+ severity: critical
333
+ annotations:
334
+ summary: Kubernetes job slow completion ({{ $labels.namespace }}/{{ $labels.job_name }})
335
+ description: |-
336
+ Kubernetes Job {{ $labels.namespace }}/{{ $labels.job_name }} did not complete in time.
337
+ VALUE = {{ $value }}
338
+ LABELS = {{ $labels }}
339
+ - alert: KubernetesApiServerErrors
340
+ expr: sum(rate(apiserver_request_total{job="apiserver",code=~"(?:5..)"}[1m])) by (instance, job) / sum(rate(apiserver_request_total{job="apiserver"}[1m])) by (instance, job) * 100 > 3
341
+ for: 2m
342
+ labels:
343
+ severity: critical
344
+ annotations:
345
+ summary: Kubernetes API server errors (instance {{ $labels.instance }})
346
+ description: |-
347
+ Kubernetes API server is experiencing high error rate
348
+ VALUE = {{ $value }}
349
+ LABELS = {{ $labels }}
350
+ - alert: KubernetesApiClientErrors
351
+ expr: (sum(rate(rest_client_requests_total{code=~"(4|5).."}[1m])) by (instance, job) / sum(rate(rest_client_requests_total[1m])) by (instance, job)) * 100 > 1
352
+ for: 2m
353
+ labels:
354
+ severity: critical
355
+ annotations:
356
+ summary: Kubernetes API client errors (instance {{ $labels.instance }})
357
+ description: |-
358
+ Kubernetes API client is experiencing high error rate
359
+ VALUE = {{ $value }}
360
+ LABELS = {{ $labels }}
361
+ - alert: KubernetesClientCertificateExpiresNextWeek
362
+ expr: apiserver_client_certificate_expiration_seconds_count{job="apiserver"} > 0 and histogram_quantile(0.01, sum by (job, le) (rate(apiserver_client_certificate_expiration_seconds_bucket{job="apiserver"}[5m]))) < 7*24*60*60
363
+ for: 0m
364
+ labels:
365
+ severity: warning
366
+ annotations:
367
+ summary: Kubernetes client certificate expires next week (instance {{ $labels.instance }})
368
+ description: |-
369
+ A client certificate used to authenticate to the apiserver is expiring next week.
370
+ VALUE = {{ $value }}
371
+ LABELS = {{ $labels }}
372
+ - alert: KubernetesClientCertificateExpiresSoon
373
+ expr: apiserver_client_certificate_expiration_seconds_count{job="apiserver"} > 0 and histogram_quantile(0.01, sum by (job, le) (rate(apiserver_client_certificate_expiration_seconds_bucket{job="apiserver"}[5m]))) < 24*60*60
374
+ for: 0m
375
+ labels:
376
+ severity: critical
377
+ annotations:
378
+ summary: Kubernetes client certificate expires soon (instance {{ $labels.instance }})
379
+ description: |-
380
+ A client certificate used to authenticate to the apiserver is expiring in less than 24.0 hours.
381
+ VALUE = {{ $value }}
382
+ LABELS = {{ $labels }}
383
+ - alert: KubernetesApiServerLatency
384
+ expr: histogram_quantile(0.99, sum(rate(apiserver_request_duration_seconds_bucket{verb!~"(?:CONNECT|WATCHLIST|WATCH|PROXY)"} [10m])) WITHOUT (subresource)) > 1
385
+ for: 2m
386
+ labels:
387
+ severity: warning
388
+ annotations:
389
+ summary: Kubernetes API server latency (instance {{ $labels.instance }})
390
+ description: |-
391
+ Kubernetes API server has a 99th percentile latency of {{ $value }} seconds for {{ $labels.verb }} {{ $labels.resource }}.
392
+ VALUE = {{ $value }}
393
+ LABELS = {{ $labels }}
@@ -14,7 +14,7 @@ schedules:
14
14
  app: "postgresql"
15
15
 
16
16
  elasticsearch:
17
- disabled: true
17
+ disabled: false
18
18
  schedule: "0 6 * * *"
19
19
  template:
20
20
  ttl: "720h"
package/src/k8cryo.sh ADDED
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+ #
3
+ # Usage: k8cryo <expiry days>
4
+ #
5
+ # Simple script for performing a full cluster backup with a specific expiry
6
+ # period. The default is 60 days.
7
+ #
8
+ . `build-tools --bashfun`
9
+
10
+ daysToKeep=${1:-60}
11
+ let hoursToKeep="$daysToKeep*24"
12
+ printf "\ncryo backup set to keep for $daysToKeep days / $hoursToKeep hours\n"
13
+
14
+ if [ "`basename $0`" == "k8thaw" ];
15
+ then
16
+ errorExit "k8thaw - UNDER CONSTRUCTION"
17
+ fi
18
+
19
+ # Gets the UTC time in the same format that velero schedules use for
20
+ # generating the Date Time Stamp for scheduled backups.
21
+ DTS="`date -u +\"%Y%m%d%H%M%S\"`"
22
+
23
+ printf "\nExecuting = > velero backup create velero-cryo-$DTS --ttl ${hoursToKeep}h\n"
24
+
25
+ velero backup create velero-cryo-$DTS --ttl ${hoursToKeep}h
package/src/overwhelm.mjs CHANGED
@@ -11,7 +11,6 @@ import cliArgs from 'command-line-args'
11
11
  // const cliHelp = require( 'command-line-usage' )
12
12
  import deepmerge from 'deepmerge'
13
13
  import { glob } from 'glob'
14
- import parse from 'parse-gitignore'
15
14
  import ask from 'readline-sync'
16
15
  import YAML from 'js-yaml'
17
16
 
@@ -20,6 +19,7 @@ import {
20
19
  disableDebug,
21
20
  err,
22
21
  errorExit,
22
+ getDirectories,
23
23
  isString,
24
24
  log,
25
25
  shellCmd,
@@ -280,12 +280,7 @@ if ( args.key ) {
280
280
  }
281
281
 
282
282
  // Find all of the potential target dirs. Utilize .gitignore to ignore files
283
- const gitignore = parse( fs.readFileSync( '.gitignore' ) )
284
- const opt = {
285
- ignore : gitignore.patterns,
286
- }
287
-
288
- const ahoy = glob.sync( '*/', opt )
283
+ const ahoy = getDirectories( process.cwd() )
289
284
 
290
285
  // Verifies that all values in a config block are quoted
291
286
  const validValuesLocalConfig = ( vlf ) => {