metatron 0.1.7 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fda98cad9b41601c8d028c589e9283480d3320914b8c04055f25863b09cf6ac
4
- data.tar.gz: f894ee38131cf57ba700ecf88ab047297f455d8df75aabb14540c53e425876ce
3
+ metadata.gz: 9904b986356c64a1f895a522baf591911fdd4bdce61d47d94b8db3a05148b11f
4
+ data.tar.gz: e5230c29009ef2cbf5c9721fa13ddfc65dad02114dfd4c8fd24e9d6873ae0d47
5
5
  SHA512:
6
- metadata.gz: 796b1c32cba1876e03e70fbf1c580825a9fcb24a28fac0fc0bbdb559ac7810823de4bd1c0852dd5ee4f3c16af72147e643d51d7a9568f2022c8cd102054f2205
7
- data.tar.gz: 2d5c10480b359d1c8ae19dcb7c5fc8a4109b0a37999ff0ed031bac42b148fd75c1f482379dd9bfaffa4c3051dc29c26c623c5a13385e1be30a983ddddf30da04
6
+ metadata.gz: 3886638f6f20c362c519e1ddf5fa1a5067bc00d038d37586c9fc11c5ff887a7f1518b957ef334ffeabe02cae7938f75732f6ef1f68941c80fe70f66c9bbc5804
7
+ data.tar.gz: 71b9e8ec7e997d71c4369caef8a6f45d74ee6e9120a01a6d8d5723057dd8c76d954cd879df94365050ae2bcf2786f2415578c32ec8d70eebe23049b79cc3a0d9
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metatron (0.1.7)
4
+ metatron (0.1.9)
5
5
  json (~> 2.6)
6
- puma (~> 5.6)
6
+ puma (~> 6.3)
7
7
  sinatra (~> 2.2)
8
8
  sinatra-contrib (~> 2.2)
9
9
 
@@ -17,34 +17,37 @@ GEM
17
17
  diff-lcs (1.5.0)
18
18
  docile (1.4.0)
19
19
  e2mmap (0.1.0)
20
- jaro_winkler (1.5.4)
20
+ jaro_winkler (1.5.6)
21
21
  json (2.6.3)
22
22
  kramdown (2.4.0)
23
23
  rexml
24
24
  kramdown-parser-gfm (1.1.0)
25
25
  kramdown (~> 2.0)
26
+ language_server-protocol (3.17.0.3)
26
27
  multi_json (1.15.0)
27
28
  mustermann (2.0.2)
28
29
  ruby2_keywords (~> 0.0.1)
29
30
  nio4r (2.5.9)
30
- nokogiri (1.14.2-arm64-darwin)
31
+ nokogiri (1.15.3-arm64-darwin)
31
32
  racc (~> 1.4)
32
- nokogiri (1.14.2-x86_64-linux)
33
+ nokogiri (1.15.3-x86_64-linux)
33
34
  racc (~> 1.4)
34
- parallel (1.22.1)
35
- parser (3.2.2.0)
35
+ parallel (1.23.0)
36
+ parser (3.2.2.3)
36
37
  ast (~> 2.4.1)
37
- puma (5.6.5)
38
+ racc
39
+ puma (6.3.0)
38
40
  nio4r (~> 2.0)
39
- racc (1.6.2)
40
- rack (2.2.6.4)
41
+ racc (1.7.1)
42
+ rack (2.2.7)
41
43
  rack-protection (2.2.4)
42
44
  rack
43
45
  rack-test (2.1.0)
44
46
  rack (>= 1.3)
45
47
  rainbow (3.1.1)
46
48
  rake (12.3.3)
47
- regexp_parser (2.7.0)
49
+ rbs (2.8.4)
50
+ regexp_parser (2.8.1)
48
51
  reverse_markdown (2.1.1)
49
52
  nokogiri
50
53
  rexml (3.2.5)
@@ -52,34 +55,38 @@ GEM
52
55
  rspec-core (~> 3.12.0)
53
56
  rspec-expectations (~> 3.12.0)
54
57
  rspec-mocks (~> 3.12.0)
55
- rspec-core (3.12.1)
58
+ rspec-core (3.12.2)
56
59
  rspec-support (~> 3.12.0)
57
- rspec-expectations (3.12.2)
60
+ rspec-expectations (3.12.3)
58
61
  diff-lcs (>= 1.2.0, < 2.0)
59
62
  rspec-support (~> 3.12.0)
60
- rspec-mocks (3.12.5)
63
+ rspec-mocks (3.12.6)
61
64
  diff-lcs (>= 1.2.0, < 2.0)
62
65
  rspec-support (~> 3.12.0)
63
- rspec-support (3.12.0)
64
- rubocop (1.49.0)
66
+ rspec-support (3.12.1)
67
+ rubocop (1.55.0)
65
68
  json (~> 2.3)
