kontena-cli 1.1.6 → 1.2.0.dev1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/VERSION +1 -1
  4. data/bin/kontena +8 -28
  5. data/kontena-cli.gemspec +2 -2
  6. data/lib/kontena/cli/app_command.rb +14 -27
  7. data/lib/kontena/cli/certificate_command.rb +4 -7
  8. data/lib/kontena/cli/cloud/master_command.rb +5 -12
  9. data/lib/kontena/cli/cloud_command.rb +4 -7
  10. data/lib/kontena/cli/container_command.rb +4 -9
  11. data/lib/kontena/cli/etcd/health_command.rb +1 -0
  12. data/lib/kontena/cli/etcd_command.rb +6 -13
  13. data/lib/kontena/cli/external_registry_command.rb +3 -7
  14. data/lib/kontena/cli/grid_command.rb +14 -29
  15. data/lib/kontena/cli/grids/cloud_config_command.rb +1 -0
  16. data/lib/kontena/cli/grids/common.rb +2 -0
  17. data/lib/kontena/cli/grids/create_command.rb +5 -0
  18. data/lib/kontena/cli/grids/trusted_subnet_command.rb +6 -8
  19. data/lib/kontena/cli/grids/user_command.rb +3 -6
  20. data/lib/kontena/cli/master/config_command.rb +6 -12
  21. data/lib/kontena/cli/master/token_command.rb +6 -11
  22. data/lib/kontena/cli/master/users/role_command.rb +2 -4
  23. data/lib/kontena/cli/master/users_command.rb +4 -8
  24. data/lib/kontena/cli/master_command.rb +14 -33
  25. data/lib/kontena/cli/node_command.rb +7 -15
  26. data/lib/kontena/cli/nodes/health_command.rb +1 -1
  27. data/lib/kontena/cli/nodes/label_command.rb +3 -9
  28. data/lib/kontena/cli/nodes/show_command.rb +1 -1
  29. data/lib/kontena/cli/nodes/ssh_command.rb +13 -4
  30. data/lib/kontena/cli/plugin_command.rb +5 -9
  31. data/lib/kontena/cli/registry_command.rb +2 -5
  32. data/lib/kontena/cli/service_command.rb +22 -45
  33. data/lib/kontena/cli/services/container_command.rb +2 -3
  34. data/lib/kontena/cli/services/env_command.rb +3 -6
  35. data/lib/kontena/cli/services/secret_command.rb +2 -4
  36. data/lib/kontena/cli/stack_command.rb +11 -24
  37. data/lib/kontena/cli/stacks/registry_command.rb +5 -12
  38. data/lib/kontena/cli/stacks/upgrade_command.rb +6 -0
  39. data/lib/kontena/cli/stacks/yaml/reader.rb +17 -2
  40. data/lib/kontena/cli/subcommand_loader.rb +82 -0
  41. data/lib/kontena/cli/vault_command.rb +7 -15
  42. data/lib/kontena/cli/version.rb +6 -1
  43. data/lib/kontena/cli/vpn_command.rb +3 -7
  44. data/lib/kontena/command.rb +28 -1
  45. data/lib/kontena/machine/cloud_config/cloudinit.yml +1 -1
  46. data/lib/kontena/main_command.rb +22 -38
  47. data/lib/kontena/scripts/completer +2 -233
  48. data/lib/kontena/scripts/completer.rb +230 -0
  49. data/lib/kontena/scripts/init +5 -8
  50. data/lib/kontena/scripts/kontena.bash +8 -0
  51. data/lib/kontena/scripts/kontena.zsh +11 -0
  52. data/lib/kontena_cli.rb +9 -1
  53. data/omnibus/wrappers/sh/kontena +1 -1
  54. data/spec/fixtures/stack-with-liquid-optional.yml +14 -0
  55. data/spec/fixtures/stack-with-liquid-undefined.yml +12 -0
  56. data/spec/kontena/cli/app/build_command_spec.rb +1 -2
  57. data/spec/kontena/cli/app/common_spec.rb +1 -2
  58. data/spec/kontena/cli/app/config_command_spec.rb +0 -1
  59. data/spec/kontena/cli/app/deploy_command_spec.rb +2 -3
  60. data/spec/kontena/cli/app/docker_helper_spec.rb +0 -1
  61. data/spec/kontena/cli/app/init_command_spec.rb +0 -1
  62. data/spec/kontena/cli/app/logs_command_spec.rb +0 -1
  63. data/spec/kontena/cli/app/scale_spec.rb +2 -3
  64. data/spec/kontena/cli/app/service_generator_spec.rb +1 -2
  65. data/spec/kontena/cli/app/service_generator_v2_spec.rb +0 -1
  66. data/spec/kontena/cli/app/yaml/reader_spec.rb +0 -1
  67. data/spec/kontena/cli/app/yaml/service_extender_spec.rb +0 -1
  68. data/spec/kontena/cli/app/yaml/validator_spec.rb +0 -1
  69. data/spec/kontena/cli/app/yaml/validator_v2_spec.rb +0 -1
  70. data/spec/kontena/cli/cloud/login_command_spec.rb +0 -1
  71. data/spec/kontena/cli/cloud/logout_command_spec.rb +0 -1
  72. data/spec/kontena/cli/cloud/master/add_command_spec.rb +0 -1
  73. data/spec/kontena/cli/common_spec.rb +0 -1
  74. data/spec/kontena/cli/containers/list_command_spec.rb +0 -1
  75. data/spec/kontena/cli/containers/logs_command_spec.rb +0 -1
  76. data/spec/kontena/cli/etcd/health_command_spec.rb +2 -0
  77. data/spec/kontena/cli/grids/trusted_subnets/add_command_spec.rb +0 -11
  78. data/spec/kontena/cli/grids/trusted_subnets/list_command_spec.rb +4 -13
  79. data/spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb +0 -11
  80. data/spec/kontena/cli/grids/use_command_spec.rb +0 -1
  81. data/spec/kontena/cli/helpers/log_helper_spec.rb +0 -1
  82. data/spec/kontena/cli/main_command_spec.rb +2 -3
  83. data/spec/kontena/cli/master/current_command_spec.rb +5 -15
  84. data/spec/kontena/cli/master/init_cloud_command_spec.rb +0 -1
  85. data/spec/kontena/cli/master/login_command_spec.rb +0 -1
  86. data/spec/kontena/cli/master/logout_command_spec.rb +0 -1
  87. data/spec/kontena/cli/master/use_command_spec.rb +0 -1
  88. data/spec/kontena/cli/master/users/invite_command_spec.rb +1 -5
  89. data/spec/kontena/cli/master/users/remove_command_spec.rb +2 -14
  90. data/spec/kontena/cli/master/users/roles/add_command_spec.rb +0 -1
  91. data/spec/kontena/cli/master/users/roles/remove_command_spec.rb +0 -1
  92. data/spec/kontena/cli/nodes/list_command_spec.rb +2 -0
  93. data/spec/kontena/cli/services/containers_command_spec.rb +0 -18
  94. data/spec/kontena/cli/services/exec_command_spec.rb +6 -4
  95. data/spec/kontena/cli/services/link_command_spec.rb +5 -19
  96. data/spec/kontena/cli/services/restart_command_spec.rb +0 -16
  97. data/spec/kontena/cli/services/secrets/link_command_spec.rb +0 -11
  98. data/spec/kontena/cli/services/secrets/unlink_command_spec.rb +1 -12
  99. data/spec/kontena/cli/services/services_helper_spec.rb +0 -1
  100. data/spec/kontena/cli/services/unlink_command_spec.rb +7 -21
  101. data/spec/kontena/cli/services/update_command_spec.rb +0 -15
  102. data/spec/kontena/cli/stacks/build_command_spec.rb +0 -1
  103. data/spec/kontena/cli/stacks/deploy_command_spec.rb +10 -13
  104. data/spec/kontena/cli/stacks/install_command_spec.rb +0 -15
  105. data/spec/kontena/cli/stacks/list_command_spec.rb +4 -10
  106. data/spec/kontena/cli/stacks/remove_command_spec.rb +1 -16
  107. data/spec/kontena/cli/stacks/service_generator_spec.rb +0 -1
  108. data/spec/kontena/cli/stacks/service_generator_v2_spec.rb +0 -1
  109. data/spec/kontena/cli/stacks/show_command_spec.rb +1 -14
  110. data/spec/kontena/cli/stacks/upgrade_command_spec.rb +19 -1
  111. data/spec/kontena/cli/stacks/yaml/reader_spec.rb +163 -130
  112. data/spec/kontena/cli/stacks/yaml/service_extender_spec.rb +0 -1
  113. data/spec/kontena/cli/stacks/yaml/validator_v3_spec.rb +0 -1
  114. data/spec/kontena/cli/vault/export_spec.rb +0 -1
  115. data/spec/kontena/cli/vault/import_spec.rb +4 -5
  116. data/spec/kontena/cli/version_command_spec.rb +8 -6
  117. data/spec/kontena/cli/vpn/create_command_spec.rb +3 -4
  118. data/spec/kontena/client_spec.rb +0 -1
  119. data/spec/kontena/config_spec.rb +0 -1
  120. data/spec/kontena/kontena_cli_spec.rb +1 -1
  121. data/spec/kontena/main_command_spec.rb +0 -1
  122. data/spec/kontena/plugin_manager_spec.rb +0 -1
  123. data/spec/spec_helper.rb +1 -0
  124. data/spec/support/client_helpers.rb +1 -1
  125. data/spec/support/exit_with_error_helper.rb +36 -0
  126. data/spec/support/fixtures_helpers.rb +5 -2
  127. metadata +18 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ecda24ff9a2d6ed676a8c3f50081412288eb271
