Class: KubernetesDeploy::DaemonSet
- Inherits:
-
PodSetBase
- Object
- KubernetesResource
- PodSetBase
- KubernetesDeploy::DaemonSet
- Defined in:
- lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb
Defined Under Namespace
Classes: Node
Constant Summary collapse
- TIMEOUT =
5.minutes
Constants inherited from KubernetesResource
KubernetesResource::DEBUG_RESOURCE_NOT_FOUND_MESSAGE, KubernetesResource::DISABLED_EVENT_INFO_MESSAGE, KubernetesResource::DISABLED_LOG_INFO_MESSAGE, KubernetesResource::DISABLE_FETCHING_EVENT_INFO, KubernetesResource::DISABLE_FETCHING_LOG_INFO, KubernetesResource::GLOBAL, KubernetesResource::LAST_APPLIED_ANNOTATION, KubernetesResource::LOG_LINE_COUNT, KubernetesResource::SENSITIVE_TEMPLATE_CONTENT, KubernetesResource::SERVER_DRY_RUNNABLE, KubernetesResource::SERVER_DRY_RUN_DISABLED_ERROR, KubernetesResource::STANDARD_TIMEOUT_MESSAGE, KubernetesResource::TIMEOUT_OVERRIDE_ANNOTATION, KubernetesResource::TIMEOUT_OVERRIDE_ANNOTATION_DEPRECATED, KubernetesResource::TIMEOUT_OVERRIDE_ANNOTATION_SUFFIX, KubernetesResource::UNUSUAL_FAILURE_MESSAGE
Instance Attribute Summary collapse
-
#pods ⇒ Object
readonly
Returns the value of attribute pods.
Attributes inherited from KubernetesResource
#context, #deploy_started_at, #global, #name, #namespace, #type
Instance Method Summary collapse
- #deploy_failed? ⇒ Boolean
- #deploy_succeeded? ⇒ Boolean
- #fetch_debug_logs ⇒ Object
- #print_debug_logs? ⇒ Boolean
- #status ⇒ Object
- #sync(cache) ⇒ Object
Methods inherited from PodSetBase
#failure_message, #fetch_events, #timeout_message
Methods inherited from KubernetesResource
#<=>, #after_sync, build, class_for_kind, #current_generation, #debug_message, #deploy_method, #deploy_started?, #deploy_timed_out?, #disappeared?, #exists?, #failure_message, #fetch_events, #file_path, #global?, #has_warnings?, #id, #initialize, kind, #kubectl_resource_type, #observed_generation, #pretty_status, #pretty_timeout_type, #report_status_to_statsd, #sensitive_template_content?, #server_dry_run_validated?, #server_dry_runnable_resource?, #sync_debug_info, #terminating?, timeout, #timeout, #timeout_message, #timeout_override, #to_kubeclient_resource, #validate_definition, #validation_error_msg, #validation_failed?, #validation_warning_msg
Constructor Details
This class inherits a constructor from KubernetesDeploy::KubernetesResource
Instance Attribute Details
#pods ⇒ Object (readonly)
Returns the value of attribute pods.
6 7 8 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 6 def pods @pods end |
Instance Method Details
#deploy_failed? ⇒ Boolean
26 27 28 29 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 26 def deploy_failed? pods.present? && pods.any?(&:deploy_failed?) && observed_generation == current_generation end |
#deploy_succeeded? ⇒ Boolean
19 20 21 22 23 24 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 19 def deploy_succeeded? return false unless exists? current_generation == observed_generation && rollout_data["desiredNumberScheduled"].to_i == rollout_data["updatedNumberScheduled"].to_i && relevant_pods_ready? end |
#fetch_debug_logs ⇒ Object
31 32 33 34 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 31 def fetch_debug_logs most_useful_pod = pods.find(&:deploy_failed?) || pods.find(&:deploy_timed_out?) || pods.first most_useful_pod.fetch_debug_logs end |
#print_debug_logs? ⇒ Boolean
36 37 38 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 36 def print_debug_logs? pods.present? # the kubectl command times out if no pods exist end |
#status ⇒ Object
14 15 16 17 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 14 def status return super unless exists? rollout_data.map { |state_replicas, num| "#{num} #{state_replicas}" }.join(", ") end |
#sync(cache) ⇒ Object
8 9 10 11 12 |
# File 'lib/kubernetes-deploy/kubernetes_resource/daemon_set.rb', line 8 def sync(cache) super @pods = exists? ? find_pods(cache) : [] @nodes = find_nodes(cache) if @nodes.blank? end |