Class: Metatron::Templates::ReplicaSet
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::ReplicaSet
- Defined in:
- lib/metatron/templates/replica_set.rb
Overview
The ReplicaSet Kubernetes resource
Instance Attribute Summary collapse
-
#additional_labels ⇒ Object
Returns the value of attribute additional_labels.
-
#replicas ⇒ Object
Returns the value of attribute replicas.
Attributes inherited from Metatron::Template
#api_version, #base_labels, #kind, #name
Instance Method Summary collapse
-
#initialize(name, replicas: 2) ⇒ ReplicaSet
constructor
A new instance of ReplicaSet.
- #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: 2) ⇒ ReplicaSet
Returns a new instance of ReplicaSet.
13 14 15 16 17 |
# File 'lib/metatron/templates/replica_set.rb', line 13 def initialize(name, replicas: 2) super(name) @api_version = "apps/v1" @replicas = replicas end |
Instance Attribute Details
#additional_labels ⇒ Object
Returns the value of attribute additional_labels.
11 12 13 |
# File 'lib/metatron/templates/replica_set.rb', line 11 def additional_labels @additional_labels end |
#replicas ⇒ Object
Returns the value of attribute replicas.
11 12 13 |
# File 'lib/metatron/templates/replica_set.rb', line 11 def replicas @replicas end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/metatron/templates/replica_set.rb', line 19 def render { apiVersion:, kind:, metadata: { name:, labels: base_labels.merge(additional_labels) }.merge(formatted_annotations).merge(formatted_namespace), spec: { replicas:, selector: { matchLabels: base_labels.merge(additional_pod_match_labels) } }.merge(pod_template) } end |