Sha256: d02c430ae9d5ee2863ebb398b6fdf8ce48c3c0740dd9eaab3ff4ea2810257139

Contents?: true

Size: 1.09 KB

Versions: 11

Compression:

Stored size: 1.09 KB

Contents

class KuberKit::ServiceDeployer::Strategies::Kubernetes < KuberKit::ServiceDeployer::Strategies::Abstract
  include KuberKit::Import[
    "service_reader.reader",
    "shell.kubectl_commands",
    "configs",
  ]

  Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service => Any
  def deploy(shell, service)
    service_config = reader.read(shell, service)
    config_path    = "#{configs.service_config_dir}/#{service.name}.yml"
    shell.write(config_path, service_config)

    kubeconfig_path  = KuberKit.current_configuration.kubeconfig_path
    deploy_namespace = KuberKit.current_configuration.deploy_namespace

    kubectl_commands.apply_file(shell, config_path, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)

    deployment_restart_enabled = service.attribute(:deployment_restart_enabled, default: true)
    deployment_restart_name    = service.attribute(:deployment_restart_name, default: service.uri)
    if deployment_restart_enabled
      kubectl_commands.rolling_restart(shell, deployment_restart_name, kubeconfig_path: kubeconfig_path, namespace: deploy_namespace)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kuber_kit-0.3.1 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.3.0 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.9 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.8 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.7 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.6 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.5 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.4 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.3 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.2 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.2.1 lib/kuber_kit/service_deployer/strategies/kubernetes.rb