metatron 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 992800d829a067dfad529abd2b4ff606df206b32f214e5851a5d30325d087c5a
4
- data.tar.gz: 209c07d8463fdca044763ad0a4cf07b7284ebefd0a4cdf2372d5e80af3b62faf
3
+ metadata.gz: cb96f83faf10f6a33cc85854aef57471ef4f2665f1b8b3acdf204516463dc2d7
4
+ data.tar.gz: eaffb0b7e266634568230857c3dc2b5ec33dab45865ae73e354adfa7da65c537
5
5
  SHA512:
6
- metadata.gz: 5c66266c6808288c3709631e4cac70d0c60122a5589255c9110a0b4ec09460df22fea9ec43fcc3da5339bb935e2d4a5435f3768f95fda63ce47da78ddfebce99
7
- data.tar.gz: 0cf374089c8cc38975cbb96c484c54c37cd769dcc402ceaf4857ba11cd709e4869db951a620d795befc39d900435fbd11fa68bfc5079d3237cf55b6ca012a997
6
+ metadata.gz: db3c512315de81ce4fa904f7b630052e56189505899a3fb1938f21af55760a7335d61ac1cf912571a508f59c49b999514eed89f2f4d3cb616344532416bf3bbd
7
+ data.tar.gz: c8e6b194542157f96ac30511e4e9d15ff63e807bc84d261641c3656e5d992e37703b1164dd3835c454a174b5905c3eb593aaef907e934b4b952dab697ba8e0d4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metatron (0.1.5)
4
+ metatron (0.1.6)
5
5
  json (~> 2.6)
6
6
  puma (~> 5.6)
7
7
  sinatra (~> 2.2)
@@ -8,11 +8,11 @@ module Metatron
8
8
  def self.included(base)
9
9
  # base.extend ClassMethods
10
10
  base.class_eval do
11
- attr_accessor :image, :image_pull_policy, :additional_labels, :env, :envfrom,
11
+ attr_accessor :image, :image_pull_policy, :additional_labels, :additional_pod_labels,
12
12
  :resource_limits, :resource_requests, :probes, :ports, :security_context,
13
- :volume_mounts, :volumes, :additional_containers,
13
+ :volume_mounts, :volumes, :additional_containers, :env, :envfrom,
14
14
  :container_security_context, :affinity, :termination_grace_period_seconds,
15
- :tolerations
15
+ :tolerations, :pod_annotations
16
16
 
17
17
  initializer :pod_producer_initialize
18
18
 
@@ -40,6 +40,8 @@ module Metatron
40
40
  @container_security_context = {}
41
41
  @additional_containers = []
42
42
  @additional_labels = {}
43
+ @additional_pod_labels = {}
44
+ @pod_annotations = {}
43
45
  @termination_grace_period_seconds = 60
44
46
  @tolerations = []
45
47
  end
@@ -58,6 +60,10 @@ module Metatron
58
60
  end
59
61
  end
60
62
 
63
+ def formatted_pod_annotations
64
+ pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
65
+ end
66
+
61
67
  def formatted_ports = ports&.any? ? { ports: } : {}
62
68
 
