Class: Krane::PersistentVolumeClaim::StorageClass

Inherits:
KubernetesResource show all
Defined in:
lib/krane/kubernetes_resource/persistent_volume_claim.rb

Constant Summary collapse

DEFAULT_CLASS_ANNOTATION =
"storageclass.kubernetes.io/is-default-class"
DEFAULT_CLASS_BETA_ANNOTATION =
"storageclass.beta.kubernetes.io/is-default-class"

Constants inherited from KubernetesResource

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::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::SYNC_DEPENDENCIES, KubernetesResource::TIMEOUT, KubernetesResource::TIMEOUT_OVERRIDE_ANNOTATION, KubernetesResource::UNUSUAL_FAILURE_MESSAGE

Instance Attribute Summary collapse

Attributes inherited from KubernetesResource

#context, #deploy_started_at, #global, #namespace, #type

Instance Method Summary collapse

Methods inherited from KubernetesResource

#<=>, #after_sync, build, class_for_kind, #current_generation, #debug_message, #deploy_failed?, #deploy_method, #deploy_method_override, #deploy_started?, #deploy_succeeded?, #deploy_timed_out?, #disappeared?, #exists?, #failure_message, #fetch_events, #file_path, #global?, #group, #id, 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?, #status, #sync, #sync_debug_info, #terminating?, timeout, #timeout, #timeout_message, #timeout_override, #to_kubeclient_resource, #use_generated_name, #uses_generate_name?, #validate_definition, #validation_error_msg, #validation_failed?, #version

Constructor Details

#initialize(definition) ⇒ StorageClass

Returns a new instance of StorageClass.


65
66
67
68
69
# File 'lib/krane/kubernetes_resource/persistent_volume_claim.rb', line 65

def initialize(definition)
  super(definition: definition, namespace: nil, context: nil, logger: nil)
  @definition = definition
  @name = definition.dig("metadata", "name").to_s
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.


63
64
65
# File 'lib/krane/kubernetes_resource/persistent_volume_claim.rb', line 63

def name
  @name
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)

75
76
77
78
# File 'lib/krane/kubernetes_resource/persistent_volume_claim.rb', line 75

def default?
  @definition.dig("metadata", "annotations", DEFAULT_CLASS_ANNOTATION) == "true" ||
  @definition.dig("metadata", "annotations", DEFAULT_CLASS_BETA_ANNOTATION) == "true"
end

#volume_binding_modeObject


71
72
73
# File 'lib/krane/kubernetes_resource/persistent_volume_claim.rb', line 71

def volume_binding_mode
  @definition.dig("volumeBindingMode")
end