Class: Kdep::Commands::Dashboard
- Inherits:
-
Object
- Object
- Kdep::Commands::Dashboard
- Defined in:
- lib/kdep/commands/dashboard.rb
Class Method Summary collapse
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(global_options:, command_options:, args:) ⇒ Dashboard
constructor
A new instance of Dashboard.
Constructor Details
#initialize(global_options:, command_options:, args:) ⇒ Dashboard
Returns a new instance of Dashboard.
15 16 17 18 19 20 |
# File 'lib/kdep/commands/dashboard.rb', line 15 def initialize(global_options:, command_options:, args:) @global_options = @command_options = @args = args @ui = Kdep::UI.new(color: false) end |
Class Method Details
.option_parser ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/kdep/commands/dashboard.rb', line 6 def self.option_parser OptionParser.new do |opts| opts. = "Usage: kdep dashboard [deploy]" opts.separator "" opts.separator "Launch TUI dashboard for live cluster monitoring." opts.separator "Shows rollout status, logs, resources, and health panels." end end |
Instance Method Details
#execute ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/kdep/commands/dashboard.rb', line 22 def execute deploy_name = @args[0] # Discover kdep/ directory discovery = Kdep::Discovery.new kdep_dir = discovery.find_kdep_dir unless kdep_dir @ui.error("No kdep/ directory found") exit 1 end # Resolve deploy directory deploy_dir = resolve_deploy_dir(kdep_dir, deploy_name, discovery) unless deploy_dir exit 1 end # Load config (nil env -- dashboard monitors live state) config = Kdep::Config.new(deploy_dir, nil).load # Validate context before any cluster operation begin Kdep::ContextGuard.new(config["context"]).validate! rescue Kdep::Kubectl::Error => e @ui.error(e.) exit 1 end # Launch TUI dashboard image = config["image"] || config["name"] dashboard = Kdep::Dashboard.new( "name" => config["name"], "namespace" => config["namespace"] || "default", "registry" => config["registry"], "image" => image ) dashboard.run end |