captive-log-utils 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/lib/captive/log_utils/process_label.rb +15 -1
- data/lib/captive/log_utils/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71d1493895a6f2dbd3bfb1d694cbd7046ba19865c473238f032696bc5062c11d
|
|
4
|
+
data.tar.gz: 78b9dd2b34bc78ca68ca9de08ca0fe455e0d5530020fbd6930828c0621635e25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 193751f0aa3358fddab79d3c00e875df4dfdf0a948ccdcb42de9b643f43ae28b647f6800918b2e02d9647fb4c27d8251310943ee33e951ceb09d08bd92545df7
|
|
7
|
+
data.tar.gz: c8d66118cc7aed036d67155e38e876b403312f9828c1c0b81cd7132d5ff466ebc8dfe5b2d888f51fb0c3563999116b4e286882014256f450ce8c3023a7244949
|
|
@@ -5,6 +5,15 @@ module Captive
|
|
|
5
5
|
module ProcessLabel
|
|
6
6
|
POD_SUFFIX_RE = /-[a-z0-9]{5,10}-[a-z0-9]{5}\z/
|
|
7
7
|
|
|
8
|
+
# Familles de pods dont plusieurs variantes de nommage doivent être
|
|
9
|
+
# regroupées sous un même label (ex. les pods de données redis-N et
|
|
10
|
+
# les pods sentinel redis-sentinel-sentinel-N appartiennent tous les
|
|
11
|
+
# deux au groupe "redis"). Ajouter une famille ici plutôt que de
|
|
12
|
+
# complexifier .for quand un nouveau cas apparaît.
|
|
13
|
+
GROUPS = {
|
|
14
|
+
"redis" => [ /\Aredis-\d+\z/, /\Aredis-sentinel-sentinel-\d+\z/ ],
|
|
15
|
+
}.freeze
|
|
16
|
+
|
|
8
17
|
# Dérive un label court depuis le nom du pod.
|
|
9
18
|
#
|
|
10
19
|
# container: quand fourni et différent de namespace, retourné tel quel
|
|
@@ -20,8 +29,13 @@ module Captive
|
|
|
20
29
|
return "web" if base == namespace
|
|
21
30
|
|
|
22
31
|
label = base.delete_prefix("#{namespace}-")
|
|
23
|
-
label
|
|
32
|
+
group_for(label) || label
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.group_for(label)
|
|
36
|
+
GROUPS.find { |_, patterns| patterns.any? { |pattern| pattern.match?(label) } }&.first
|
|
24
37
|
end
|
|
38
|
+
private_class_method :group_for
|
|
25
39
|
end
|
|
26
40
|
end
|
|
27
41
|
end
|