Sha256: 87d0eb54196134a1be529f7222f5d2b6a003cff15d243059ee13cbbd20520ad3

Contents?: true

Size: 1.27 KB

Versions: 16

Compression:

Stored size: 1.27 KB

Contents

# typed: false
require 'kube-dsl'

module Kuby
  module Kubernetes
    class DockerDesktopProvider < 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 Docker Desktop
          # 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

        if assets = spec.plugin(:rails_assets)
          assets.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

16 entries across 16 versions & 1 rubygems

Version Path
kuby-core-0.11.16 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.15 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.14 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.13 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.12 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.11 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.10 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.9 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.8 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.7 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.6 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.4 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.3 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.2 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.1 lib/kuby/kubernetes/docker_desktop_provider.rb
kuby-core-0.11.0 lib/kuby/kubernetes/docker_desktop_provider.rb