4
- data.tar.gz: e7b334ee55e01ba10452dc3d26c964792966852e
3
+ metadata.gz: 1bb3a720a442f0537a388e074fc06d2deca0fe61
4
+ data.tar.gz: abb0c04c02d70ea872693f70f972d26c06519fb7
5
5
  SHA512:
6
- metadata.gz: 6caea8765e6bd335b2366b565bf28de0e39ce200d44b82060bf5fa0eb1649b42c061bb8f3076689dd087c82cd50a6b21ccacade225400988f1d10e81f5420c34
7
- data.tar.gz: be3d483b5e26f41ce6457df18a73a35e371489e3334bf3e6cc961709814bc5eac84def0de1789ee760b827a0a3b1b54967ea3cf06e6fc9f65f0a2f01b858caf8
6
+ metadata.gz: e6c457fe87e24961e71867cfdf13b03bbd0b342f51d78ecaf84a1d67d61aaa55bdba02d3005604dbf92bb55db4e1a64583a396bb232703af8d96b2877c961e62
7
+ data.tar.gz: 6d6502e6101bc887c366b4bdb49ac93480bf83ac23c8d411d9b294a95ce5835f9fa375b925a718653a4c06d76ca024e42a1bf2fea3042aa5fca3258757659670
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.6
1
+ 1.2.0.dev1
data/bin/kontena CHANGED
@@ -1,38 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
  # encoding: UTF-8
