Class: KubernetesDeploy::Service
Constant Summary
collapse
- TIMEOUT =
5.minutes
Instance Attribute Summary
#context, #deploy_started, #file, #name, #namespace, #type
Instance Method Summary
collapse
#deploy_finished?, #deploy_timed_out?, for_type, #group_name, #id, #log_status, logger, logger=, #run_kubectl, #status, #status_data, timeout, #timeout, #tpr?
Constructor Details
#initialize(name, namespace, context, file) ⇒ Service
Returns a new instance of Service.
5
6
7
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 5
def initialize(name, namespace, context, file)
@name, @namespace, @context, @file = name, namespace, context, file
end
|
Instance Method Details
#deploy_failed? ⇒ Boolean
26
27
28
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 26
def deploy_failed?
false
end
|
#deploy_succeeded? ⇒ Boolean
22
23
24
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 22
def deploy_succeeded?
@num_endpoints > 0
end
|
#exists? ⇒ Boolean
30
31
32
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 30
def exists?
@found
end
|
#sync ⇒ Object
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 9
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
|