Class: KubernetesDeploy::Service
Constant Summary
collapse
- TIMEOUT =
5.minutes
KubernetesResource::DEBUG_RESOURCE_NOT_FOUND_MESSAGE, KubernetesResource::LOG_LINE_COUNT, KubernetesResource::STANDARD_TIMEOUT_MESSAGE, KubernetesResource::UNUSUAL_FAILURE_MESSAGE
Instance Attribute Summary
#context, #deploy_started, #name, #namespace, #type
Instance Method Summary
collapse
build, #debug_message, #deploy_finished?, #deploy_method, #deploy_timed_out?, #failure_message, #fetch_events, #file_path, #id, #initialize, #kubectl, #pretty_status, #status, timeout, #timeout, #tpr?
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
18
19
20
21
22
23
24
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 18
def deploy_succeeded?
if exposes_zero_replica_deployment?
@num_endpoints == 0
else
@num_endpoints > 0
end
end
|
#exists? ⇒ Boolean
37
38
39
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 37
def exists?
@found
end
|
#sync ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 6
def sync
_, _err, st = kubectl.run("get", type, @name)
@found = st.success?
if @found
endpoints, _err, st = kubectl.run("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"
end
|
#timeout_message ⇒ Object
30
31
32
33
34
35
|
# File 'lib/kubernetes-deploy/kubernetes_resource/service.rb', line 30
def timeout_message
<<-MSG.strip_heredoc.strip
This service does not have any endpoints. If the related pods are failing, fixing them will solve this as well.
If the related pods are up, this service's selector is probably incorrect.
MSG
end
|