3
3
 
4
- # resolve bin path, ignoring symlinks
4
+ # add lib to libpath (only needed when running from the sources)
5
5
  require 'pathname'
6
- bin_file = Pathname.new(__FILE__).realpath
6
+ lib_path = File.expand_path('../../lib', Pathname.new(__FILE__).realpath)
7
+ $:.unshift lib_path unless $:.include?(lib_path)
7
8
 
8
- # add self to libpath
9
- $:.unshift File.expand_path('../../lib', bin_file)
10
-
11
- require 'kontena_cli'
12
9
  STDOUT.sync = true
13
10
 
14
- begin
11
+ if ARGV[0] == 'complete'
12
+ ARGV.delete_at(0)
13
+ require 'kontena/scripts/completer'
14
+ else
15
+ require 'kontena_cli'
15
16
  Kontena::PluginManager.instance.init
16
17
  Kontena::MainCommand.run
17
- rescue Excon::Errors::SocketError => exc
18
- if exc.message.include?('Unable to verify certificate')
19
- $stderr.puts " [#{Kontena.pastel.red('error')}] The server uses a certificate signed by an unknown authority."
20
- $stderr.puts " You can trust this server by copying server CA pem file to: #{Kontena.pastel.yellow("~/.kontena/certs/<hostname>.pem")}"
21
- $stderr.puts " Protip: you can bypass the certificate check by setting #{Kontena.pastel.yellow('SSL_IGNORE_ERRORS=true')} env variable, but any data you send to the server could be intercepted by others."
22
- abort
23
- else
24
- abort(exc.message)
25
- end
26
- rescue Kontena::Errors::StandardError => exc
27
- raise exc if ENV['DEBUG']
28
- $stderr.puts " [#{Kontena.pastel.red('error')}] #{exc.message}"
29
- abort
30
- rescue Errno::EPIPE
31
- # If user is piping the command outputs to some other command that might exit before CLI has outputted everything
32
- abort
33
- rescue => exc
34
- raise exc if ENV['DEBUG']
35
- $stderr.puts " [#{Kontena.pastel.red('error')}] #{exc.message}"
36
- $stderr.puts " Rerun the command with environment DEBUG=true set to get the full exception"
37
- abort
38
18
  end
data/kontena-cli.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Kontena, Inc"]
10
10
  spec.email = ["info@kontena.io"]
