Module: Kubert

Defined in:
lib/kubert.rb,
lib/kubert/cli.rb,
lib/kubert/pods.rb,
lib/kubert/version.rb,
lib/kubert/deployment.rb

Defined Under Namespace

Classes: Cli, Deployment, Pods

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.clientObject



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/kubert.rb', line 52

def self.client
  @client ||= begin
    Kubeclient::Client.new(
      kube_config.context.api_endpoint,
        kube_config.context.api_version,
        {
          ssl_options: kube_config.context.ssl_options,
          auth_options: kube_config.context.auth_options
        }
    )
  end
end

.command_prefixObject



37
38
39
# File 'lib/kubert.rb', line 37

def self.command_prefix
  configuration[:command_prefix]
end

.configurationObject



45
46
47
48
49
50
# File 'lib/kubert.rb', line 45

def self.configuration
  @config ||= begin
    config = KY::Configuration.new
    (config[:kubert] || {}).merge(project_name: config[:project_name])
  end
end

.console_commandObject



33
34
35
# File 'lib/kubert.rb', line 33

def self.console_command
  Array(configuration[:console_command] && configuration[:console_command].split(" "))
end

.contextObject



29
30
31
# File 'lib/kubert.rb', line 29

def self.context
  kube_config.contexts.select {|c| kube_config.context.api_endpoint.match(c) }
end

.contextsObject



13
14
15
# File 'lib/kubert.rb', line 13

def self.contexts
  configuration[:contexts] || []
end

.default_environmentObject



21
22
23
# File 'lib/kubert.rb', line 21

def self.default_environment
  configuration[:default_environment]
end

.default_namespaceObject



25
26
27
# File 'lib/kubert.rb', line 25

def self.default_namespace
  configuration[:default_namespace] || configuration[:default_environment]
end

.excluded_deploymentsObject



41
42
43
# File 'lib/kubert.rb', line 41

def self.excluded_deployments
  configuration[:excluded_deployments] || []
end

.kube_configObject



9
10
11
# File 'lib/kubert.rb', line 9

def self.kube_config
  @kube_config ||= Kubeclient::Config.read(File.expand_path('~/.kube/config'))
end

.task_podObject



17
18
19
# File 'lib/kubert.rb', line 17

def self.task_pod
  configuration[:task_pod] || random_pod_type
end