Sha256: ac3f65fa688e8cd7d70695b3c4d80c5ea7a0d6b29e9e62f64d20c304cec486c6

Contents?: true

Size: 835 Bytes

Versions: 8

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true
module KubernetesDeploy
  class Service < KubernetesResource
    TIMEOUT = 5.minutes

    def initialize(name, namespace, context, file)
      @name = name
      @namespace = namespace
      @context = context
      @file = file
    end

    def sync
      _, _err, st = run_kubectl("get", type, @name)
      @found = st.success?
      if @found
        endpoints, _err, st = run_kubectl("get", "endpoints", @name, "--output=jsonpath={.subsets[*].addresses[*].ip}")
        @num_endpoints = (st.success? ? endpoints.split.length : 0)
      else
        @num_endpoints = 0
      end
      @status = "#{@num_endpoints} endpoints"
      log_status
    end

    def deploy_succeeded?
      @num_endpoints > 0
    end

    def deploy_failed?
      false
    end

    def exists?
      @found
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
kubernetes-deploy-0.6.6 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.6.5 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.6.4 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.6.3 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.6.2 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.6.1 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.6.0 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.5.0 lib/kubernetes-deploy/kubernetes_resource/service.rb