Sha256: 7f32d188b13a4d3e349ff6e91e32bbcce068244edaa8fd868e86535e9d02a6fc

Contents?: true

Size: 793 Bytes

Versions: 43

Compression:

Stored size: 793 Bytes

Contents

# frozen_string_literal: true

require 'krane/cluster_resource_discovery'

module Krane
  class TaskConfig
    attr_reader :context, :namespace, :logger, :kubeconfig

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

    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

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

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
krane-3.6.2 lib/krane/task_config.rb
krane-3.6.1 lib/krane/task_config.rb
krane-3.5.2 lib/krane/task_config.rb
krane-3.5.1 lib/krane/task_config.rb
krane-3.5.0 lib/krane/task_config.rb
krane-3.4.2 lib/krane/task_config.rb
krane-3.4.1 lib/krane/task_config.rb
krane-3.4.0 lib/krane/task_config.rb
krane-3.3.0 lib/krane/task_config.rb
krane-3.2.0 lib/krane/task_config.rb
krane-3.1.0 lib/krane/task_config.rb
krane-3.0.1 lib/krane/task_config.rb
krane-3.0.0 lib/krane/task_config.rb
krane-2.4.9 lib/krane/task_config.rb
krane-2.4.8 lib/krane/task_config.rb
krane-2.4.7 lib/krane/task_config.rb
krane-2.4.6 lib/krane/task_config.rb
krane-2.4.5 lib/krane/task_config.rb
krane-2.4.4 lib/krane/task_config.rb
krane-2.4.3 lib/krane/task_config.rb