metatron 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.roxanne.yml +3 -3
- data/.ruby-version +1 -1
- data/Gemfile.lock +14 -13
- data/lib/metatron/template.rb +1 -0
- data/lib/metatron/templates/concerns/pod_producer.rb +8 -14
- data/lib/metatron/templates/daemon_set.rb +70 -0
- data/lib/metatron/templates/deployment.rb +3 -2
- data/lib/metatron/templates/ingress.rb +0 -2
- data/lib/metatron/templates/persistent_volume_claim.rb +45 -0
- data/lib/metatron/templates/pod.rb +3 -6
- data/lib/metatron/templates/replica_set.rb +3 -2
- data/lib/metatron/templates/secret.rb +0 -1
- data/lib/metatron/templates/service.rb +0 -1
- data/lib/metatron/templates/stateful_set.rb +1 -1
- data/lib/metatron/version.rb +1 -1
- data/lib/metatron.rb +1 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 992800d829a067dfad529abd2b4ff606df206b32f214e5851a5d30325d087c5a
|
4
|
+
data.tar.gz: 209c07d8463fdca044763ad0a4cf07b7284ebefd0a4cdf2372d5e80af3b62faf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c66266c6808288c3709631e4cac70d0c60122a5589255c9110a0b4ec09460df22fea9ec43fcc3da5339bb935e2d4a5435f3768f95fda63ce47da78ddfebce99
|
7
|
+
data.tar.gz: 0cf374089c8cc38975cbb96c484c54c37cd769dcc402ceaf4857ba11cd709e4869db951a620d795befc39d900435fbd11fa68bfc5079d3237cf55b6ca012a997
|
data/.roxanne.yml
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
version: 1.0
|
2
2
|
stages:
|
3
3
|
build:
|
4
|
-
image: ruby:3.
|
4
|
+
image: ruby:3.2
|
5
5
|
scripts:
|
6
6
|
- ./scripts/build.sh
|
7
7
|
test:
|
8
|
-
image: ruby:3.
|
8
|
+
image: ruby:3.2
|
9
9
|
scripts:
|
10
10
|
- ./scripts/test.sh
|
11
11
|
release:
|
12
|
-
image: ruby:3.
|
12
|
+
image: ruby:3.2
|
13
13
|
only:
|
14
14
|
- main
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1
|
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.
|
4
|
+
metatron (0.1.5)
|
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.
|
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.
|
40
|
+
rack (2.2.6.4)
|
41
41
|
rack-protection (2.2.4)
|
42
42
|
rack
|
43
|
-
rack-test (2.0
|
43
|
+
rack-test (2.1.0)
|
44
44
|
rack (>= 1.3)
|
45
45
|
rainbow (3.1.1)
|
46
46
|
rake (12.3.3)
|
@@ -57,30 +57,30 @@ 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.
|
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.
|
64
|
+
rubocop (1.48.1)
|
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.
|
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.
|
74
|
+
rubocop-ast (1.27.0)
|
75
75
|
parser (>= 3.2.1.0)
|
76
|
-
rubocop-capybara (2.17.
|
76
|
+
rubocop-capybara (2.17.1)
|
77
77
|
rubocop (~> 1.41)
|
78
78
|
rubocop-rake (0.6.0)
|
79
79
|
rubocop (~> 1.0)
|
80
|
-
rubocop-rspec (2.
|
80
|
+
rubocop-rspec (2.19.0)
|
81
81
|
rubocop (~> 1.33)
|
82
82
|
rubocop-capybara (~> 2.17)
|
83
|
-
ruby-progressbar (1.
|
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
|
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.
|
148
|
+
2.4.6
|
data/lib/metatron/template.rb
CHANGED
@@ -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
|
78
|
-
|
79
|
-
|
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,70 @@
|
|
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
|
+
@pod_annotations = {}
|
17
|
+
@additional_pod_labels = {}
|
18
|
+
end
|
19
|
+
|
20
|
+
def formatted_pod_annotations
|
21
|
+
pod_annotations && !pod_annotations.empty? ? { annotations: pod_annotations } : {}
|
22
|
+
end
|
23
|
+
|
24
|
+
# rubocop:disable Metrics/MethodLength
|
25
|
+
# rubocop:disable Metrics/AbcSize
|
26
|
+
def render
|
27
|
+
{
|
28
|
+
apiVersion:,
|
29
|
+
kind:,
|
30
|
+
metadata: {
|
31
|
+
name:,
|
32
|
+
labels: { "#{label_namespace}/name": name }.merge(additional_labels)
|
33
|
+
}.merge(formatted_annotations),
|
34
|
+
spec: {
|
35
|
+
selector: {
|
36
|
+
matchLabels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
|
37
|
+
},
|
38
|
+
template: {
|
39
|
+
metadata: {
|
40
|
+
labels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
|
41
|
+
}.merge(formatted_pod_annotations),
|
42
|
+
spec: {
|
43
|
+
terminationGracePeriodSeconds:,
|
44
|
+
containers: [
|
45
|
+
{
|
46
|
+
name: "app",
|
47
|
+
image:,
|
48
|
+
imagePullPolicy:,
|
49
|
+
stdin: true,
|
50
|
+
tty: true,
|
51
|
+
resources: { limits: resource_limits, requests: resource_requests }
|
52
|
+
}.merge(probes)
|
53
|
+
.merge(formatted_environment)
|
54
|
+
.merge(formatted_envfrom)
|
55
|
+
.merge(formatted_ports)
|
56
|
+
.merge(formatted_volume_mounts)
|
57
|
+
.merge(formatted_container_security_context)
|
58
|
+
] + additional_containers
|
59
|
+
}.merge(formatted_volumes)
|
60
|
+
.merge(formatted_security_context)
|
61
|
+
.merge(formatted_tolerations)
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}
|
65
|
+
end
|
66
|
+
# rubocop:enable Metrics/AbcSize
|
67
|
+
# rubocop:enable Metrics/MethodLength
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -13,7 +13,6 @@ module Metatron
|
|
13
13
|
def initialize(name, replicas: 2)
|
14
14
|
super(name)
|
15
15
|
@api_version = "apps/v1"
|
16
|
-
@kind = "Deployment"
|
17
16
|
@replicas = replicas
|
18
17
|
@pod_annotations = {}
|
19
18
|
@additional_pod_labels = {}
|
@@ -60,7 +59,9 @@ module Metatron
|
|
60
59
|
.merge(formatted_volume_mounts)
|
61
60
|
.merge(formatted_container_security_context)
|
62
61
|
] + additional_containers
|
63
|
-
}.merge(formatted_volumes)
|
62
|
+
}.merge(formatted_volumes)
|
63
|
+
.merge(formatted_security_context)
|
64
|
+
.merge(formatted_tolerations)
|
64
65
|
}
|
65
66
|
}
|
66
67
|
}
|
@@ -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
|
@@ -39,7 +34,9 @@ module Metatron
|
|
39
34
|
.merge(formatted_volume_mounts)
|
40
35
|
.merge(formatted_container_security_context)
|
41
36
|
] + additional_containers
|
42
|
-
}.merge(formatted_volumes)
|
37
|
+
}.merge(formatted_volumes)
|
38
|
+
.merge(formatted_security_context)
|
39
|
+
.merge(formatted_tolerations)
|
43
40
|
}
|
44
41
|
end
|
45
42
|
# rubocop:enable Metrics/AbcSize
|
@@ -13,7 +13,6 @@ module Metatron
|
|
13
13
|
def initialize(name, replicas: 2)
|
14
14
|
super(name)
|
15
15
|
@api_version = "apps/v1"
|
16
|
-
@kind = "ReplicaSet"
|
17
16
|
@replicas = replicas
|
18
17
|
@pod_annotations = {}
|
19
18
|
@additional_pod_labels = {}
|
@@ -59,7 +58,9 @@ module Metatron
|
|
59
58
|
.merge(formatted_volume_mounts)
|
60
59
|
.merge(formatted_container_security_context)
|
61
60
|
] + additional_containers
|
62
|
-
}.merge(formatted_volumes)
|
61
|
+
}.merge(formatted_volumes)
|
62
|
+
.merge(formatted_security_context)
|
63
|
+
.merge(formatted_tolerations)
|
63
64
|
}
|
64
65
|
}
|
65
66
|
}
|
@@ -15,7 +15,6 @@ module Metatron
|
|
15
15
|
super(name)
|
16
16
|
@replicas = replicas
|
17
17
|
@api_version = "apps/v1"
|
18
|
-
@kind = "StatefulSet"
|
19
18
|
@pod_annotations = {}
|
20
19
|
@pod_management_policy = "OrderedReady"
|
21
20
|
@additional_pod_labels = {}
|
@@ -72,6 +71,7 @@ module Metatron
|
|
72
71
|
] + additional_containers
|
73
72
|
}.merge(formatted_volumes)
|
74
73
|
.merge(formatted_affinity)
|
74
|
+
.merge(formatted_tolerations)
|
75
75
|
}
|
76
76
|
}
|
77
77
|
}
|
data/lib/metatron/version.rb
CHANGED
data/lib/metatron.rb
CHANGED
@@ -28,6 +28,7 @@ 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"
|
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
|
+
version: 0.1.5
|
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-
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -258,8 +258,10 @@ 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
|
264
|
+
- lib/metatron/templates/persistent_volume_claim.rb
|
263
265
|
- lib/metatron/templates/pod.rb
|
264
266
|
- lib/metatron/templates/replica_set.rb
|
265
267
|
- lib/metatron/templates/secret.rb
|
@@ -291,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
293
|
- !ruby/object:Gem::Version
|
292
294
|
version: '0'
|
293
295
|
requirements: []
|
294
|
-
rubygems_version: 3.
|
296
|
+
rubygems_version: 3.4.6
|
295
297
|
signing_key:
|
296
298
|
specification_version: 4
|
297
299
|
summary: So meta
|