Sha256: 98feae537b6ae9bc356848603223401fefebad8d6ee32eaa8b377fd4ca57fd11

Contents?: true

Size: 990 Bytes

Versions: 3

Compression:

Stored size: 990 Bytes

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
    kubectl_commands.apply_file(shell, config_path, kubeconfig_path: kubeconfig_path)

    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)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kuber_kit-0.2.0 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.1.9 lib/kuber_kit/service_deployer/strategies/kubernetes.rb
kuber_kit-0.1.8 lib/kuber_kit/service_deployer/strategies/kubernetes.rb