Class: Metatron::Templates::ConfigMap

Inherits:
Metatron::Template show all
Includes:
Metatron::Templates::Concerns::Annotated, Metatron::Templates::Concerns::Namespaced
Defined in:
lib/metatron/templates/config_map.rb

Overview

The ConfigMap Kubernetes resource

Instance Attribute Summary collapse

Attributes inherited from Metatron::Template

#api_version, #kind, #label_namespace, #name

Instance Method Summary collapse

Methods included from Metatron::Templates::Concerns::Namespaced

#formatted_namespace, included, #namespaced_initialize

Methods included from Metatron::Templates::Concerns::Annotated

#annotated_initialize, #formatted_annotations, included

Methods inherited from Metatron::Template

#base_labels, initializer, initializers, metatron_template_class?, nearest_metatron_ancestor

Constructor Details

#initialize(name, data = {}) ⇒ ConfigMap

Returns a new instance of ConfigMap.



12
13
14
15
16
# File 'lib/metatron/templates/config_map.rb', line 12

def initialize(name, data = {})
  super(name)
  @data = data
  @additional_labels = {}
end

Instance Attribute Details

#additional_labelsObject

Returns the value of attribute additional_labels.



10
11
12
# File 'lib/metatron/templates/config_map.rb', line 10

def additional_labels
  @additional_labels
end

#dataObject

Returns the value of attribute data.



10
11
12
# File 'lib/metatron/templates/config_map.rb', line 10

def data
  @data
end

#immutableObject

Returns the value of attribute immutable.



10
11
12
# File 'lib/metatron/templates/config_map.rb', line 10

def immutable
  @immutable
end

Instance Method Details

#immutable?Boolean

Returns:

  • (Boolean)


18
# File 'lib/metatron/templates/config_map.rb', line 18

def immutable? = !!@immutable

#renderObject



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/metatron/templates/config_map.rb', line 20

def render
  {
    apiVersion:,
    kind:,
    metadata: {
      name:,
      labels: base_labels.merge(additional_labels)
    }.merge(formatted_annotations).merge(formatted_namespace).compact,
    data:,
    immutable:
  }.compact
end