69
+ language_server-protocol (>= 3.17.0)
66
70
  parallel (~> 1.10)
67
- parser (>= 3.2.0.0)
71
+ parser (>= 3.2.2.3)
68
72
  rainbow (>= 2.2.2, < 4.0)
69
73
  regexp_parser (>= 1.8, < 3.0)
70
74
  rexml (>= 3.2.5, < 4.0)
71
- rubocop-ast (>= 1.28.0, < 2.0)
75
+ rubocop-ast (>= 1.28.1, < 2.0)
72
76
  ruby-progressbar (~> 1.7)
73
77
  unicode-display_width (>= 2.4.0, < 3.0)
74
- rubocop-ast (1.28.0)
78
+ rubocop-ast (1.29.0)
75
79
  parser (>= 3.2.1.0)
76
- rubocop-capybara (2.17.1)
80
+ rubocop-capybara (2.18.0)
77
81
  rubocop (~> 1.41)
82
+ rubocop-factory_bot (2.23.1)
83
+ rubocop (~> 1.33)
78
84
  rubocop-rake (0.6.0)
79
85
  rubocop (~> 1.0)
80
- rubocop-rspec (2.19.0)
86
+ rubocop-rspec (2.22.0)
81
87
  rubocop (~> 1.33)
82
88
  rubocop-capybara (~> 2.17)
89
+ rubocop-factory_bot (~> 2.22)
83
90
  ruby-progressbar (1.13.0)
84
91
  ruby2_keywords (0.0.5)
85
92
  simplecov (0.22.0)
@@ -102,30 +109,28 @@ GEM
102
109
  rack-protection (= 2.2.4)
103
110
  sinatra (= 2.2.4)
104
111
  tilt (~> 2.0)
105
- solargraph (0.48.0)
112
+ solargraph (0.49.0)
106
113
  backport (~> 1.2)
107
114
  benchmark
108
- bundler (>= 1.17.2)
115
+ bundler (~> 2.0)
109
116
  diff-lcs (~> 1.4)
110
117
  e2mmap
111
118
  jaro_winkler (~> 1.5)
112
119
  kramdown (~> 2.3)
113
120
  kramdown-parser-gfm (~> 1.1)
114
121
  parser (~> 3.0)
115
- reverse_markdown (>= 1.0.5, < 3)
116
- rubocop (>= 0.52)
122
+ rbs (~> 2.0)
123
+ reverse_markdown (~> 2.0)
124
+ rubocop (~> 1.38)
117
125
  thor (~> 1.0)
118
126
  tilt (~> 2.0)
119
127
  yard (~> 0.9, >= 0.9.24)
120
- thor (1.2.1)
121
- tilt (2.1.0)
128
+ thor (1.2.2)
129
+ tilt (2.2.0)
122
130
  unicode-display_width (2.4.2)
123
- webrick (1.7.0)
124
- yard (0.9.28)
125
- webrick (~> 1.7.0)
131
+ yard (0.9.34)
126
132
 
127
133
  PLATFORMS
128
- arm64-darwin-21
129
134
  arm64-darwin-22
130
135
  x86_64-linux
131
136
 
@@ -145,4 +150,4 @@ DEPENDENCIES
145
150
  yard (~> 0.9)
146
151
 
147
152
  BUNDLED WITH
148
- 2.4.6
153
+ 2.4.17
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metatron
4
+ module Templates
5
+ module Concerns
6
+ # Makes supporting namespaced resources easier
7
+ module Namespaced
8
+ def self.included(base)
9
+ # base.extend ClassMethods
10
+ base.class_eval do
11
+ attr_accessor :namespace
12
+
13
+ initializer :namespaced_initialize
14
+ end
15
+ end
16
+
17
+ def namespaced_initialize
18
+ @namespace = nil
19
+ end
20
+
21
+ def formatted_namespace
22
+ if namespace
23
+ { namespace: namespace.is_a?(Namespace) ? namespace.name : namespace }
24
+ else
25
+ {}
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -5,6 +5,7 @@ module Metatron
5
5
  # The ConfigMap Kubernetes resource
6
6
  class ConfigMap < Template
7
7
  include Concerns::Annotated
8
+ include Concerns::Namespaced
8
9
 
9
10
  attr_accessor :additional_labels, :type, :data
10
11
 
@@ -21,7 +22,7 @@ module Metatron
21
22
  metadata: {
22
23
  name:,
23
24
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
24
- }.merge(formatted_annotations),
25
+ }.merge(formatted_annotations).merge(formatted_namespace),
25
26
  data:
26
27
  }
27
28
  end
@@ -5,6 +5,7 @@ module Metatron
5
5
  # The DaemonSet Kubernetes resource
