helm_upgrade_logs 0.1.7 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/exe/helm_upgrade_logs +17 -6
- data/lib/helm_upgrade_logs/version.rb +1 -1
- data/lib/helm_upgrade_logs.rb +14 -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: fa3f3a0b230ebece6f834e3f1d350f7dce7efdc38e9798f6e88e2c2ac2e4ebea
|
4
|
+
data.tar.gz: '09b2dc417d34ceada26ea29976dceab275d035c69da9fac86afbf613b2f239b1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b079a3c801b1cfc3ed7ebfe43b669e8845cf02bb2980e541e58fe1b049d4138e0cbb120a64099e97335bc95b0b98f2510a934299ff470251ebf56bf247cfbb3
|
7
|
+
data.tar.gz: 40d106a0b06352621fc90cfb8653fbc3f279d8676d438eeb592e6fa94a39bc896f8a690df4a6633654d410f9bae5600605790fbcd1bdbf33c95aa114d9403053
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
|
+
## [0.2.2] - 2022-04-20
|
2
|
+
|
3
|
+
- Wait for logs on each pod having a process for logging each pod
|
4
|
+
|
1
5
|
## [0.2.0] - 2022-04-20
|
2
6
|
|
7
|
+
- Monitoring pods don't filter managed by helm as some pods don't have that with selectorLabels
|
8
|
+
|
9
|
+
## [0.1.7] - 2022-04-20
|
10
|
+
|
3
11
|
- Monitor helm upgrade command and periodically reload getting logs when new pods appear
|
4
12
|
|
5
13
|
## [0.1.6] - 2022-04-17
|
data/exe/helm_upgrade_logs
CHANGED
@@ -15,17 +15,28 @@ service_pid = Process.spawn 'kubectl get services --watch-only=true'
|
|
15
15
|
wait_for_pod_to_log
|
16
16
|
|
17
17
|
@pods = []
|
18
|
+
@pod_pids = {}
|
18
19
|
|
19
20
|
while Process.waitpid(helm_pid, Process::WNOHANG) == nil do
|
20
21
|
pods = get_pods
|
21
22
|
if pods != @pods
|
22
23
|
@pods = pods
|
23
24
|
puts "[INFO] Pods: #{pods.join(',')}"
|
24
|
-
|
25
|
-
@
|
25
|
+
# Could change this each to Parallel.each
|
26
|
+
@pods.each do |pod|
|
27
|
+
if @pod_pids[pod].nil?
|
28
|
+
wait_for_specific_pod_to_log pod
|
29
|
+
log_pid = Process.spawn "kubectl logs #{pod} -f --all-containers --prefix --ignore-errors=true --timestamps=true"
|
30
|
+
@pod_pids[pod] = log_pid
|
31
|
+
end
|
32
|
+
end
|
26
33
|
end
|
27
|
-
sleep
|
34
|
+
sleep 1
|
28
35
|
end
|
29
|
-
|
30
|
-
|
31
|
-
|
36
|
+
`kill #{event_pid}`
|
37
|
+
`kill #{service_pid}`
|
38
|
+
@pod_pids.each do |pod, pid|
|
39
|
+
`kill #{pid}`
|
40
|
+
end
|
41
|
+
|
42
|
+
|
data/lib/helm_upgrade_logs.rb
CHANGED
@@ -24,8 +24,21 @@ def wait_for_pod_to_log
|
|
24
24
|
}
|
25
25
|
end
|
26
26
|
|
27
|
+
def wait_for_specific_pod_to_log(pod_name)
|
28
|
+
30.times {
|
29
|
+
sleep 1
|
30
|
+
stdout, stderr, _ = Open3.capture3 "kubectl logs #{pod_name}"
|
31
|
+
if stderr.empty? && !stdout.strip.empty?
|
32
|
+
puts "Pod #{pod_name} with logs found"
|
33
|
+
break
|
34
|
+
else
|
35
|
+
puts "Waiting for pod #{pod_name} logs: #{stderr}"
|
36
|
+
end
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
27
40
|
def get_pods
|
28
|
-
stdout, stderr, _ = Open3.capture3 "kubectl get pods -lapp.kubernetes.io/
|
41
|
+
stdout, stderr, _ = Open3.capture3 "kubectl get pods -lapp.kubernetes.io/instance=#{$release_name} -o name"
|
29
42
|
if stderr.empty?
|
30
43
|
stdout.lines.collect { |pod| pod.strip }
|
31
44
|
else
|