11
11
  spec.summary = %q{Kontena command line tool}
12
- spec.description = %q{Kontena command line tool}
12
+ spec.description = %q{Command-line client for the Kontena container and microservices platform}
13
13
  spec.homepage = "https://www.kontena.io"
14
14
  spec.license = "Apache-2.0"
15
15
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.7"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_runtime_dependency "excon", "~> 0.49.0"
26
- spec.add_runtime_dependency "tty-prompt", "~> 0.10"
26
+ spec.add_runtime_dependency "tty-prompt", "~> 0.11.0"
27
27
  spec.add_runtime_dependency "clamp", "~> 1.1.0"
28
28
  spec.add_runtime_dependency "ruby_dig", "~> 0.0.2"
29
29
  spec.add_runtime_dependency "launchy", "~> 2.4.3"
@@ -1,33 +1,20 @@
1
- require_relative 'apps/init_command'
2
- require_relative 'apps/build_command'
3
- require_relative 'apps/config_command'
4
- require_relative 'apps/deploy_command'
5
- require_relative 'apps/start_command'
6
- require_relative 'apps/stop_command'
7
- require_relative 'apps/restart_command'
8
- require_relative 'apps/remove_command'
9
- require_relative 'apps/list_command'
10
- require_relative 'apps/logs_command'
11
- require_relative 'apps/monitor_command'
12
- require_relative 'apps/show_command'
13
- require_relative 'apps/scale_command'
14
1
 
15
2
  class Kontena::Cli::AppCommand < Kontena::Command
16
3
 
17
- subcommand "init", "Init Kontena application", Kontena::Cli::Apps::InitCommand
18
- subcommand "build", "Build Kontena services", Kontena::Cli::Apps::BuildCommand
19
- subcommand "config", "View service configurations", Kontena::Cli::Apps::ConfigCommand
20
- subcommand "deploy", "Deploy Kontena services", Kontena::Cli::Apps::DeployCommand
21
- subcommand "scale", "Scale services", Kontena::Cli::Apps::ScaleCommand
22
- subcommand "start", "Start services", Kontena::Cli::Apps::StartCommand
23
- subcommand "stop", "Stop services", Kontena::Cli::Apps::StopCommand
24
- subcommand "restart", "Restart services", Kontena::Cli::Apps::RestartCommand
25
- subcommand "show", "Show service details", Kontena::Cli::Apps::ShowCommand
26
- subcommand ["ps", "list", "ls"], "List services", Kontena::Cli::Apps::ListCommand
27
- subcommand ["logs"], "Show service logs", Kontena::Cli::Apps::LogsCommand
28
- subcommand "monitor", "Monitor services", Kontena::Cli::Apps::MonitorCommand
29
- subcommand ["remove","rm"], "Remove services", Kontena::Cli::Apps::RemoveCommand
4
+ subcommand "init", "Init Kontena application", load_subcommand('apps/init_command')
5
+ subcommand "build", "Build Kontena services", load_subcommand('apps/build_command')
6
+ subcommand "config", "View service configurations", load_subcommand('apps/config_command')
7
+ subcommand "deploy", "Deploy Kontena services", load_subcommand('apps/deploy_command')
8
+ subcommand "scale", "Scale services", load_subcommand('apps/scale_command')
9
+ subcommand "start", "Start services", load_subcommand('apps/start_command')
10
+ subcommand "stop", "Stop services", load_subcommand('apps/stop_command')
11
+ subcommand "restart", "Restart services", load_subcommand('apps/restart_command')
12
+ subcommand "show", "Show service details", load_subcommand('apps/show_command')
13
+ subcommand ["ps", "list", "ls"], "List services", load_subcommand('apps/list_command')
14
+ subcommand ["logs"], "Show service logs", load_subcommand('apps/logs_command')
15
+ subcommand "monitor", "Monitor services", load_subcommand('apps/monitor_command')
16
+ subcommand ["remove","rm"], "Remove services", load_subcommand('apps/remove_command')
30
17
 
31
18
  def execute
32
19
  end
33
- end
20
+ end
@@ -1,14 +1,11 @@
1
- require_relative 'certificate/register_command'
2
- require_relative 'certificate/authorize_command'
3
- require_relative 'certificate/get_command'
4
1
 
5
2
  class Kontena::Cli::CertificateCommand < Kontena::Command
6
3
 
7
4
 
