Sha256: b0ae21559051cea7856ed871853261831eed2d46e508cb6484a990e5a60985de

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

require 'kube-dsl'

module Kuby
  module Kubernetes
    class MinikubeProvider < Provider
      STORAGE_CLASS_NAME = 'hostpath'.freeze

      class Config
        extend ::KubeDSL::ValueFields

        value_fields :kubeconfig
      end

      attr_reader :config

      def configure(&block)
        config.instance_eval(&block) if block
      end

      def after_configuration
        if rails_app = spec.plugin(:rails_app)
          # Remove ingress and change service type from ClusterIP to
          # LoadBalancer. No need to set up ingress for minikube since
          # it handles all the localhost mapping, etc if you set up a
          # service LB.
          rails_app.resources.delete(rails_app.ingress)
          rails_app.service.spec { type 'LoadBalancer' }
        end
      end

      def kubeconfig_path
        config.kubeconfig
      end

      def storage_class_name
        STORAGE_CLASS_NAME
      end

      private

      def after_initialize
        @config = Config.new

        configure do
          # default kubeconfig path
          kubeconfig File.join(ENV['HOME'], '.kube', 'config')
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kuby-core-0.7.2 lib/kuby/kubernetes/minikube_provider.rb
kuby-core-0.7.1 lib/kuby/kubernetes/minikube_provider.rb
kuby-core-0.7.0 lib/kuby/kubernetes/minikube_provider.rb
kuby-core-0.6.1 lib/kuby/kubernetes/minikube_provider.rb
kuby-core-0.6.0 lib/kuby/kubernetes/minikube_provider.rb