metatron 0.1.3 → 0.1.4

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: 7dbb4ce75ed3919fbbb31853a4e7d72a3a93ce85262daa8eb060d762223a8599
4
- data.tar.gz: c94db73669dbe3e00d68a6d883e9c62072a3007545ce8a69e2df26743a4633a8
3
+ metadata.gz: 37a819a08c08352f187437129f83f9998a84ddf8519ca2b9b59f2e809c95f757
4
+ data.tar.gz: ff428cba5a1c1d80d4dff0b54a6e6da81b787c66dd83332fc6ead84c62a14ffd
5
5
  SHA512:
6
- metadata.gz: d8dfc8c8a4863f9bca41f098e546fbd342dfe008c34f92362fcda293d920c9cc686f63532b969a37a364ada8f4bde86f346efd5c37c1223be0c2f305e58f7c99
7
- data.tar.gz: d63951090a4e9729e7ba30249d55b0743a670d4cc6103e3177cc5085f970af010ac72bab9f30a7af29fe668de1c57529ed0225d500b995314693352735ca95e5
6
+ metadata.gz: b53f3d0572ded8a3f88c83501616fb67782e71bf8a54e504733461d468674b8f09ca2af67eba0c840708a47c3a6d803d004454a11941d8fb8f62a85592a74ee7
7
+ data.tar.gz: 6b371bff00705c714220a36062bca85038aa14344648de4ee7b9d030b2bd115552b24f6ae48625790c73d5c7886424afb8f3f2c01daf8673da49e20bb8891a32
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.2.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- metatron (0.1.3)
4
+ metatron (0.1.4)
5
5
  json (~> 2.6)
6
6
  puma (~> 5.6)
7
7
  sinatra (~> 2.2)
@@ -37,7 +37,7 @@ GEM
37
37
  puma (5.6.5)
38
38
  nio4r (~> 2.0)
39
39
  racc (1.6.2)
40
- rack (2.2.6.2)
40
+ rack (2.2.6.3)
41
41
  rack-protection (2.2.4)
42
42
  rack
43
43
  rack-test (2.0.2)
@@ -61,26 +61,26 @@ GEM
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.45.1)
64
+ rubocop (1.47.0)
65
65
  json (~> 2.3)
66
66
  parallel (~> 1.10)
67
67
  parser (>= 3.2.0.0)
68
68
  rainbow (>= 2.2.2, < 4.0)
69
69
  regexp_parser (>= 1.8, < 3.0)
70
70
  rexml (>= 3.2.5, < 4.0)
71
- rubocop-ast (>= 1.24.1, < 2.0)
71
+ rubocop-ast (>= 1.26.0, < 2.0)
72
72
  ruby-progressbar (~> 1.7)
73
73
  unicode-display_width (>= 2.4.0, < 3.0)
74
- rubocop-ast (1.26.0)
74
+ rubocop-ast (1.27.0)
75
75
  parser (>= 3.2.1.0)
76
- rubocop-capybara (2.17.0)
76
+ rubocop-capybara (2.17.1)
77
77
  rubocop (~> 1.41)
78
78
  rubocop-rake (0.6.0)
79
79
  rubocop (~> 1.0)
80
80
  rubocop-rspec (2.18.1)
81
81
  rubocop (~> 1.33)
82
82
  rubocop-capybara (~> 2.17)
83
- ruby-progressbar (1.11.0)
83
+ ruby-progressbar (1.13.0)
84
84
  ruby2_keywords (0.0.5)
85
85
  simplecov (0.22.0)
86
86
  docile (~> 1.1)
@@ -118,7 +118,7 @@ GEM
118
118
  tilt (~> 2.0)
119
119
  yard (~> 0.9, >= 0.9.24)
120
120
  thor (1.2.1)
121
- tilt (2.0.11)
121
+ tilt (2.1.0)
122
122
  unicode-display_width (2.4.2)
123
123
  webrick (1.7.0)
124
124
  yard (0.9.28)
@@ -126,6 +126,7 @@ GEM
126
126
 
127
127
  PLATFORMS
128
128
  arm64-darwin-21
129
+ arm64-darwin-22
129
130
  x86_64-linux
130
131
 
131
132
  DEPENDENCIES
@@ -144,4 +145,4 @@ DEPENDENCIES
144
145
  yard (~> 0.9)
145
146
 
146
147
  BUNDLED WITH
147
- 2.3.18
148
+ 2.4.6
@@ -11,7 +11,8 @@ module Metatron
11
11
  attr_accessor :image, :image_pull_policy, :additional_labels, :env, :envfrom,
12
12
  :resource_limits, :resource_requests, :probes, :ports, :security_context,
13
13
  :volume_mounts, :volumes, :additional_containers,
14
- :container_security_context, :affinity, :termination_grace_period_seconds
14
+ :container_security_context, :affinity, :termination_grace_period_seconds,
15
+ :tolerations
15
16
 
16
17
  initializer :pod_producer_initialize
17
18
 
@@ -40,11 +41,10 @@ module Metatron
40
41
  @additional_containers = []
41
42
  @additional_labels = {}
42
43
  @termination_grace_period_seconds = 60
44
+ @tolerations = []
43
45
  end
44
46
 
45
- def formatted_affinity
46
- affinity && !affinity.empty? ? { affinity: } : {}
47
- end
47
+ def formatted_affinity = affinity && !affinity.empty? ? { affinity: } : {}
48
48
 
