metatron 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/metatron/templates/concerns/pod_producer.rb +3 -1
- data/lib/metatron/templates/deployment.rb +1 -0
- data/lib/metatron/templates/pod.rb +3 -0
- data/lib/metatron/templates/replica_set.rb +71 -0
- data/lib/metatron/templates/stateful_set.rb +1 -3
- data/lib/metatron/version.rb +1 -1
- data/lib/metatron.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dbb4ce75ed3919fbbb31853a4e7d72a3a93ce85262daa8eb060d762223a8599
|
4
|
+
data.tar.gz: c94db73669dbe3e00d68a6d883e9c62072a3007545ce8a69e2df26743a4633a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8dfc8c8a4863f9bca41f098e546fbd342dfe008c34f92362fcda293d920c9cc686f63532b969a37a364ada8f4bde86f346efd5c37c1223be0c2f305e58f7c99
|
7
|
+
data.tar.gz: d63951090a4e9729e7ba30249d55b0743a670d4cc6103e3177cc5085f970af010ac72bab9f30a7af29fe668de1c57529ed0225d500b995314693352735ca95e5
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ 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
|
14
|
+
:container_security_context, :affinity, :termination_grace_period_seconds
|
15
15
|
|
16
16
|
initializer :pod_producer_initialize
|
17
17
|
|
@@ -19,6 +19,7 @@ module Metatron
|
|
19
19
|
alias_method :volumeMounts, :volume_mounts
|
20
20
|
alias_method :securityContext, :security_context
|
21
21
|
alias_method :environment, :env
|
22
|
+
alias_method :terminationGracePeriodSeconds, :termination_grace_period_seconds
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -38,6 +39,7 @@ module Metatron
|
|
38
39
|
@container_security_context = {}
|
39
40
|
@additional_containers = []
|
40
41
|
@additional_labels = {}
|
42
|
+
@termination_grace_period_seconds = 60
|
41
43
|
end
|
42
44
|
|
43
45
|
def formatted_affinity
|
@@ -12,6 +12,7 @@ module Metatron
|
|
12
12
|
@kind = "Pod"
|
13
13
|
end
|
14
14
|
|
15
|
+
# rubocop:disable Metrics/MethodLength
|
15
16
|
# rubocop:disable Metrics/AbcSize
|
16
17
|
def render
|
17
18
|
{
|
@@ -22,6 +23,7 @@ module Metatron
|
|
22
23
|
name:
|
23
24
|
}.merge(formatted_annotations),
|
24
25
|
spec: {
|
26
|
+
terminationGracePeriodSeconds:,
|
25
27
|
containers: [
|
26
28
|
{
|
27
29
|
name: "app",
|
@@ -41,6 +43,7 @@ module Metatron
|
|
41
43
|
}
|
42
44
|
end
|
43
45
|
# rubocop:enable Metrics/AbcSize
|
46
|
+
# rubocop:enable Metrics/MethodLength
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Metatron
|
4
|
+
module Templates
|
5
|
+
# The ReplicaSet Kubernetes resource
|
6
|
+
class ReplicaSet < 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, replicas: 2)
|
14
|
+
super(name)
|
15
|
+
@api_version = "apps/v1"
|
16
|
+
@kind = "ReplicaSet"
|
17
|
+
@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
|
+
end
|
25
|
+
|
26
|
+
# rubocop:disable Metrics/MethodLength
|
27
|
+
# rubocop:disable Metrics/AbcSize
|
28
|
+
def render
|
29
|
+
{
|
30
|
+
apiVersion:,
|
31
|
+
kind:,
|
32
|
+
metadata: {
|
33
|
+
name:,
|
34
|
+
labels: { "#{label_namespace}/name": name }.merge(additional_labels)
|
35
|
+
}.merge(formatted_annotations),
|
36
|
+
spec: {
|
37
|
+
replicas:,
|
38
|
+
selector: {
|
39
|
+
matchLabels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
|
40
|
+
},
|
41
|
+
template: {
|
42
|
+
metadata: {
|
43
|
+
labels: { "#{label_namespace}/name": name }.merge(additional_pod_labels)
|
44
|
+
}.merge(formatted_pod_annotations),
|
45
|
+
spec: {
|
46
|
+
terminationGracePeriodSeconds:,
|
47
|
+
containers: [
|
48
|
+
{
|
49
|
+
name: "app",
|
50
|
+
image:,
|
51
|
+
imagePullPolicy:,
|
52
|
+
stdin: true,
|
53
|
+
tty: true,
|
54
|
+
resources: { limits: resource_limits, requests: resource_requests }
|
55
|
+
}.merge(probes)
|
56
|
+
.merge(formatted_environment)
|
57
|
+
.merge(formatted_envfrom)
|
58
|
+
.merge(formatted_ports)
|
59
|
+
.merge(formatted_volume_mounts)
|
60
|
+
.merge(formatted_container_security_context)
|
61
|
+
] + additional_containers
|
62
|
+
}.merge(formatted_volumes).merge(formatted_security_context)
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
end
|
67
|
+
# rubocop:enable Metrics/AbcSize
|
68
|
+
# rubocop:enable Metrics/MethodLength
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -9,7 +9,7 @@ module Metatron
|
|
9
9
|
|
10
10
|
attr_accessor :replicas, :pod_annotations, :service_name,
|
11
11
|
:pod_management_policy, :enable_service_links,
|
12
|
-
:
|
12
|
+
:additional_pod_labels
|
13
13
|
|
14
14
|
def initialize(name, replicas: 1)
|
15
15
|
super(name)
|
@@ -21,12 +21,10 @@ module Metatron
|
|
21
21
|
@additional_pod_labels = {}
|
22
22
|
@enable_service_links = true
|
23
23
|
@service_name = name
|
24
|
-
@termination_grace_period_seconds = 60
|
25
24
|
end
|
26
25
|
|
27
26
|
alias enableServiceLinks enable_service_links
|
28
27
|
alias podManagementPolicy pod_management_policy
|
29
|
-
alias terminationGracePeriodSeconds termination_grace_period_seconds
|
30
28
|
alias serviceName service_name
|
31
29
|
|
32
30
|
def formatted_pod_annotations
|
data/lib/metatron/version.rb
CHANGED
data/lib/metatron.rb
CHANGED
@@ -30,6 +30,7 @@ require "metatron/templates/concerns/pod_producer"
|
|
30
30
|
require "metatron/templates/pod"
|
31
31
|
require "metatron/templates/deployment"
|
32
32
|
require "metatron/templates/ingress"
|
33
|
+
require "metatron/templates/replica_set"
|
33
34
|
require "metatron/templates/secret"
|
34
35
|
require "metatron/templates/service"
|
35
36
|
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
|
+
version: 0.1.3
|
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-
|
11
|
+
date: 2023-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -261,6 +261,7 @@ files:
|
|
261
261
|
- lib/metatron/templates/deployment.rb
|
262
262
|
- lib/metatron/templates/ingress.rb
|
263
263
|
- lib/metatron/templates/pod.rb
|
264
|
+
- lib/metatron/templates/replica_set.rb
|
264
265
|
- lib/metatron/templates/secret.rb
|
265
266
|
- lib/metatron/templates/service.rb
|
266
267
|
- lib/metatron/templates/stateful_set.rb
|