Sha256: adf54dcb4cb136523a8d1b4bb62114020fa4fc5fcdb3ad912c488393c6a8b3f9

Contents?: true

Size: 1.64 KB

Versions: 23

Compression:

Stored size: 1.64 KB

Contents

# typed: true
require 'kubernetes-cli'

module Kuby
  module Kubernetes
    class Provider
      attr_reader :environment

      def initialize(environment)
        @environment = environment
        after_initialize
      end

      def configure(&block)
        # do nothing by default
      end

      def setup
        # do nothing by default
      end

      # called after all providers and plugins have been configured
      def after_configuration
        # do nothing by default
      end

      # called before any providers or plugins have been setup
      def before_setup
        # do nothing by default
      end

      # called after all providers and plugins have been setup
      def after_setup
        # do nothing by default
      end

      # called before the deploy is initiated
      def before_deploy(manifest)
        # do nothing by default
      end

      # called after the deploy has completed
      def after_deploy(manifest)
        # do nothing by default
      end

      def deploy
        deployer.deploy
      end

      def rollback
        deployer.rollback
      end

      def kubernetes_cli
        @kubernetes_cli ||= ::KubernetesCLI.new(kubeconfig_path)
      end

      def helm_cli
        @helm_cli ||= ::HelmCLI.new(kubeconfig_path)
      end

      def kubeconfig_path
        raise NotImplementedError, "please define #{__method__} in #{self.class.name}"
      end

      def deployer
        @deployer ||= Kuby::Kubernetes::Deployer.new(environment)
      end

      private

      def after_initialize
        # override this in derived classes
      end

      def spec
        environment.kubernetes
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
kuby-core-0.17.0 lib/kuby/kubernetes/provider.rb
kuby-core-0.16.1 lib/kuby/kubernetes/provider.rb
kuby-core-0.16.0 lib/kuby/kubernetes/provider.rb
kuby-core-0.15.0 lib/kuby/kubernetes/provider.rb
kuby-core-0.14.0 lib/kuby/kubernetes/provider.rb
kuby-core-0.13.0 lib/kuby/kubernetes/provider.rb
kuby-core-0.12.0 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.16 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.15 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.14 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.13 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.12 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.11 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.10 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.9 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.8 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.7 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.6 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.4 lib/kuby/kubernetes/provider.rb
kuby-core-0.11.3 lib/kuby/kubernetes/provider.rb