8
- subcommand "register", "Register to LetsEncrypt", Kontena::Cli::Certificate::RegisterCommand
9
- subcommand "authorize", "Create DNS authorization for domain", Kontena::Cli::Certificate::AuthorizeCommand
10
- subcommand "get", "Get certificate for domain", Kontena::Cli::Certificate::GetCommand
5
+ subcommand "register", "Register to LetsEncrypt", load_subcommand('certificate/register_command')
6
+ subcommand "authorize", "Create DNS authorization for domain", load_subcommand('certificate/authorize_command')
7
+ subcommand "get", "Get certificate for domain", load_subcommand('certificate/get_command')
11
8
 
12
9
  def execute
13
10
  end
14
- end
11
+ end
@@ -1,21 +1,14 @@
1
- require_relative 'master/add_command'
2
- require_relative 'master/list_command'
3
- require_relative 'master/remove_command'
4
- require_relative 'master/update_command'
5
- require_relative 'master/show_command'
6
-
7
1
  module Kontena::Cli::Cloud
8
2
  class MasterCommand < Kontena::Command
9
3
  include Kontena::Cli::Common
10
4
 
11
- subcommand ['list', 'ls'], "List masters in Kontena Cloud", Kontena::Cli::Cloud::Master::ListCommand
12
- subcommand ['remove', 'rm'], "Remove a master registration from Kontena Cloud", Kontena::Cli::Cloud::Master::RemoveCommand
13
- subcommand "add", "Register a master in Kontena Cloud", Kontena::Cli::Cloud::Master::AddCommand
14
- subcommand "show", "Show master settings in Kontena Cloud", Kontena::Cli::Cloud::Master::ShowCommand
15
- subcommand "update", "Update master settings in Kontena Cloud", Kontena::Cli::Cloud::Master::UpdateCommand
5
+ subcommand ['list', 'ls'], "List masters in Kontena Cloud", load_subcommand('cloud/master/list_command')
6
+ subcommand "add", "Register a master in Kontena Cloud", load_subcommand('cloud/master/add_command')
7
+ subcommand ['remove', 'rm'], "Remove a master registration from Kontena Cloud", load_subcommand('cloud/master/remove_command')
8
+ subcommand "show", "Show master settings in Kontena Cloud", load_subcommand('cloud/master/show_command')
9
+ subcommand "update", "Update master settings in Kontena Cloud", load_subcommand('cloud/master/update_command')
16
10
 
17
11
  def execute
18
12
  end
19
13
  end
20
14
  end
21
-
@@ -1,12 +1,9 @@
1
- require_relative 'cloud/login_command'
2
- require_relative 'cloud/logout_command'
3
- require_relative 'cloud/master_command'
4
1
 
5
2
  class Kontena::Cli::CloudCommand < Kontena::Command
6
- subcommand "login", "Authenticate to Kontena Cloud", Kontena::Cli::Cloud::LoginCommand
7
- subcommand "logout", "Logout from Kontena Cloud", Kontena::Cli::Cloud::LogoutCommand
8
- subcommand "master", "Master specific commands", Kontena::Cli::Cloud::MasterCommand
3
+ subcommand "login", "Authenticate to Kontena Cloud", load_subcommand('cloud/login_command')
4
+ subcommand "logout", "Logout from Kontena Cloud", load_subcommand('cloud/logout_command')
5
+ subcommand "master", "Master specific commands", load_subcommand('cloud/master_command')
9
6
 
10
7
  def execute
11
8
  end
12
- end
9
+ end
@@ -1,14 +1,9 @@
1
- require_relative 'containers/list_command'
2
- require_relative 'containers/exec_command'
3
- require_relative 'containers/inspect_command'
4
- require_relative 'containers/logs_command'
5
-
6
1
  class Kontena::Cli::ContainerCommand < Kontena::Command
7
2
 
8
- subcommand ["list", "ls"], "List grid containers", Kontena::Cli::Containers::ListCommand
9
- subcommand "exec", "Execute command inside a container", Kontena::Cli::Containers::ExecCommand
10
- subcommand "inspect", "Inspect the container", Kontena::Cli::Containers::InspectCommand
11
- subcommand "logs", "Show container logs", Kontena::Cli::Containers::LogsCommand
3
+ subcommand ["list", "ls"], "List grid containers", load_subcommand('containers/list_command')
4
+ subcommand "exec", "Execute command inside a container", load_subcommand('containers/exec_command')
5
+ subcommand "inspect", "Inspect the container", load_subcommand('containers/inspect_command')
6
+ subcommand "logs", "Show container logs", load_subcommand('containers/logs_command')
12
7
 
13
8
  def execute
14
9
  end