63
69
  def formatted_security_context
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metatron
4
+ module Templates
5
+ # The ConfigMap Kubernetes resource
6
+ class ConfigMap < Template
7
+ include Concerns::Annotated
8
+
9
+ attr_accessor :additional_labels, :type, :data
10
+
11
+ def initialize(name, data = {})
12
+ super(name)
13
+ @data = data
14
+ @additional_labels = {}
15
+ end
16
+
17
+ def render
18
+ {
19
+ apiVersion:,
20
+ kind:,
21
+ metadata: {
22
+ name:,
23
+ labels: { "#{label_namespace}/name": name }.merge(additional_labels)
24
+ }.merge(formatted_annotations),
25
+ data:
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -7,18 +7,11 @@ module Metatron
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
9
 
10
- attr_accessor :replicas, :pod_annotations,
11
- :additional_labels, :additional_pod_labels
10
+ attr_accessor :replicas, :additional_labels
12
11
 
13
12
  def initialize(name)
14
13
  super(name)
15
14
  @api_version = "apps/v1"
16
- @pod_annotations = {}
17
- @additional_pod_labels = {}
18
- end
19
-
20
- def formatted_pod_annotations
21
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
22
15
  end
23
16
 
24
17
  # rubocop:disable Metrics/MethodLength
@@ -7,19 +7,12 @@ module Metatron
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
9
 
10
- attr_accessor :replicas, :pod_annotations,
11
- :additional_labels, :additional_pod_labels
10
+ attr_accessor :replicas, :additional_labels
12
11
 
13
12
  def initialize(name, replicas: 2)
14
13
  super(name)
15
14
  @api_version = "apps/v1"
16
15
  @replicas = replicas
17
- @pod_annotations = {}
18
- @additional_pod_labels = {}
19
- end
20
-
21
- def formatted_pod_annotations
22
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
23
16
  end
24
17
 
25
18
  # rubocop:disable Metrics/MethodLength
@@ -7,19 +7,12 @@ module Metatron
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
9
 
10
- attr_accessor :replicas, :pod_annotations,
11
- :additional_labels, :additional_pod_labels
10
+ attr_accessor :replicas, :additional_labels
12
11
 
13
12
  def initialize(name, replicas: 2)
14
13
  super(name)
15
14
  @api_version = "apps/v1"
16
15
  @replicas = replicas
17
- @pod_annotations = {}
18
- @additional_pod_labels = {}
19
- end
20
-
21
- def formatted_pod_annotations
22
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
23
16
  end
24
17
 
25
18
  # rubocop:disable Metrics/MethodLength
@@ -7,17 +7,13 @@ module Metatron
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
9
 
10
- attr_accessor :replicas, :pod_annotations, :service_name,
11
- :pod_management_policy, :enable_service_links,
12
- :additional_pod_labels
10
+ attr_accessor :replicas, :service_name, :pod_management_policy, :enable_service_links
13
11
 
14
12
  def initialize(name, replicas: 1)
15
13
  super(name)
16
14
  @replicas = replicas
17
15
  @api_version = "apps/v1"
18
- @pod_annotations = {}
19
16
  @pod_management_policy = "OrderedReady"
20
- @additional_pod_labels = {}
21
17
  @enable_service_links = true
22
18
  @service_name = name
23
19
  end
@@ -26,10 +22,6 @@ module Metatron
26
22
  alias podManagementPolicy pod_management_policy
27
23
  alias serviceName service_name
28
24
 
29
- def formatted_pod_annotations
30
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
31
- end
32
-
33
25
  # rubocop:disable Metrics/MethodLength
34
26
  # rubocop:disable Metrics/AbcSize
35
27
  def render
@@ -4,6 +4,6 @@ module Metatron
4
4
  VERSION = [
5
5
  0, # major
6
6
  1, # minor
7
- 5 # patch
7
+ 6 # patch
8
8
  ].join(".")
9
9
  end
data/lib/metatron.rb CHANGED
@@ -11,7 +11,7 @@ require "logger"
11
11
  require "sinatra/base"
12
12
  require "sinatra/custom_logger"
13
13
 
14
- # The top-level module for Bullion
14
+ # The top-level module for Metatron
15
15
  module Metatron
16
16
  class Error < StandardError; end
17
17
  class ConfigError < Error; end
@@ -32,6 +32,7 @@ require "metatron/templates/persistent_volume_claim"
32
32
  require "metatron/templates/deployment"
33
33
  require "metatron/templates/ingress"
34
34
  require "metatron/templates/replica_set"
35
+ require "metatron/templates/config_map"
35
36
  require "metatron/templates/secret"
36
37
  require "metatron/templates/service"
37
38
  require "metatron/templates/stateful_set"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metatron
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Gnagy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-23 00:00:00.000000000 Z
11
+ date: 2023-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -258,6 +258,7 @@ files:
258
258
  - lib/metatron/template.rb
259
259
  - lib/metatron/templates/concerns/annotated.rb
260
260
  - lib/metatron/templates/concerns/pod_producer.rb
261
+ - lib/metatron/templates/config_map.rb
261
262
  - lib/metatron/templates/daemon_set.rb
262
263
  - lib/metatron/templates/deployment.rb
263
264
  - lib/metatron/templates/ingress.rb