Class: Metatron::Templates::StatefulSet
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::StatefulSet
- Defined in:
- lib/metatron/templates/stateful_set.rb
Overview
Template for basic StatefulSet k8s resource
Instance Attribute Summary collapse
-
#pod_management_policy ⇒ Object
(also: #podManagementPolicy)
Returns the value of attribute pod_management_policy.
-
#replicas ⇒ Object
Returns the value of attribute replicas.
-
#service_name ⇒ Object
(also: #serviceName)
Returns the value of attribute service_name.
-
#update_strategy ⇒ Object
(also: #strategy, #updateStrategy)
Returns the value of attribute update_strategy.
Attributes inherited from Metatron::Template
#additional_labels, #api_version, #base_labels, #kind, #name
Instance Method Summary collapse
-
#initialize(name, replicas: 1) ⇒ StatefulSet
constructor
A new instance of StatefulSet.
- #render ⇒ Object
Methods included from Concerns::Namespaced
#formatted_namespace, included, #namespaced_initialize
Methods included from Concerns::PodProducer
#formatted_affinity, #formatted_containers, #formatted_image_pull_secrets, #formatted_init_containers, #formatted_node_selector, #formatted_pod_annotations, #formatted_priority_class_name, #formatted_security_context, #formatted_tolerations, #formatted_volumes, included, #pod_metadata, #pod_producer_initialize, #pod_spec, #pod_template, #volume_claim_templates
Methods included from Concerns::Annotated
#annotated_initialize, #formatted_annotations, included
Methods inherited from Metatron::Template
initializer, initializers, metatron_template_class?, nearest_metatron_ancestor
Constructor Details
#initialize(name, replicas: 1) ⇒ StatefulSet
Returns a new instance of StatefulSet.
13 14 15 16 17 18 19 |
# File 'lib/metatron/templates/stateful_set.rb', line 13 def initialize(name, replicas: 1) super(name) @replicas = replicas @api_version = "apps/v1" @pod_management_policy = "OrderedReady" @service_name = name end |
Instance Attribute Details
#pod_management_policy ⇒ Object Also known as: podManagementPolicy
Returns the value of attribute pod_management_policy.
11 12 13 |
# File 'lib/metatron/templates/stateful_set.rb', line 11 def pod_management_policy @pod_management_policy end |
#replicas ⇒ Object
Returns the value of attribute replicas.
11 12 13 |
# File 'lib/metatron/templates/stateful_set.rb', line 11 def replicas @replicas end |
#service_name ⇒ Object Also known as: serviceName
Returns the value of attribute service_name.
11 12 13 |
# File 'lib/metatron/templates/stateful_set.rb', line 11 def service_name @service_name end |
#update_strategy ⇒ Object Also known as: strategy, updateStrategy
Returns the value of attribute update_strategy.
11 12 13 |
# File 'lib/metatron/templates/stateful_set.rb', line 11 def update_strategy @update_strategy end |
Instance Method Details
#render ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/metatron/templates/stateful_set.rb', line 28 def render { apiVersion:, kind:, metadata: { name:, labels: base_labels.merge(additional_labels) }.merge(formatted_annotations).merge(formatted_namespace), spec: { replicas:, serviceName:, updateStrategy:, selector: { matchLabels: base_labels.merge(additional_pod_match_labels) } }.merge(pod_template).merge(volume_claim_templates).compact } end |