@@ -1,4 +1,5 @@
1
1
  require_relative 'common'
2
+ require 'kontena/cli/helpers/health_helper'
2
3
 
3
4
  module Kontena::Cli::Etcd
4
5
  class HealthCommand < Kontena::Command
@@ -1,18 +1,11 @@
1
- require_relative 'etcd/get_command'
2
- require_relative 'etcd/set_command'
3
- require_relative 'etcd/mkdir_command'
4
- require_relative 'etcd/list_command'
5
- require_relative 'etcd/remove_command'
6
- require_relative 'etcd/health_command'
7
-
8
1
  class Kontena::Cli::EtcdCommand < Kontena::Command
9
2
 
10
- subcommand "get", "Get the current value for a single key", Kontena::Cli::Etcd::GetCommand
11
- subcommand "set", "Set a value on the specified key", Kontena::Cli::Etcd::SetCommand
12
- subcommand ["mkdir", "mk"], "Create a directory", Kontena::Cli::Etcd::MkdirCommand
13
- subcommand ["list", "ls"], "List a directory", Kontena::Cli::Etcd::ListCommand
14
- subcommand "rm", "Remove a key or a directory", Kontena::Cli::Etcd::RemoveCommand
15
- subcommand "health", "Check etcd health", Kontena::Cli::Etcd::HealthCommand
3
+ subcommand "get", "Get the current value for a single key", load_subcommand('etcd/get_command')
4
+ subcommand "set", "Set a value on the specified key", load_subcommand('etcd/set_command')
5
+ subcommand ["mkdir", "mk"], "Create a directory", load_subcommand('etcd/mkdir_command')
6
+ subcommand ["list", "ls"], "List a directory", load_subcommand('etcd/list_command')
7
+ subcommand "rm", "Remove a key or a directory", load_subcommand('etcd/remove_command')
8
+ subcommand "health", "Check etcd health", load_subcommand('etcd/health_command')
16
9
 
17
10
  def execute
18
11
  end
@@ -1,12 +1,8 @@
1
- require_relative 'external_registries/add_command'
2
- require_relative 'external_registries/list_command'
3
- require_relative 'external_registries/remove_command'
4
-
5
1
  class Kontena::Cli::ExternalRegistryCommand < Kontena::Command
6
2
 
7
- subcommand "add", "Add external Docker image registry", Kontena::Cli::ExternalRegistries::AddCommand
8
- subcommand ["list", "ls"], "List external Docker image registries", Kontena::Cli::ExternalRegistries::ListCommand
9
- subcommand ["remove", "rm"], "Remove external Docker image registry", Kontena::Cli::ExternalRegistries::RemoveCommand
3
+ subcommand "add", "Add external Docker image registry", load_subcommand('external_registries/add_command')
4
+ subcommand ["list", "ls"], "List external Docker image registries", load_subcommand('external_registries/list_command')
5
+ subcommand ["remove", "rm"], "Remove external Docker image registry", load_subcommand('external_registries/remove_command')
10
6
 
11
7
  def execute
12
8
  end
@@ -1,34 +1,19 @@
1
- require_relative 'grids/list_command'
2
- require_relative 'grids/create_command'
3
- require_relative 'grids/update_command'
4
- require_relative 'grids/use_command'
5
- require_relative 'grids/show_command'
6
- require_relative 'grids/logs_command'
7
- require_relative 'grids/remove_command'
8
- require_relative 'grids/current_command'
9
- require_relative 'grids/env_command'
10
- require_relative 'grids/audit_log_command'
11
- require_relative 'grids/user_command'
12
- require_relative 'grids/cloud_config_command'
13
- require_relative 'grids/trusted_subnet_command'
14
- require_relative 'grids/health_command'
15
-
16
1
  class Kontena::Cli::GridCommand < Kontena::Command
17
2
 
