metatron 0.1.4 → 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: 37a819a08c08352f187437129f83f9998a84ddf8519ca2b9b59f2e809c95f757
4
- data.tar.gz: ff428cba5a1c1d80d4dff0b54a6e6da81b787c66dd83332fc6ead84c62a14ffd
3
+ metadata.gz: cb96f83faf10f6a33cc85854aef57471ef4f2665f1b8b3acdf204516463dc2d7
4
+ data.tar.gz: eaffb0b7e266634568230857c3dc2b5ec33dab45865ae73e354adfa7da65c537
5
5
  SHA512:
6
- metadata.gz: b53f3d0572ded8a3f88c83501616fb67782e71bf8a54e504733461d468674b8f09ca2af67eba0c840708a47c3a6d803d004454a11941d8fb8f62a85592a74ee7
7
- data.tar.gz: 6b371bff00705c714220a36062bca85038aa14344648de4ee7b9d030b2bd115552b24f6ae48625790c73d5c7886424afb8f3f2c01daf8673da49e20bb8891a32
6
+ metadata.gz: db3c512315de81ce4fa904f7b630052e56189505899a3fb1938f21af55760a7335d61ac1cf912571a508f59c49b999514eed89f2f4d3cb616344532416bf3bbd
7
+ data.tar.gz: c8e6b194542157f96ac30511e4e9d15ff63e807bc84d261641c3656e5d992e37703b1164dd3835c454a174b5905c3eb593aaef907e934b4b952dab697ba8e0d4
data/.roxanne.yml CHANGED
@@ -1,14 +1,14 @@
1
1
  version: 1.0
2
2
  stages:
3
3
  build:
4
- image: ruby:3.1
4
+ image: ruby:3.2
5
5
  scripts:
6
6
  - ./scripts/build.sh
7
7
  test:
8
- image: ruby:3.1
8
+ image: ruby:3.2
9
9
  scripts:
10
10
  - ./scripts/test.sh
11
11
  release:
12
- image: ruby:3.1
12
+ image: ruby:3.2
13
13
  only:
14
14
  - main
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metatron (0.1.4)
4
+ metatron (0.1.6)
5
5
  json (~> 2.6)
6
6
  puma (~> 5.6)
7
7
  sinatra (~> 2.2)
@@ -32,15 +32,15 @@ GEM
32
32
  nokogiri (1.14.2-x86_64-linux)
33
33
  racc (~> 1.4)
34
34
  parallel (1.22.1)
35
- parser (3.2.1.0)
35
+ parser (3.2.1.1)
36
36
  ast (~> 2.4.1)
37
37
  puma (5.6.5)
38
38
  nio4r (~> 2.0)
39
39
  racc (1.6.2)
40
- rack (2.2.6.3)
40
+ rack (2.2.6.4)
41
41
  rack-protection (2.2.4)
42
42
  rack
43
- rack-test (2.0.2)
43
+ rack-test (2.1.0)
44
44
  rack (>= 1.3)
45
45
  rainbow (3.1.1)
46
46
  rake (12.3.3)
@@ -57,11 +57,11 @@ GEM
57
57
  rspec-expectations (3.12.2)
58
58
  diff-lcs (>= 1.2.0, < 2.0)
59
59
  rspec-support (~> 3.12.0)
60
- rspec-mocks (3.12.3)
60
+ rspec-mocks (3.12.4)
61
61
  diff-lcs (>= 1.2.0, < 2.0)
62
62
  rspec-support (~> 3.12.0)
63
63
  rspec-support (3.12.0)
64
- rubocop (1.47.0)
64
+ rubocop (1.48.1)
65
65
  json (~> 2.3)
66
66
  parallel (~> 1.10)
67
67
  parser (>= 3.2.0.0)
@@ -77,7 +77,7 @@ GEM
77
77
  rubocop (~> 1.41)
78
78
  rubocop-rake (0.6.0)
79
79
  rubocop (~> 1.0)
80
- rubocop-rspec (2.18.1)
80
+ rubocop-rspec (2.19.0)
81
81
  rubocop (~> 1.33)
82
82
  rubocop-capybara (~> 2.17)
83
83
  ruby-progressbar (1.13.0)
@@ -10,6 +10,7 @@ module Metatron
10
10
  @name = name
11
11
  @label_namespace = "metatron.therubyist.org"
12
12
  @api_version = "v1"
13
+ @kind = self.class.name.split("::").last
13
14
  run_initializers
14
15
  end
15
16
 
@@ -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,19 +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
- @kind = "DaemonSet"
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
15
  end
24
16
 
25
17
  # rubocop:disable Metrics/MethodLength
@@ -7,20 +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
- @kind = "Deployment"
17
15
  @replicas = replicas
18
- @pod_annotations = {}
19
- @additional_pod_labels = {}
20
- end
21
-
22
- def formatted_pod_annotations
23
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
24
16
  end
