Class: Krane::TaskConfig
- Inherits:
-
Object
- Object
- Krane::TaskConfig
- Defined in:
- lib/krane/task_config.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#kubeconfig ⇒ Object
readonly
Returns the value of attribute kubeconfig.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Instance Method Summary collapse
- #global_kinds ⇒ Object
-
#initialize(context, namespace, logger = nil, kubeconfig = nil) ⇒ TaskConfig
constructor
A new instance of TaskConfig.
- #kubeclient_builder ⇒ Object
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
#context ⇒ Object (readonly)
Returns the value of attribute context.
7 8 9 |
# File 'lib/krane/task_config.rb', line 7 def context @context end |
#kubeconfig ⇒ Object (readonly)
Returns the value of attribute kubeconfig.
7 8 9 |
# File 'lib/krane/task_config.rb', line 7 def kubeconfig @kubeconfig end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
7 8 9 |
# File 'lib/krane/task_config.rb', line 7 def logger @logger end |
#namespace ⇒ Object (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_kinds ⇒ Object
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_builder ⇒ Object
23 24 25 |
# File 'lib/krane/task_config.rb', line 23 def kubeclient_builder @kubeclient_builder ||= KubeclientBuilder.new(kubeconfig: kubeconfig) end |