Class: Metatron::Templates::HorizontalPodAutoscaler
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::HorizontalPodAutoscaler
- Includes:
- Concerns::Annotated, Concerns::Namespaced
- Defined in:
- lib/metatron/templates/horizontal_pod_autoscaler.rb
Overview
Template for HorizontalPodAutoscaler v2 k8s resource
Instance Attribute Summary collapse
-
#behavior ⇒ Object
Returns the value of attribute behavior.
-
#max_replicas ⇒ Object
(also: #maxReplicas)
Returns the value of attribute max_replicas.
-
#metrics ⇒ Object
Returns the value of attribute metrics.
-
#min_replicas ⇒ Object
(also: #minReplicas)
Returns the value of attribute min_replicas.
-
#scale_target_ref ⇒ Object
(also: #scaleTargetRef)
Returns the value of attribute scale_target_ref.
Attributes inherited from Metatron::Template
#additional_labels, #api_version, #base_labels, #kind, #name
Instance Method Summary collapse
-
#initialize(name) ⇒ HorizontalPodAutoscaler
constructor
A new instance of HorizontalPodAutoscaler.
- #render ⇒ Object
Methods included from Concerns::Namespaced
#formatted_namespace, included, #namespaced_initialize
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) ⇒ HorizontalPodAutoscaler
Returns a new instance of HorizontalPodAutoscaler.
16 17 18 19 20 21 22 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 16 def initialize(name) super @api_version = "autoscaling/v2" @min_replicas = nil @max_replicas = 1 @scale_target_ref = { apiVersion: "apps/v1", kind: "Deployment", name: name } end |
Instance Attribute Details
#behavior ⇒ Object
Returns the value of attribute behavior.
10 11 12 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 10 def behavior @behavior end |
#max_replicas ⇒ Object Also known as: maxReplicas
Returns the value of attribute max_replicas.
10 11 12 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 10 def max_replicas @max_replicas end |
#metrics ⇒ Object
Returns the value of attribute metrics.
10 11 12 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 10 def metrics @metrics end |
#min_replicas ⇒ Object Also known as: minReplicas
Returns the value of attribute min_replicas.
10 11 12 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 10 def min_replicas @min_replicas end |
#scale_target_ref ⇒ Object Also known as: scaleTargetRef
Returns the value of attribute scale_target_ref.
10 11 12 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 10 def scale_target_ref @scale_target_ref end |
Instance Method Details
#render ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/metatron/templates/horizontal_pod_autoscaler.rb', line 24 def render { apiVersion:, kind:, metadata: { name:, labels: base_labels.merge(additional_labels) }.merge(formatted_annotations).merge(formatted_namespace), spec: { scaleTargetRef:, minReplicas:, maxReplicas:, metrics:, behavior: }.compact } end |