18
- subcommand ["list","ls"], "List all grids", Kontena::Cli::Grids::ListCommand
19
- subcommand "create", "Create a new grid", Kontena::Cli::Grids::CreateCommand
20
- subcommand "update", "Update grid", Kontena::Cli::Grids::UpdateCommand
21
- subcommand "use", "Switch to use specific grid", Kontena::Cli::Grids::UseCommand
22
- subcommand "show", "Show grid details", Kontena::Cli::Grids::ShowCommand
23
- subcommand "logs", "Show logs from grid containers", Kontena::Cli::Grids::LogsCommand
24
- subcommand ["remove","rm"], "Remove a grid", Kontena::Cli::Grids::RemoveCommand
25
- subcommand "current", "Show current grid details", Kontena::Cli::Grids::CurrentCommand
26
- subcommand "env", "Show the current grid environment details", Kontena::Cli::Grids::EnvCommand
27
- subcommand "audit-log", "Show audit log of the current grid", Kontena::Cli::Grids::AuditLogCommand
28
- subcommand "user", "User specific commands", Kontena::Cli::Grids::UserCommand
29
- subcommand "cloud-config", "Generate cloud-config", Kontena::Cli::Grids::CloudConfigCommand
30
- subcommand "trusted-subnet", "Trusted subnet related commands", Kontena::Cli::Grids::TrustedSubnetCommand
31
- subcommand "health", "Check grid health", Kontena::Cli::Grids::HealthCommand
3
+ subcommand ["list","ls"], "List all grids", load_subcommand('grids/list_command')
4
+ subcommand "create", "Create a new grid", load_subcommand('grids/create_command')
5
+ subcommand "update", "Update grid", load_subcommand('grids/update_command')
6
+ subcommand "use", "Switch to use specific grid", load_subcommand('grids/use_command')
7
+ subcommand "show", "Show grid details", load_subcommand('grids/show_command')
8
+ subcommand "logs", "Show logs from grid containers", load_subcommand('grids/logs_command')
9
+ subcommand ["remove","rm"], "Remove a grid", load_subcommand('grids/remove_command')
10
+ subcommand "current", "Show current grid details", load_subcommand('grids/current_command')
11
+ subcommand "env", "Show the current grid environment details", load_subcommand('grids/env_command')
12
+ subcommand "audit-log", "Show audit log of the current grid", load_subcommand('grids/audit_log_command')
13
+ subcommand "user", "User specific commands", load_subcommand('grids/user_command')
14
+ subcommand "cloud-config", "Generate cloud-config", load_subcommand('grids/cloud_config_command')
15
+ subcommand "trusted-subnet", "Trusted subnet related commands", load_subcommand('grids/trusted_subnet_command')
16
+ subcommand "health", "Check grid health", load_subcommand('grids/health_command')
32
17
 
33
18
  def execute
34
19
  end
@@ -45,6 +45,7 @@ module Kontena::Cli::Grids
45
45
  docker_bip: docker_bip,
46
46
  version: version,
47
47
  match_default_network_name: default_interface_match,
48
+ grid_subnet: grid['subnet'],
48
49
  )
49
50
  puts config
50
51
  end
@@ -12,6 +12,8 @@ module Kontena::Cli::Grids
12
12
  grid['default_affinity'].to_a.each do |a|
13
13
  puts " - #{a}"
14
14
  end
15
+ puts " subnet: #{grid['subnet']}"
16
+ puts " supernet: #{grid['supernet']}"
15
17
  root_dir = grid['engine_root_dir']
16
18
  nodes = client(require_token).get("grids/#{grid['name']}/nodes")
17
19
  nodes = nodes['nodes'].select{|n| n['connected'] == true }
@@ -11,6 +11,8 @@ module Kontena::Cli::Grids
11
11
  option "--silent", :flag, "Reduce output verbosity"
12
12
  option "--token", "[TOKEN]", "Set grid token"
13
13
  option "--default-affinity", "[AFFINITY]", "Default affinity rule for the grid", multivalued: true
14
+ option "--subnet", "[CIDR]", "Configure grid overlay subnet"
15
+ option "--supernet", "[CIDR]", "Configure grid IPAM supernet"
14
16
 
15
17
  requires_current_master_token
16
18
 
@@ -21,6 +23,9 @@ module Kontena::Cli::Grids
21
23
  payload[:token] = self.token if self.token
22
24
  payload[:initial_size] = self.initial_size if self.initial_size
23
25
  payload[:default_affinity] = self.default_affinity_list unless self.default_affinity_list.empty?
26
+ payload[:subnet] = subnet if subnet
27
+ payload[:supernet] = supernet if supernet
28
+
24
29
  grid = nil
25
30
  if initial_size == 1
26
31
  warning "Option --initial-size=1 is only recommended for test/dev usage" unless running_silent?
@@ -1,12 +1,10 @@
1
1
  module Kontena::Cli::Grids
2
-
3
- require_relative 'trusted_subnets/list_command'
4
- require_relative 'trusted_subnets/add_command'
5
- require_relative 'trusted_subnets/remove_command'
6
-
7
2
  class TrustedSubnetCommand < Kontena::Command
