Sha256: 4c10c7da0fa63b382eb8a8552960777579a618ec34c514605d24a77d29b18192

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

# typed: strict

require 'kube-dsl'

module Kuby
  module Kubernetes
    class BareMetalProvider < Provider
      # extend T::Sig

      DEFAULT_STORAGE_CLASS = 'hostpath'.freeze

      class Config
        extend ::KubeDSL::ValueFields

        value_fields :kubeconfig
        value_fields :storage_class
      end

      # T::Sig::WithoutRuntime.sig { returns(Config) }
      attr_reader :config

      # T::Sig::WithoutRuntime.sig { params(environment: Environment).void }
      def initialize(environment)
        @config = Config.new
        super
      end

      # T::Sig::WithoutRuntime.sig { params(block: T.proc.void).void }
      def configure(&block)
        config.instance_eval(&block) if block
      end

      # T::Sig::WithoutRuntime.sig { returns(String) }
      def kubeconfig_path
        config.kubeconfig
      end

      # T::Sig::WithoutRuntime.sig { returns(String) }
      def storage_class_name
        config.storage_class
      end

      private

      # T::Sig::WithoutRuntime.sig { void }
      def after_initialize
        configure do
          # default kubeconfig path
          kubeconfig File.join(ENV['HOME'], '.kube', 'config')
          storage_class DEFAULT_STORAGE_CLASS
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.20.2 lib/kuby/kubernetes/bare_metal_provider.rb
kuby-core-0.20.1 lib/kuby/kubernetes/bare_metal_provider.rb
kuby-core-0.20.0 lib/kuby/kubernetes/bare_metal_provider.rb
kuby-core-0.19.0 lib/kuby/kubernetes/bare_metal_provider.rb
kuby-core-0.18.0 lib/kuby/kubernetes/bare_metal_provider.rb