Sha256: fbb7319cee52abbb8fd326ce558a611e03c6ea67fc15df0cb5112c3dac0d8b63

Contents?: true

Size: 1.22 KB

Versions: 32

Compression:

Stored size: 1.22 KB

Contents

require_relative 'common'

module Kontena::Cli::Grids
  class CloudConfigCommand < Clamp::Command
    include Kontena::Cli::Common
    include Common

    parameter "NAME", "Grid name"
    option "--dns", "DNS",  "DNS server", multivalued: true
    option "--peer-interface", "IFACE", "Peer (private) network interface", default: "eth1"
    option "--docker-bip", "BIP", "Docker bridge ip", default: "172.17.43.1/16"
    option "--version", "VERSION", "Agent version", default: "latest"

    def execute
      require_api_url
      token = require_token

      grid = find_grid_by_name(name)
      abort("Grid not found".colorize(:red)) unless grid

      default_dns = docker_bip.split('/')[0]
      if dns_list.size > 0
        dns_servers = [default_dns] + dns_list
      else
        dns_servers = [default_dns, '8.8.8.8', '8.8.4.4']
      end

      require 'kontena/machine/cloud_config/node_generator'
      generator = Kontena::Machine::CloudConfig::NodeGenerator.new
      config = generator.generate(
        master_uri: api_url,
        grid_token: grid['token'],
        peer_interface: peer_interface,
        dns_servers: dns_servers,
        docker_bip: docker_bip,
        version: version
      )
      puts config
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
kontena-cli-0.15.5 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.5.rc2 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.5.rc1 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.4 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.4.rc2 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.4.rc1 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.4.pre1 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.3 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.2 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.1 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.0 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.0.rc3 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.0.rc2 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.15.0.rc1 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.14.7 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.14.6 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.14.5 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.14.4 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.14.3 lib/kontena/cli/grids/cloud_config_command.rb
kontena-cli-0.14.2 lib/kontena/cli/grids/cloud_config_command.rb