8
- subcommand ["list", "ls"], "List trusted subnets", TrustedSubnets::ListCommand
9
- subcommand "add", "Add trusted subnet", TrustedSubnets::AddCommand
10
- subcommand ["remove", "rm"], "Remove trusted subnet", TrustedSubnets::RemoveCommand
3
+ subcommand ["list", "ls"], "List trusted subnets", load_subcommand('grids/trusted_subnets/list_command')
4
+ subcommand "add", "Add trusted subnet", load_subcommand('grids/trusted_subnets/add_command')
5
+ subcommand ["remove", "rm"], "Remove trusted subnet", load_subcommand('grids/trusted_subnets/remove_command')
6
+
7
+ def execute
8
+ end
11
9
  end
12
10
  end
@@ -1,12 +1,9 @@
1
1
  module Kontena::Cli::Grids
2
2
 
3
- require_relative 'users/list_command'
4
- require_relative 'users/add_command'
5
- require_relative 'users/remove_command'
6
3
 
7
4
  class UserCommand < Kontena::Command
8
- subcommand ["list", "ls"], "List grid users", Users::ListCommand
9
- subcommand "add", "Add user to grid", Users::AddCommand
10
- subcommand ["remove", "rm"], "Remove user from grid", Users::RemoveCommand
5
+ subcommand ["list", "ls"], "List grid users", load_subcommand('grids/users/list_command')
6
+ subcommand "add", "Add user to grid", load_subcommand('grids/users/add_command')
7
+ subcommand ["remove", "rm"], "Remove user from grid", load_subcommand('grids/users/remove_command')
11
8
  end
12
9
  end
@@ -1,23 +1,17 @@
1
- require_relative 'config/set_command'
2
- require_relative 'config/get_command'
3
- require_relative 'config/unset_command'
4
- require_relative 'config/export_command'
5
- require_relative 'config/import_command'
6
1
 
7
2
  module Kontena
8
3
  module Cli
9
4
  module Master
10
5
  class ConfigCommand < Kontena::Command
11
- subcommand "set", "Set a config value", Kontena::Cli::Master::Config::SetCommand
12
- subcommand "get", "Get a config value", Kontena::Cli::Master::Config::GetCommand
13
- subcommand "unset", "Clear a config value", Kontena::Cli::Master::Config::UnsetCommand
14
- subcommand ["load", "import"], "Upload config to Master", Kontena::Cli::Master::Config::ImportCommand
15
- subcommand ["dump", "export"], "Download config from Master", Kontena::Cli::Master::Config::ExportCommand
6
+ subcommand "set", "Set a config value", load_subcommand('master/config/set_command')
7
+ subcommand "get", "Get a config value", load_subcommand('master/config/get_command')
8
+ subcommand "unset", "Clear a config value", load_subcommand('master/config/unset_command')
9
+ subcommand ["load", "import"], "Upload config to Master", load_subcommand('master/config/import_command')
10
+ subcommand ["dump", "export"], "Download config from Master", load_subcommand('master/config/export_command')
16
11
 
17
12
  def execute
18
13
  end
19
14
  end
20
15
  end
21
16
  end
22
- end
23
-
17
+ end
@@ -1,18 +1,13 @@
1
- require_relative 'token/list_command'
2
- require_relative 'token/remove_command'
3
- require_relative 'token/create_command'
4
- require_relative 'token/current_command'
5
- require_relative 'token/show_command'
6
1
 
7
2
  module Kontena::Cli::Master
8
3
  class TokenCommand < Kontena::Command
9
- subcommand ["list", "ls"], "List access tokens", Kontena::Cli::Master::Token::ListCommand
10
- subcommand ["rm", "remove"], "Remove / revoke an access token", Kontena::Cli::Master::Token::RemoveCommand
11
- subcommand "show", "Display access token", Kontena::Cli::Master::Token::ShowCommand
12
- subcommand "current", "Display current access token", Kontena::Cli::Master::Token::CurrentCommand
13
- subcommand "create", "Generate an access token", Kontena::Cli::Master::Token::CreateCommand
4
+ subcommand ["list", "ls"], "List access tokens", load_subcommand('master/token/list_command')
5
+ subcommand ["rm", "remove"], "Remove / revoke an access token", load_subcommand('master/token/remove_command')
6
+ subcommand "show", "Display access token", load_subcommand('master/token/show_command')
7
+ subcommand "current", "Display current access token", load_subcommand('master/token/current_command')
8
+ subcommand "create", "Generate an access token", load_subcommand('master/token/create_command')
14
9
 
15
10
  def execute
16
11
  end
17
12
  end
18
- end
13
+ end