helm_upgrade_logs 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a29eb6e997adbed6f0efe098cbb272dfad2d134975caf54870e347de9346dae
4
- data.tar.gz: 0bedaf088081958db6cfe90271d6e0138ab217f4392fbadc4252edbb9ed6771a
3
+ metadata.gz: 198e9553eb5958f78a59b2da3c8636b42da196a6629b9be4b4280da05d148555
4
+ data.tar.gz: 5f2ad592198f5500a259fa90081a5ba20ea68193036432ce86f5437143e2cbb6
5
5
  SHA512:
6
- metadata.gz: 0db53c0194211e9b8dde1c1fc817d3f23d462549fd45e7c55adff91beab54e394ae623e36229065d40041fa6b2fa2fe29f8a9818f37ae62d55b96b4ec4dca1fd
7
- data.tar.gz: 332be004b62aac72c654948cab38ad0174a180614cdefa74afcc927d10b46172df947ed62dbc8179ef72ea088dbd075acfbf7cfc2122752e1c5247563ad4f6e1
6
+ metadata.gz: 11c316ff2bc6332d6be91f722a7143687d7b3dd8375cd6e58429f59384feff2bd0d30b71f49ebc8aaebf71ba6c979657624b6ae3690668c2a2f3b2c71ef069ca
7
+ data.tar.gz: c851df7d22c2a59d546129d0592cf5bb19d0881db7c07f75b03b64d9bc64e746b33c26fa6d8ea502d55e446c1600e5659ee441dcee1c4d05fbbf9fb86cbbded0
data/CHANGELOG.md CHANGED
@@ -1,6 +1,15 @@
1
+ ## [0.2.0] - 2022-04-20
2
+
3
+ - Monitoring pods don't filter managed by helm as some pods don't have that with selectorLabels
4
+
5
+ ## [0.1.7] - 2022-04-20
6
+
7
+ - Monitor helm upgrade command and periodically reload getting logs when new pods appear
8
+
1
9
  ## [0.1.6] - 2022-04-17
2
10
 
3
11
  - Add `helm_test_logs` exe to check logs during `helm test`
12
+ - Add `pod-running-timeout` of 300s to try and pick up logs that might take a while to appear
4
13
 
5
14
  ## [0.1.5] - 2022-04-16
6
15
 
@@ -13,9 +13,19 @@ event_pid = Process.spawn 'kubectl get events --watch-only=true'
13
13
  service_pid = Process.spawn 'kubectl get services --watch-only=true'
14
14
 
15
15
  wait_for_pod_to_log
16
- log_pid = Process.spawn "kubectl logs -lapp.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=#{$release_name} -f --all-containers --prefix --ignore-errors=true --max-log-requests=20 --timestamps=true"
17
16
 
18
- Process.wait helm_pid
19
- puts `kill #{log_pid}`
17
+ @pods = []
18
+
19
+ while Process.waitpid(helm_pid, Process::WNOHANG) == nil do
20
+ pods = get_pods
21
+ if pods != @pods
22
+ @pods = pods
23
+ puts "[INFO] Pods: #{pods.join(',')}"
24
+ puts `kill #{@log_pid}` if @log_pid
25
+ @log_pid = Process.spawn "kubectl logs -lapp.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=#{$release_name} -f --all-containers --prefix --ignore-errors=true --max-log-requests=20 --timestamps=true --since=0s"
26
+ end
27
+ sleep 2.5
28
+ end
29
+ puts `kill #{@log_pid}`
20
30
  puts `kill #{event_pid}`
21
31
  puts `kill #{service_pid}`
data/get_pods.rb ADDED
@@ -0,0 +1,7 @@
1
+ require 'open3'
2
+
3
+ $release_name = 'redis'
4
+ stdout, stderr, _ = Open3.capture3 "kubectl get pods -lapp.kubernetes.io/managed-by=Helm,app.kubernetes.io/instance=#{$release_name} -o name"
5
+ if stderr.empty?
6
+ puts stdout.lines.join(',')
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HelmUpgradeLogs
4
- VERSION = "0.1.5"
4
+ VERSION = "0.2.0"
5
5
  end
@@ -24,6 +24,15 @@ def wait_for_pod_to_log
24
24
  }
25
25
  end
26
26
 
27
+ def get_pods
28
+ stdout, stderr, _ = Open3.capture3 "kubectl get pods -lapp.kubernetes.io/instance=#{$release_name} -o name"
29
+ if stderr.empty?
30
+ stdout.lines.collect { |pod| pod.strip }
31
+ else
32
+ []
33
+ end
34
+ end
35
+
27
36
  module HelmUpgradeLogs
28
37
  class Error < StandardError; end
29
38
  # Your code goes here...
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: helm_upgrade_logs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Garratt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-16 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Basic wrapper around helm and kubectl to allow easy debugging of a helm
14
14
  release. All arguments after a usual helm upgrade are used as normal
@@ -41,6 +41,7 @@ files:
41
41
  - bin/start_kind.sh
42
42
  - exe/helm_test_logs
43
43
  - exe/helm_upgrade_logs
44
+ - get_pods.rb
44
45
  - helm_upgrade_logs.gemspec
45
46
  - lib/helm_upgrade_logs.rb
46
47
  - lib/helm_upgrade_logs/version.rb