Sha256: d839a3619482a9a71f60c2f8001371705c3e7e1c1e5ffa4dd9d33ad82f092404

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

# frozen_string_literal: true

module CronKubernetes
  # Encapsulate access to Kubernetes API for different API versions.
  class KubernetesClient
    def batch_client
      @batch_client ||= client("/apis/batch", "v1")
    end

    def namespace
      context&.namespace
    end

    private

    def client(scope, version = nil)
      return CronKubernetes.kubeclient if CronKubernetes.kubeclient
      return unless context

      Kubeclient::Client.new(context.endpoint + scope, version || context.version, context.options)
    end

    def context
      return nil if CronKubernetes.kubeclient

      @context ||= KubeclientContext.context
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cron-kubernetes-2.0.0 lib/cron_kubernetes/kubernetes_client.rb