Class: Krane::TaskConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/krane/task_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, namespace, logger = nil, kubeconfig = nil) ⇒ TaskConfig

Returns a new instance of TaskConfig.



9
10
11
12
13
14
# File 'lib/krane/task_config.rb', line 9

def initialize(context, namespace, logger = nil, kubeconfig = nil)
  @context = context
  @namespace = namespace
  @logger = logger || FormattedLogger.build(@namespace, @context)
  @kubeconfig = kubeconfig || ENV['KUBECONFIG']
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



7
8
9
# File 'lib/krane/task_config.rb', line 7

def context
  @context
end

#kubeconfigObject (readonly)

Returns the value of attribute kubeconfig.



7
8
9
# File 'lib/krane/task_config.rb', line 7

def kubeconfig
  @kubeconfig
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/krane/task_config.rb', line 7

def logger
  @logger
end

#namespaceObject (readonly)

Returns the value of attribute namespace.



7
8
9
# File 'lib/krane/task_config.rb', line 7

def namespace
  @namespace
end

Instance Method Details

#global_kindsObject



16
17
18
19
20
21
# File 'lib/krane/task_config.rb', line 16

def global_kinds
  @global_kinds ||= begin
    cluster_resource_discoverer = ClusterResourceDiscovery.new(task_config: self)
    cluster_resource_discoverer.fetch_resources(namespaced: false).map { |g| g["kind"] }
  end
end

#kubeclient_builderObject



23
24
25
# File 'lib/krane/task_config.rb', line 23

def kubeclient_builder
  @kubeclient_builder ||= KubeclientBuilder.new(kubeconfig: kubeconfig)
end