25
17
 
26
18
  # rubocop:disable Metrics/MethodLength
@@ -9,10 +9,8 @@ module Metatron
9
9
 
10
10
  def initialize(name, ingress_class = "nginx")
11
11
  super(name)
12
- @name = name
13
12
  @ingress_class = ingress_class
14
13
  @api_version = "networking.k8s.io/v1"
15
- @kind = "Ingress"
16
14
  @additional_labels = {}
17
15
  @additional_annotations = {}
18
16
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metatron
4
+ module Templates
5
+ # The PersistentVolumeClaim Kubernetes resource
6
+ class PersistentVolumeClaim < Template
7
+ include Concerns::Annotated
8
+
9
+ attr_accessor :additional_labels, :storage_class, :access_modes, :storage
10
+
11
+ def initialize(
12
+ name,
13
+ storage_class:,
14
+ storage:,
15
+ access_modes: ["ReadWriteOnce"]
16
+ )
17
+ super(name)
18
+ @storage_class = storage_class
19
+ @access_modes = access_modes
20
+ @storage = storage
21
+ @additional_labels = {}
22
+ end
23
+
24
+ def render
25
+ {
26
+ apiVersion:,
27
+ kind:,
28
+ metadata: {
29
+ name:,
30
+ labels: { "#{label_namespace}/name": name }.merge(additional_labels)
31
+ }.merge(formatted_annotations),
32
+ spec: {
33
+ accessModes: access_modes,
34
+ storageClassName: storage_class,
35
+ resources: {
36
+ requests: {
37
+ storage:
38
+ }
39
+ }
40
+ }
41
+ }
42
+ end
43
+ end
44
+ end
45
+ end
@@ -7,11 +7,6 @@ module Metatron
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
9
 
10
- def initialize(name)
11
- super(name)
12
- @kind = "Pod"
13
- end
14
-
15
10
  # rubocop:disable Metrics/MethodLength
16
11
  # rubocop:disable Metrics/AbcSize
17
12
  def render
@@ -7,20 +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
- @kind = "ReplicaSet"
17
15
  @replicas = replicas
18
- @pod_annotations = {}
19
- @additional_pod_labels = {}
20
- end
21
-
22
- def formatted_pod_annotations
23
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
24
16
  end
25
17
 
26
18
  # rubocop:disable Metrics/MethodLength
@@ -12,7 +12,6 @@ module Metatron
12
12
  super(name)
13
13
  @data = data
14
14
  @additional_labels = {}
15
- @kind = "Secret"
16
15
  @type = "Opaque"
17
16
  end
18
17
 
@@ -11,7 +11,6 @@ module Metatron
11
11
 
12
12
  def initialize(name, port = nil)
13
13
  super(name)
14
- @kind = "Service"
15
14
  @type = "ClusterIP"
16
15
  @selector = { "#{label_namespace}/name": name }
17
16
  @additional_labels = {}
@@ -7,18 +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
- @kind = "StatefulSet"
19
- @pod_annotations = {}
20
16
  @pod_management_policy = "OrderedReady"
21
- @additional_pod_labels = {}
22
17
  @enable_service_links = true
23
18
  @service_name = name
24
19
  end
@@ -27,10 +22,6 @@ module Metatron
27
22
  alias podManagementPolicy pod_management_policy
28
23
  alias serviceName service_name
29
24
 
30
- def formatted_pod_annotations
31
- pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
32
- end
33
-
34
25
  # rubocop:disable Metrics/MethodLength
35
26
  # rubocop:disable Metrics/AbcSize
36
27
  def render
@@ -4,6 +4,6 @@ module Metatron
4
4
  VERSION = [
5
5
  0, # major
6
6
  1, # minor
7
- 4 # 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
@@ -28,9 +28,11 @@ require "metatron/template"
28
28
  require "metatron/templates/concerns/annotated"
29
29
  require "metatron/templates/concerns/pod_producer"
30
30
  require "metatron/templates/pod"
31
+ require "metatron/templates/persistent_volume_claim"
31
32
  require "metatron/templates/deployment"
32
33
  require "metatron/templates/ingress"
33
34
  require "metatron/templates/replica_set"
35
+ require "metatron/templates/config_map"
34
36
  require "metatron/templates/secret"
35
37
  require "metatron/templates/service"
36
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.4
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-04 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,9 +258,11 @@ 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
265
+ - lib/metatron/templates/persistent_volume_claim.rb
264
266
  - lib/metatron/templates/pod.rb
265
267
  - lib/metatron/templates/replica_set.rb
266
268
  - lib/metatron/templates/secret.rb
@@ -292,7 +294,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
294
  - !ruby/object:Gem::Version
293
295
  version: '0'
294
296
  requirements: []
295
- rubygems_version: 3.3.7
297
+ rubygems_version: 3.4.6
296
298
  signing_key:
297
299
  specification_version: 4
298
300
  summary: So meta