Sha256: ed7c799f753feb5a3cefd0862efd017235d5cd41a1272000a93882864a7c76ff

Contents?: true

Size: 748 Bytes

Versions: 6

Compression:

Stored size: 748 Bytes

Contents

module KubernetesDeploy
  class Service < KubernetesResource
    TIMEOUT = 15.minutes

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

    def sync
      _, st = run_kubectl("get", type, @name)
      @found = st.success?
      if @found
        endpoints, 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

6 entries across 6 versions & 1 rubygems

Version Path
kubernetes-deploy-0.2.2 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.2.1 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.2.0 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.1.4 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.1.3 lib/kubernetes-deploy/kubernetes_resource/service.rb
kubernetes-deploy-0.1.2 lib/kubernetes-deploy/kubernetes_resource/service.rb