Sha256: 26a70578708dfa1976220af8474525099e3e03eb1a8e15027ff94c2ff03c892e

Contents?: true

Size: 543 Bytes

Versions: 3

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

require "kubeclient"

module CronKubernetes
  # Create a context for `Kubeclient` depending on the environment.
  class KubeclientContext
    Context = Struct.new(:endpoint, :version, :namespace, :options)

    class << self
      def context
        [
            CronKubernetes::Context::WellKnown,
            CronKubernetes::Context::Kubectl
        ].each do |context_type|
          context = context_type.new
          return context.context if context.applicable?
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cron-kubernetes-3.0.0 lib/cron_kubernetes/kubeclient_context.rb
cron-kubernetes-2.0.0 lib/cron_kubernetes/kubeclient_context.rb
cron-kubernetes-1.1.0 lib/cron_kubernetes/kubeclient_context.rb