kdep 0.1.1 → 0.1.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/kdep/cli.rb +1 -0
- data/lib/kdep/commands/dashboard.rb +90 -0
- data/lib/kdep/version.rb +1 -1
- data/lib/kdep.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f620c12b99201a4af72891b53fdcd3b7010eaaa2e4fb432641f773aba4e2e458
|
|
4
|
+
data.tar.gz: 9212d3acea5c983bc5ffbf798b0ed6d43109b9c0671dc3283a1d0b78b0c9a065
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54d3e14b88237caa4f43574d71f2fd5f628f94954c6c137855ef2445f6f25074da70074e182452aae140196259b379ae0aeef34620dc2d45b144be37a19c4063
|
|
7
|
+
data.tar.gz: 6fc3ba471c1ea1897063c30ec7d7900b5261516a63047bec7507d1177334ced7d73064818b824330876ade6255cda3cf2224422f90f4650134ce2db836f2c362
|
data/lib/kdep/cli.rb
CHANGED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
require "optparse"
|
|
2
|
+
|
|
3
|
+
module Kdep
|
|
4
|
+
module Commands
|
|
5
|
+
class Dashboard
|
|
6
|
+
def self.option_parser
|
|
7
|
+
OptionParser.new do |opts|
|
|
8
|
+
opts.banner = "Usage: kdep dashboard [deploy]"
|
|
9
|
+
opts.separator ""
|
|
10
|
+
opts.separator "Launch TUI dashboard for live cluster monitoring."
|
|
11
|
+
opts.separator "Shows rollout status, logs, resources, and health panels."
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def initialize(global_options:, command_options:, args:)
|
|
16
|
+
@global_options = global_options
|
|
17
|
+
@command_options = command_options
|
|
18
|
+
@args = args
|
|
19
|
+
@ui = Kdep::UI.new(color: false)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def execute
|
|
23
|
+
deploy_name = @args[0]
|
|
24
|
+
|
|
25
|
+
# Discover kdep/ directory
|
|
26
|
+
discovery = Kdep::Discovery.new
|
|
27
|
+
kdep_dir = discovery.find_kdep_dir
|
|
28
|
+
unless kdep_dir
|
|
29
|
+
@ui.error("No kdep/ directory found")
|
|
30
|
+
exit 1
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Resolve deploy directory
|
|
34
|
+
deploy_dir = resolve_deploy_dir(kdep_dir, deploy_name, discovery)
|
|
35
|
+
unless deploy_dir
|
|
36
|
+
exit 1
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Load config (nil env -- dashboard monitors live state)
|
|
40
|
+
config = Kdep::Config.new(deploy_dir, nil).load
|
|
41
|
+
|
|
42
|
+
# Validate context before any cluster operation
|
|
43
|
+
begin
|
|
44
|
+
Kdep::ContextGuard.new(config["context"]).validate!
|
|
45
|
+
rescue Kdep::Kubectl::Error => e
|
|
46
|
+
@ui.error(e.message)
|
|
47
|
+
exit 1
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Launch TUI dashboard
|
|
51
|
+
image = config["image"] || config["name"]
|
|
52
|
+
dashboard = Kdep::Dashboard.new(
|
|
53
|
+
"name" => config["name"],
|
|
54
|
+
"namespace" => config["namespace"] || "default",
|
|
55
|
+
"registry" => config["registry"],
|
|
56
|
+
"image" => image
|
|
57
|
+
)
|
|
58
|
+
dashboard.run
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
def resolve_deploy_dir(kdep_dir, deploy_name, discovery)
|
|
64
|
+
if deploy_name
|
|
65
|
+
deploy_dir = File.join(kdep_dir, deploy_name)
|
|
66
|
+
unless File.directory?(deploy_dir)
|
|
67
|
+
@ui.error("Deploy target not found: #{deploy_name}")
|
|
68
|
+
deploys = discovery.find_deploys
|
|
69
|
+
if deploys.any?
|
|
70
|
+
@ui.info("Available deploys: #{deploys.join(', ')}")
|
|
71
|
+
end
|
|
72
|
+
return nil
|
|
73
|
+
end
|
|
74
|
+
deploy_dir
|
|
75
|
+
else
|
|
76
|
+
deploys = discovery.find_deploys
|
|
77
|
+
if deploys.length == 1
|
|
78
|
+
File.join(kdep_dir, deploys[0])
|
|
79
|
+
elsif deploys.length > 1
|
|
80
|
+
@ui.error("Multiple deploys found, specify one: #{deploys.join(', ')}")
|
|
81
|
+
nil
|
|
82
|
+
else
|
|
83
|
+
@ui.error("No deploy targets found in kdep/")
|
|
84
|
+
nil
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
data/lib/kdep/version.rb
CHANGED
data/lib/kdep.rb
CHANGED
|
@@ -30,6 +30,7 @@ require "kdep/commands/sh"
|
|
|
30
30
|
require "kdep/commands/restart"
|
|
31
31
|
require "kdep/commands/scale"
|
|
32
32
|
require "kdep/commands/migrate"
|
|
33
|
+
require "kdep/commands/dashboard"
|
|
33
34
|
require "kdep/dashboard/screen"
|
|
34
35
|
require "kdep/dashboard/layout"
|
|
35
36
|
require "kdep/dashboard/panel"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kdep
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Leadfy
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
19
|
+
version: '0'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
26
|
+
version: '0'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: minitest
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -68,6 +68,7 @@ files:
|
|
|
68
68
|
- lib/kdep/commands/apply.rb
|
|
69
69
|
- lib/kdep/commands/build.rb
|
|
70
70
|
- lib/kdep/commands/bump.rb
|
|
71
|
+
- lib/kdep/commands/dashboard.rb
|
|
71
72
|
- lib/kdep/commands/diff.rb
|
|
72
73
|
- lib/kdep/commands/eject.rb
|
|
73
74
|
- lib/kdep/commands/init.rb
|