Class: Krane::CustomResourceDefinition
Constant Summary
collapse
- TIMEOUT =
2.minutes
- ROLLOUT_CONDITIONS_ANNOTATION =
"instance-rollout-conditions"
- TIMEOUT_FOR_INSTANCE_ANNOTATION =
"instance-timeout"
- GLOBAL =
true
KubernetesResource::ALLOWED_DEPLOY_METHOD_OVERRIDES, KubernetesResource::DEBUG_RESOURCE_NOT_FOUND_MESSAGE, KubernetesResource::DEPLOY_METHOD_OVERRIDE_ANNOTATION, KubernetesResource::DISABLED_EVENT_INFO_MESSAGE, KubernetesResource::DISABLED_LOG_INFO_MESSAGE, KubernetesResource::DISABLE_FETCHING_EVENT_INFO, KubernetesResource::DISABLE_FETCHING_LOG_INFO, 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::SYNC_DEPENDENCIES, KubernetesResource::TIMEOUT_OVERRIDE_ANNOTATION, KubernetesResource::UNUSUAL_FAILURE_MESSAGE
Instance Attribute Summary
#context, #deploy_started_at, #global, #name, #namespace, #type
Instance Method Summary
collapse
#<=>, #after_sync, build, class_for_kind, #current_generation, #debug_message, #deploy_method, #deploy_method_override, #deploy_started?, #deploy_timed_out?, #disappeared?, #exists?, #failure_message, #fetch_events, #file_path, #global?, #id, #initialize, kind, #kubectl_resource_type, #observed_generation, #pretty_status, #pretty_timeout_type, #report_status_to_statsd, #selected?, #sensitive_template_content?, #server_dry_run_validated?, #server_dry_runnable_resource?, #sync, #sync_debug_info, #terminating?, timeout, #timeout, #timeout_override, #to_kubeclient_resource, #use_generated_name, #uses_generate_name?, #validation_error_msg, #validation_failed?
Instance Method Details
#deploy_failed? ⇒ Boolean
13
14
15
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 13
def deploy_failed?
names_accepted_status == "False"
end
|
#deploy_succeeded? ⇒ Boolean
9
10
11
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 9
def deploy_succeeded?
names_accepted_status == "True"
end
|
#group ⇒ Object
51
52
53
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 51
def group
@definition.dig("spec", "group")
end
|
#group_version_kind ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 38
def group_version_kind
group = @definition.dig("spec", "group")
version = @definition.dig("spec", "versions", 0, "name")
"#{group}/#{version}/#{kind}"
end
|
#kind ⇒ Object
47
48
49
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 47
def kind
@definition.dig("spec", "names", "kind")
end
|
#predeployed? ⇒ Boolean
60
61
62
63
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 60
def predeployed?
predeployed = krane_annotation_value("predeployed")
predeployed.nil? || predeployed == "true"
end
|
#prunable? ⇒ Boolean
55
56
57
58
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 55
def prunable?
prunable = krane_annotation_value("prunable")
prunable == "true"
end
|
#rollout_conditions ⇒ Object
#status ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 28
def status
if !exists?
super
elsif deploy_succeeded?
"Names accepted"
else
"#{names_accepted_condition['reason']} (#{names_accepted_condition['message']})"
end
end
|
#timeout_for_instance ⇒ Object
#timeout_message ⇒ Object
17
18
19
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 17
def timeout_message
"The names this CRD is attempting to register were neither accepted nor rejected in time"
end
|
#validate_definition ⇒ Object
75
76
77
78
79
80
81
82
|
# File 'lib/krane/kubernetes_resource/custom_resource_definition.rb', line 75
def validate_definition(*, **)
super
validate_rollout_conditions
rescue RolloutConditionsError => e
@validation_errors << "Annotation #{Annotation.for(ROLLOUT_CONDITIONS_ANNOTATION)} " \
"on #{name} is invalid: #{e}"
end
|
#validate_rollout_conditions ⇒ Object