6
6
  class DaemonSet < Template
7
7
  include Concerns::Annotated
8
+ include Concerns::Namespaced
8
9
  include Concerns::PodProducer
9
10
 
10
11
  attr_accessor :replicas, :additional_labels
@@ -23,7 +24,7 @@ module Metatron
23
24
  metadata: {
24
25
  name:,
25
26
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
26
- }.merge(formatted_annotations),
27
+ }.merge(formatted_annotations).merge(formatted_namespace),
27
28
  spec: {
28
29
  selector: {
29
30
  matchLabels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
@@ -5,6 +5,7 @@ module Metatron
5
5
  # The Deployment Kubernetes resource
6
6
  class Deployment < Template
7
7
  include Concerns::Annotated
8
+ include Concerns::Namespaced
8
9
  include Concerns::PodProducer
9
10
 
10
11
  attr_accessor :replicas, :additional_labels
@@ -34,7 +35,7 @@ module Metatron
34
35
  template: {
35
36
  metadata: {
36
37
  labels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
37
- }.merge(formatted_pod_annotations),
38
+ }.merge(formatted_pod_annotations).merge(formatted_namespace),
38
39
  spec: {
39
40
  terminationGracePeriodSeconds:,
40
41
  containers: [
@@ -4,6 +4,8 @@ module Metatron
4
4
  module Templates
5
5
  # Template for basic Ingress k8s resource
6
6
  class Ingress < Template
7
+ include Concerns::Namespaced
8
+
7
9
  attr_accessor :ingress_class, :additional_labels, :additional_annotations, :rules, :tls,
8
10
  :cert_manager_cluster_issuer, :cert_manager_issuer, :cert_manager_challenge_type
9
11
 
@@ -45,7 +47,7 @@ module Metatron
45
47
  cert_manager[:"cert-manager.io/cluster-issuer"] = cert_manager_cluster_issuer
46
48
  end
47
49
  unless cert_manager.empty?
48
- cert_manager[:"cert-manager.io/acme-challenge-type"] = \
50
+ cert_manager[:"cert-manager.io/acme-challenge-type"] =
49
51
  cert_manager_challenge_type || "http01"
50
52
  end
51
53
 
@@ -76,7 +78,7 @@ module Metatron
76
78
  metadata: {
77
79
  name:,
78
80
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
79
- }.merge(formatted_annotations),
81
+ }.merge(formatted_annotations).merge(formatted_namespace),
80
82
  spec: formatted_rules.merge(formatted_tls)
81
83
  }
82
84
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metatron
4
+ module Templates
5
+ # Template for basic Namespace k8s resource
6
+ class Namespace < Template
7
+ attr_accessor :additional_labels
8
+
9
+ def initialize(name)
10
+ super(name)
11
+ @additional_labels = {}
12
+ end
13
+
14
+ def render
15
+ {
16
+ apiVersion:,
17
+ kind:,
18
+ metadata: {
19
+ name:,
20
+ labels: { "#{label_namespace}/name": name }.merge(additional_labels)
21
+ }.merge(formatted_annotations)
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
@@ -5,6 +5,7 @@ module Metatron
5
5
  # The PersistentVolumeClaim Kubernetes resource
6
6
  class PersistentVolumeClaim < Template
7
7
  include Concerns::Annotated
8
+ include Concerns::Namespaced
8
9
 
9
10
  attr_accessor :additional_labels, :storage_class, :access_modes, :storage
10
11
 
@@ -28,7 +29,7 @@ module Metatron
28
29
  metadata: {
29
30
  name:,
30
31
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
31
- }.merge(formatted_annotations),
32
+ }.merge(formatted_annotations).merge(formatted_namespace),
32
33
  spec: {
33
34
  accessModes: access_modes,
34
35
  storageClassName: storage_class,
@@ -6,6 +6,7 @@ module Metatron
6
6
  class Pod < Template
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
+ include Concerns::Namespaced
9
10
 
10
11
  # rubocop:disable Metrics/MethodLength
11
12
  # rubocop:disable Metrics/AbcSize
@@ -16,7 +17,7 @@ module Metatron
16
17
  metadata: {
17
18
  labels: { "#{label_namespace}/name": name }.merge(additional_labels),
18
19
  name:
19
- }.merge(formatted_annotations),
20
+ }.merge(formatted_annotations).merge(formatted_namespace),
20
21
  spec: {
21
22
  terminationGracePeriodSeconds:,
22
23
  containers: [
@@ -6,6 +6,7 @@ module Metatron
6
6
  class ReplicaSet < Template
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
+ include Concerns::Namespaced
9
10
 
10
11
  attr_accessor :replicas, :additional_labels
11
12
 
@@ -24,7 +25,7 @@ module Metatron
24
25
  metadata: {
25
26
  name:,
26
27
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
27
- }.merge(formatted_annotations),
28
+ }.merge(formatted_annotations).merge(formatted_namespace),
28
29
  spec: {
29
30
  replicas:,
30
31
  selector: {
@@ -5,6 +5,7 @@ module Metatron
5
5
  # The Secret Kubernetes resource
6
6
  class Secret < Template
7
7
  include Concerns::Annotated
8
+ include Concerns::Namespaced
8
9
 
9
10
  attr_accessor :additional_labels, :type, :data
10
11
 
@@ -22,7 +23,7 @@ module Metatron
22
23
  metadata: {
23
24
  name:,
24
25
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
25
- }.merge(formatted_annotations),
26
+ }.merge(formatted_annotations).merge(formatted_namespace),
26
27
  type:,
27
28
  stringData: data
28
29
  }
@@ -5,6 +5,7 @@ module Metatron
5
5
  # The Service Kubernetes resource
6
6
  class Service < Template
7
7
  include Concerns::Annotated
8
+ include Concerns::Namespaced
8
9
 
9
10
  attr_accessor :type, :selector, :additional_labels, :ports,
10
11
  :additional_selector_labels, :publish_not_ready_addresses
@@ -41,7 +42,7 @@ module Metatron
41
42
  metadata: {
42
43
  name:,
43
44
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
44
- }.merge(formatted_annotations),
45
+ }.merge(formatted_annotations).merge(formatted_namespace),
45
46
  spec: {
46
47
  type:,
47
48
  selector: selector.merge(additional_selector_labels),
@@ -6,6 +6,7 @@ module Metatron
6
6
  class StatefulSet < Template
7
7
  include Concerns::Annotated
8
8
  include Concerns::PodProducer
9
+ include Concerns::Namespaced
9
10
 
10
11
  attr_accessor :replicas, :service_name, :pod_management_policy, :enable_service_links
11
12
 
@@ -31,7 +32,7 @@ module Metatron
31
32
  metadata: {
32
33
  name:,
33
34
  labels: { "#{label_namespace}/name": name }.merge(additional_labels)
34
- }.merge(formatted_annotations),
35
+ }.merge(formatted_annotations).merge(formatted_namespace),
35
36
  spec: {
36
37
  replicas:,
37
38
  serviceName:,
@@ -4,6 +4,6 @@ module Metatron
4
4
  VERSION = [
5
5
  0, # major
6
6
  1, # minor
7
- 7 # patch
7
+ 9 # patch
8
8
  ].join(".")
9
9
  end
data/lib/metatron.rb CHANGED
@@ -26,11 +26,13 @@ end
26
26
  require "metatron/version"
27
27
  require "metatron/template"
28
28
  require "metatron/templates/concerns/annotated"
29
+ require "metatron/templates/concerns/namespaced"
29
30
  require "metatron/templates/concerns/pod_producer"
30
31
  require "metatron/templates/pod"
31
32
  require "metatron/templates/persistent_volume_claim"
32
33
  require "metatron/templates/deployment"
33
34
  require "metatron/templates/ingress"
35
+ require "metatron/templates/namespace"
34
36
  require "metatron/templates/replica_set"
35
37
  require "metatron/templates/config_map"
36
38
  require "metatron/templates/secret"
data/metatron.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = "~> 3.1"
28
28
 
29
29
  spec.add_runtime_dependency "json", "~> 2.6"
30
- spec.add_runtime_dependency "puma", "~> 5.6"
30
+ spec.add_runtime_dependency "puma", "~> 6.3"
31
31
  spec.add_runtime_dependency "sinatra", "~> 2.2"
32
32
  spec.add_runtime_dependency "sinatra-contrib", "~> 2.2"
33
33
 
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.7
4
+ version: 0.1.9
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-04-04 00:00:00.000000000 Z
11
+ date: 2023-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.6'
33
+ version: '6.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.6'
40
+ version: '6.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sinatra
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -257,11 +257,13 @@ files:
257
257
  - lib/metatron/sync_controller.rb
258
258
  - lib/metatron/template.rb
259
259
  - lib/metatron/templates/concerns/annotated.rb
260
+ - lib/metatron/templates/concerns/namespaced.rb
260
261
  - lib/metatron/templates/concerns/pod_producer.rb
261
262
  - lib/metatron/templates/config_map.rb
262
263
  - lib/metatron/templates/daemon_set.rb
263
264
  - lib/metatron/templates/deployment.rb
264
265
  - lib/metatron/templates/ingress.rb
266
+ - lib/metatron/templates/namespace.rb
265
267
  - lib/metatron/templates/persistent_volume_claim.rb
266
268
  - lib/metatron/templates/pod.rb
267
269
  - lib/metatron/templates/replica_set.rb