Class: Metatron::Templates::Secret

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

Overview

The Secret Kubernetes resource

Instance Attribute Summary collapse

Attributes inherited from Metatron::Template

#api_version, #kind, #label_namespace, #name

Instance Method Summary collapse

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, data = {}) ⇒ Secret

Returns a new instance of Secret.



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

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

Instance Attribute Details

#additional_labelsObject

Returns the value of attribute additional_labels.



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

def additional_labels
  @additional_labels
end

#dataObject

Returns the value of attribute data.



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

def data
  @data
end

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#renderObject



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

def render
  {
    apiVersion:,
    kind:,
    metadata: {
      name:,
      labels: { "#{label_namespace}/name": name }.merge(additional_labels)
    }.merge(formatted_annotations).merge(formatted_namespace).compact,
    type:,
    stringData: data
  }.compact
end