metatron 0.2.0 → 0.2.2
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 +4 -4
- data/.gitignore +2 -0
- data/Gemfile.lock +1 -1
- data/lib/metatron/template.rb +11 -1
- data/lib/metatron/templates/concerns/pod_producer.rb +14 -1
- data/lib/metatron/templates/persistent_volume_claim.rb +5 -2
- data/lib/metatron/templates/stateful_set.rb +1 -1
- data/lib/metatron/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c91b426279a0fdc0bc7403da99aad467346c6d9eed8ed662ba4224f51e35988
|
4
|
+
data.tar.gz: c9f9915e91f61eea3a78f8e201572f37ee24d74dc477e9678066f0b8225f9911
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a3c97156c6dbd3aa2e368639825434be822d90a9bab663dfc8b19fee68fe45e2565ebc762c16381d5c3faeb1a4df91153d1e13302ffe9a18a9bcb1673b22067
|
7
|
+
data.tar.gz: dd31a78a1b92dcae20582921b33b0befc3560c43203b339f68617d736dc98cc358c4b4c8474d6f73f632eb1699857eba674ab578ede827bd6580ff8ca2478b5f
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/metatron/template.rb
CHANGED
@@ -18,7 +18,7 @@ module Metatron
|
|
18
18
|
@name = name
|
19
19
|
@label_namespace = self.class.label_namespace
|
20
20
|
@api_version = "v1"
|
21
|
-
@kind =
|
21
|
+
@kind = find_kind
|
22
22
|
run_initializers
|
23
23
|
end
|
24
24
|
|
@@ -38,5 +38,15 @@ module Metatron
|
|
38
38
|
def run_initializers
|
39
39
|
self.class.initializers.each { |initializer| send(initializer.to_sym) }
|
40
40
|
end
|
41
|
+
|
42
|
+
def find_kind
|
43
|
+
return self.class.name.split("::").last if metatron_template?
|
44
|
+
|
45
|
+
self.class.ancestors.find { |klass| metatron_template?(klass) }.name.split("::").last
|
46
|
+
end
|
47
|
+
|
48
|
+
def metatron_template?(klass = self)
|
49
|
+
klass.name.include?("Metatron::Templates") && !klass.name.include?("Concerns")
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
@@ -11,7 +11,7 @@ module Metatron
|
|
11
11
|
attr_accessor :additional_labels, :additional_pod_labels,
|
12
12
|
:security_context, :volumes, :containers, :init_containers,
|
13
13
|
:affinity, :termination_grace_period_seconds,
|
14
|
-
:tolerations, :pod_annotations
|
14
|
+
:tolerations, :pod_annotations, :persistent_volume_claims
|
15
15
|
|
16
16
|
initializer :pod_producer_initialize
|
17
17
|
|
@@ -31,6 +31,7 @@ module Metatron
|
|
31
31
|
@pod_annotations = {}
|
32
32
|
@termination_grace_period_seconds = nil
|
33
33
|
@tolerations = []
|
34
|
+
@persistent_volume_claims = []
|
34
35
|
end
|
35
36
|
|
36
37
|
def formatted_affinity = affinity && !affinity.empty? ? { affinity: } : {}
|
@@ -45,6 +46,18 @@ module Metatron
|
|
45
46
|
|
46
47
|
def formatted_tolerations = tolerations&.any? ? { tolerations: } : {}
|
47
48
|
def formatted_volumes = volumes&.any? ? { volumes: } : {}
|
49
|
+
|
50
|
+
def volume_claim_templates
|
51
|
+
if persistent_volume_claims&.any?
|
52
|
+
{
|
53
|
+
volumeClaimTemplates: persistent_volume_claims.map do |c|
|
54
|
+
c.respond_to?(:render) ? c.render : c
|
55
|
+
end
|
56
|
+
}
|
57
|
+
else
|
58
|
+
{}
|
59
|
+
end
|
60
|
+
end
|
48
61
|
end
|
49
62
|
end
|
50
63
|
end
|
@@ -9,6 +9,9 @@ module Metatron
|
|
9
9
|
|
10
10
|
attr_accessor :additional_labels, :storage_class, :access_modes, :storage
|
11
11
|
|
12
|
+
alias storageClassName storage_class
|
13
|
+
alias accessModes access_modes
|
14
|
+
|
12
15
|
def initialize(
|
13
16
|
name,
|
14
17
|
storage_class:,
|
@@ -31,8 +34,8 @@ module Metatron
|
|
31
34
|
labels: { "#{label_namespace}/name": name }.merge(additional_labels)
|
32
35
|
}.merge(formatted_annotations).merge(formatted_namespace),
|
33
36
|
spec: {
|
34
|
-
accessModes
|
35
|
-
storageClassName
|
37
|
+
accessModes:,
|
38
|
+
storageClassName:,
|
36
39
|
resources: {
|
37
40
|
requests: {
|
38
41
|
storage:
|
data/lib/metatron/version.rb
CHANGED