Class: Metatron::Templates::ResourceQuota
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::ResourceQuota
- Includes:
- Concerns::Annotated, Concerns::Namespaced
- Defined in:
- lib/metatron/templates/resource_quota.rb
Overview
Template for basic Role k8s resource
Instance Attribute Summary collapse
-
#additional_labels ⇒ Object
Returns the value of attribute additional_labels.
-
#spec ⇒ Object
Returns the value of attribute spec.
Attributes inherited from Metatron::Template
#api_version, #base_labels, #kind, #name
Instance Method Summary collapse
- #formatted_spec ⇒ Object
-
#initialize(name) ⇒ ResourceQuota
constructor
A new instance of ResourceQuota.
- #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) ⇒ ResourceQuota
Returns a new instance of ResourceQuota.
12 13 14 15 16 |
# File 'lib/metatron/templates/resource_quota.rb', line 12 def initialize(name) super @additional_labels = {} @spec = {} end |
Instance Attribute Details
#additional_labels ⇒ Object
Returns the value of attribute additional_labels.
10 11 12 |
# File 'lib/metatron/templates/resource_quota.rb', line 10 def additional_labels @additional_labels end |
#spec ⇒ Object
Returns the value of attribute spec.
10 11 12 |
# File 'lib/metatron/templates/resource_quota.rb', line 10 def spec @spec end |
Instance Method Details
#formatted_spec ⇒ Object
29 |
# File 'lib/metatron/templates/resource_quota.rb', line 29 def formatted_spec = (@spec || {}).empty? ? {} : { spec: } |
#render ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/metatron/templates/resource_quota.rb', line 18 def render { apiVersion:, kind:, metadata: { name:, labels: base_labels.merge(additional_labels) }.merge(formatted_annotations).merge(formatted_namespace).compact }.merge(formatted_spec) end |