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.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/VERSION +1 -1
- data/bin/kontena +8 -28
- data/kontena-cli.gemspec +2 -2
- data/lib/kontena/cli/app_command.rb +14 -27
- data/lib/kontena/cli/certificate_command.rb +4 -7
- data/lib/kontena/cli/cloud/master_command.rb +5 -12
- data/lib/kontena/cli/cloud_command.rb +4 -7
- data/lib/kontena/cli/container_command.rb +4 -9
- data/lib/kontena/cli/etcd/health_command.rb +1 -0
- data/lib/kontena/cli/etcd_command.rb +6 -13
- data/lib/kontena/cli/external_registry_command.rb +3 -7
- data/lib/kontena/cli/grid_command.rb +14 -29
- data/lib/kontena/cli/grids/cloud_config_command.rb +1 -0
- data/lib/kontena/cli/grids/common.rb +2 -0
- data/lib/kontena/cli/grids/create_command.rb +5 -0
- data/lib/kontena/cli/grids/trusted_subnet_command.rb +6 -8
- data/lib/kontena/cli/grids/user_command.rb +3 -6
- data/lib/kontena/cli/master/config_command.rb +6 -12
- data/lib/kontena/cli/master/token_command.rb +6 -11
- data/lib/kontena/cli/master/users/role_command.rb +2 -4
- data/lib/kontena/cli/master/users_command.rb +4 -8
- data/lib/kontena/cli/master_command.rb +14 -33
- data/lib/kontena/cli/node_command.rb +7 -15
- data/lib/kontena/cli/nodes/health_command.rb +1 -1
- data/lib/kontena/cli/nodes/label_command.rb +3 -9
- data/lib/kontena/cli/nodes/show_command.rb +1 -1
- data/lib/kontena/cli/nodes/ssh_command.rb +13 -4
- data/lib/kontena/cli/plugin_command.rb +5 -9
- data/lib/kontena/cli/registry_command.rb +2 -5
- data/lib/kontena/cli/service_command.rb +22 -45
- data/lib/kontena/cli/services/container_command.rb +2 -3
- data/lib/kontena/cli/services/env_command.rb +3 -6
- data/lib/kontena/cli/services/secret_command.rb +2 -4
- data/lib/kontena/cli/stack_command.rb +11 -24
- data/lib/kontena/cli/stacks/registry_command.rb +5 -12
- data/lib/kontena/cli/stacks/upgrade_command.rb +6 -0
- data/lib/kontena/cli/stacks/yaml/reader.rb +17 -2
- data/lib/kontena/cli/subcommand_loader.rb +82 -0
- data/lib/kontena/cli/vault_command.rb +7 -15
- data/lib/kontena/cli/version.rb +6 -1
- data/lib/kontena/cli/vpn_command.rb +3 -7
- data/lib/kontena/command.rb +28 -1
- data/lib/kontena/machine/cloud_config/cloudinit.yml +1 -1
- data/lib/kontena/main_command.rb +22 -38
- data/lib/kontena/scripts/completer +2 -233
- data/lib/kontena/scripts/completer.rb +230 -0
- data/lib/kontena/scripts/init +5 -8
- data/lib/kontena/scripts/kontena.bash +8 -0
- data/lib/kontena/scripts/kontena.zsh +11 -0
- data/lib/kontena_cli.rb +9 -1
- data/omnibus/wrappers/sh/kontena +1 -1
- data/spec/fixtures/stack-with-liquid-optional.yml +14 -0
- data/spec/fixtures/stack-with-liquid-undefined.yml +12 -0
- data/spec/kontena/cli/app/build_command_spec.rb +1 -2
- data/spec/kontena/cli/app/common_spec.rb +1 -2
- data/spec/kontena/cli/app/config_command_spec.rb +0 -1
- data/spec/kontena/cli/app/deploy_command_spec.rb +2 -3
- data/spec/kontena/cli/app/docker_helper_spec.rb +0 -1
- data/spec/kontena/cli/app/init_command_spec.rb +0 -1
- data/spec/kontena/cli/app/logs_command_spec.rb +0 -1
- data/spec/kontena/cli/app/scale_spec.rb +2 -3
- data/spec/kontena/cli/app/service_generator_spec.rb +1 -2
- data/spec/kontena/cli/app/service_generator_v2_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/reader_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/service_extender_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/validator_spec.rb +0 -1
- data/spec/kontena/cli/app/yaml/validator_v2_spec.rb +0 -1
- data/spec/kontena/cli/cloud/login_command_spec.rb +0 -1
- data/spec/kontena/cli/cloud/logout_command_spec.rb +0 -1
- data/spec/kontena/cli/cloud/master/add_command_spec.rb +0 -1
- data/spec/kontena/cli/common_spec.rb +0 -1
- data/spec/kontena/cli/containers/list_command_spec.rb +0 -1
- data/spec/kontena/cli/containers/logs_command_spec.rb +0 -1
- data/spec/kontena/cli/etcd/health_command_spec.rb +2 -0
- data/spec/kontena/cli/grids/trusted_subnets/add_command_spec.rb +0 -11
- data/spec/kontena/cli/grids/trusted_subnets/list_command_spec.rb +4 -13
- data/spec/kontena/cli/grids/trusted_subnets/remove_command_spec.rb +0 -11
- data/spec/kontena/cli/grids/use_command_spec.rb +0 -1
- data/spec/kontena/cli/helpers/log_helper_spec.rb +0 -1
- data/spec/kontena/cli/main_command_spec.rb +2 -3
- data/spec/kontena/cli/master/current_command_spec.rb +5 -15
- data/spec/kontena/cli/master/init_cloud_command_spec.rb +0 -1
- data/spec/kontena/cli/master/login_command_spec.rb +0 -1
- data/spec/kontena/cli/master/logout_command_spec.rb +0 -1
- data/spec/kontena/cli/master/use_command_spec.rb +0 -1
- data/spec/kontena/cli/master/users/invite_command_spec.rb +1 -5
- data/spec/kontena/cli/master/users/remove_command_spec.rb +2 -14
- data/spec/kontena/cli/master/users/roles/add_command_spec.rb +0 -1
- data/spec/kontena/cli/master/users/roles/remove_command_spec.rb +0 -1
- data/spec/kontena/cli/nodes/list_command_spec.rb +2 -0
- data/spec/kontena/cli/services/containers_command_spec.rb +0 -18
- data/spec/kontena/cli/services/exec_command_spec.rb +6 -4
- data/spec/kontena/cli/services/link_command_spec.rb +5 -19
- data/spec/kontena/cli/services/restart_command_spec.rb +0 -16
- data/spec/kontena/cli/services/secrets/link_command_spec.rb +0 -11
- data/spec/kontena/cli/services/secrets/unlink_command_spec.rb +1 -12
- data/spec/kontena/cli/services/services_helper_spec.rb +0 -1
- data/spec/kontena/cli/services/unlink_command_spec.rb +7 -21
- data/spec/kontena/cli/services/update_command_spec.rb +0 -15
- data/spec/kontena/cli/stacks/build_command_spec.rb +0 -1
- data/spec/kontena/cli/stacks/deploy_command_spec.rb +10 -13
- data/spec/kontena/cli/stacks/install_command_spec.rb +0 -15
- data/spec/kontena/cli/stacks/list_command_spec.rb +4 -10
- data/spec/kontena/cli/stacks/remove_command_spec.rb +1 -16
- data/spec/kontena/cli/stacks/service_generator_spec.rb +0 -1
- data/spec/kontena/cli/stacks/service_generator_v2_spec.rb +0 -1
- data/spec/kontena/cli/stacks/show_command_spec.rb +1 -14
- data/spec/kontena/cli/stacks/upgrade_command_spec.rb +19 -1
- data/spec/kontena/cli/stacks/yaml/reader_spec.rb +163 -130
- data/spec/kontena/cli/stacks/yaml/service_extender_spec.rb +0 -1
- data/spec/kontena/cli/stacks/yaml/validator_v3_spec.rb +0 -1
- data/spec/kontena/cli/vault/export_spec.rb +0 -1
- data/spec/kontena/cli/vault/import_spec.rb +4 -5
- data/spec/kontena/cli/version_command_spec.rb +8 -6
- data/spec/kontena/cli/vpn/create_command_spec.rb +3 -4
- data/spec/kontena/client_spec.rb +0 -1
- data/spec/kontena/config_spec.rb +0 -1
- data/spec/kontena/kontena_cli_spec.rb +1 -1
- data/spec/kontena/main_command_spec.rb +0 -1
- data/spec/kontena/plugin_manager_spec.rb +0 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/client_helpers.rb +1 -1
- data/spec/support/exit_with_error_helper.rb +36 -0
- data/spec/support/fixtures_helpers.rb +5 -2
- metadata +18 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bb3a720a442f0537a388e074fc06d2deca0fe61
|
4
|
+
data.tar.gz: abb0c04c02d70ea872693f70f972d26c06519fb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
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
|
-
#
|
4
|
+
# add lib to libpath (only needed when running from the sources)
|
5
5
|
require 'pathname'
|
6
|
-
|
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
|
-
|
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
|
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.
|
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",
|
18
|
-
subcommand "build", "Build Kontena services",
|
19
|
-
subcommand "config", "View service configurations",
|
20
|
-
subcommand "deploy", "Deploy Kontena services",
|
21
|
-
subcommand "scale", "Scale services",
|
22
|
-
subcommand "start", "Start services",
|
23
|
-
subcommand "stop", "Stop services",
|
24
|
-
subcommand "restart", "Restart services",
|
25
|
-
subcommand "show", "Show service details",
|
26
|
-
subcommand ["ps", "list", "ls"], "List services",
|
27
|
-
subcommand ["logs"], "Show service logs",
|
28
|
-
subcommand "monitor", "Monitor services",
|
29
|
-
subcommand ["remove","rm"], "Remove services",
|
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",
|
9
|
-
subcommand "authorize", "Create DNS authorization for domain",
|
10
|
-
subcommand "get", "Get certificate for domain",
|
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",
|
12
|
-
subcommand
|
13
|
-
subcommand
|
14
|
-
subcommand "show", "Show master settings in Kontena Cloud",
|
15
|
-
subcommand "update", "Update master settings in Kontena Cloud",
|
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",
|
7
|
-
subcommand "logout", "Logout from Kontena Cloud",
|
8
|
-
subcommand "master", "Master specific commands",
|
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",
|
9
|
-
subcommand "exec", "Execute command inside a container",
|
10
|
-
subcommand "inspect", "Inspect the container",
|
11
|
-
subcommand "logs", "Show container logs",
|
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,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",
|
11
|
-
subcommand "set", "Set a value on the specified key",
|
12
|
-
subcommand ["mkdir", "mk"], "Create a directory",
|
13
|
-
subcommand ["list", "ls"], "List a directory",
|
14
|
-
subcommand "rm", "Remove a key or a directory",
|
15
|
-
subcommand "health", "Check etcd health",
|
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",
|
8
|
-
subcommand ["list", "ls"], "List external Docker image registries",
|
9
|
-
subcommand ["remove", "rm"], "Remove external Docker image registry",
|
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",
|
19
|
-
subcommand "create", "Create a new grid",
|
20
|
-
subcommand "update", "Update grid",
|
21
|
-
subcommand "use", "Switch to use specific grid",
|
22
|
-
subcommand "show", "Show grid details",
|
23
|
-
subcommand "logs", "Show logs from grid containers",
|
24
|
-
subcommand ["remove","rm"], "Remove a grid",
|
25
|
-
subcommand "current", "Show current grid details",
|
26
|
-
subcommand "env", "Show the current grid environment details",
|
27
|
-
subcommand "audit-log", "Show audit log of the current grid",
|
28
|
-
subcommand "user", "User specific commands",
|
29
|
-
subcommand "cloud-config", "Generate cloud-config",
|
30
|
-
subcommand "trusted-subnet", "Trusted subnet related commands",
|
31
|
-
subcommand "health", "Check grid health",
|
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
|
@@ -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",
|
9
|
-
subcommand "add", "Add trusted subnet",
|
10
|
-
subcommand ["remove", "rm"], "Remove trusted subnet",
|
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",
|
9
|
-
subcommand "add", "Add user to grid",
|
10
|
-
subcommand ["remove", "rm"], "Remove user from grid",
|
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",
|
12
|
-
subcommand "get", "Get a config value",
|
13
|
-
subcommand "unset", "Clear a config value",
|
14
|
-
subcommand ["load", "import"], "Upload config to Master",
|
15
|
-
subcommand ["dump", "export"], "Download config from Master",
|
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",
|
10
|
-
subcommand ["rm", "remove"], "Remove / revoke an access token",
|
11
|
-
subcommand "show", "Display access token",
|
12
|
-
subcommand "current", "Display current access token",
|
13
|
-
subcommand "create", "Generate an access token",
|
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
|