49
49
  def formatted_environment
50
50
  env && !env.empty? ? { env: env.map { |k, v| { name: k, value: v } } } : {}
@@ -58,9 +58,7 @@ module Metatron
58
58
  end
59
59
  end
60
60
 
61
- def formatted_ports
62
- ports&.any? ? { ports: } : {}
63
- end
61
+ def formatted_ports = ports&.any? ? { ports: } : {}
64
62
 
65
63
  def formatted_security_context
66
64
  security_context && !security_context.empty? ? { securityContext: } : {}
@@ -74,13 +72,9 @@ module Metatron
74
72
  end
75
73
  end
76
74
 
77
- def formatted_volume_mounts
78
- volume_mounts&.any? ? { volumeMounts: } : {}
79
- end
80
-
81
- def formatted_volumes
82
- volumes&.any? ? { volumes: } : {}
83
- end
75
+ def formatted_tolerations = tolerations&.any? ? { tolerations: } : {}
76
+ def formatted_volume_mounts = volume_mounts&.any? ? { volumeMounts: } : {}
77
+ def formatted_volumes = volumes&.any? ? { volumes: } : {}
84
78
  end
85
79
  end
86
80
  end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Metatron
4
+ module Templates
5
+ # The DaemonSet Kubernetes resource
6
+ class DaemonSet < Template
7
+ include Concerns::Annotated
8
+ include Concerns::PodProducer
9
+
10
+ attr_accessor :replicas, :pod_annotations,
11
+ :additional_labels, :additional_pod_labels
12
+
13
+ def initialize(name)
14
+ super(name)
15
+ @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
+ end
24
+
25
+ # rubocop:disable Metrics/MethodLength
26
+ # rubocop:disable Metrics/AbcSize
27
+ def render
28
+ {
29
+ apiVersion:,
30
+ kind:,
31
+ metadata: {
32
+ name:,
33
+ labels: { "#{label_namespace}/name": name }.merge(additional_labels)
34
+ }.merge(formatted_annotations),
35
+ spec: {
36
+ selector: {
37
+ matchLabels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
38
+ },
39
+ template: {
40
+ metadata: {
41
+ labels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
42
+ }.merge(formatted_pod_annotations),
43
+ spec: {
44
+ terminationGracePeriodSeconds:,
45
+ containers: [
46
+ {
47
+ name: "app",
48
+ image:,
49
+ imagePullPolicy:,
50
+ stdin: true,
51
+ tty: true,
52
+ resources: { limits: resource_limits, requests: resource_requests }
53
+ }.merge(probes)
54
+ .merge(formatted_environment)
55
+ .merge(formatted_envfrom)
56
+ .merge(formatted_ports)
57
+ .merge(formatted_volume_mounts)
58
+ .merge(formatted_container_security_context)
59
+ ] + additional_containers
60
+ }.merge(formatted_volumes)
61
+ .merge(formatted_security_context)
62
+ .merge(formatted_tolerations)
63
+ }
64
+ }
65
+ }
66
+ end
67
+ # rubocop:enable Metrics/AbcSize
68
+ # rubocop:enable Metrics/MethodLength
69
+ end
70
+ end
71
+ end
@@ -60,7 +60,9 @@ module Metatron
60
60
  .merge(formatted_volume_mounts)
61
61
  .merge(formatted_container_security_context)
62
62
  ] + additional_containers
63
- }.merge(formatted_volumes).merge(formatted_security_context)
63
+ }.merge(formatted_volumes)
64
+ .merge(formatted_security_context)
65
+ .merge(formatted_tolerations)
64
66
  }
65
67
  }
66
68
  }
@@ -39,7 +39,9 @@ module Metatron
39
39
  .merge(formatted_volume_mounts)
40
40
  .merge(formatted_container_security_context)
41
41
  ] + additional_containers
42
- }.merge(formatted_volumes).merge(formatted_security_context)
42
+ }.merge(formatted_volumes)
43
+ .merge(formatted_security_context)
44
+ .merge(formatted_tolerations)
43
45
  }
44
46
  end
45
47
  # rubocop:enable Metrics/AbcSize
@@ -59,7 +59,9 @@ module Metatron
59
59
  .merge(formatted_volume_mounts)
60
60
  .merge(formatted_container_security_context)
61
61
  ] + additional_containers
62
- }.merge(formatted_volumes).merge(formatted_security_context)
62
+ }.merge(formatted_volumes)
63
+ .merge(formatted_security_context)
64
+ .merge(formatted_tolerations)
63
65
  }
64
66
  }
65
67
  }
@@ -72,6 +72,7 @@ module Metatron
72
72
  ] + additional_containers
73
73
  }.merge(formatted_volumes)
74
74
  .merge(formatted_affinity)
75
+ .merge(formatted_tolerations)
75
76
  }
76
77
  }
77
78
  }
@@ -4,6 +4,6 @@ module Metatron
4
4
  VERSION = [
5
5
  0, # major
6
6
  1, # minor
7
- 3 # patch
7
+ 4 # patch
8
8
  ].join(".")
9
9
  end
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.3
4
+ version: 0.1.4
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-02-15 00:00:00.000000000 Z
11
+ date: 2023-03-04 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/daemon_set.rb
261
262
  - lib/metatron/templates/deployment.rb
262
263
  - lib/metatron/templates/ingress.rb
263
264
  - lib/metatron/templates/pod.rb