terrafying-components 1.11.16 → 1.11.17
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/lib/terrafying/components/dynamicset.rb +1 -1
- data/lib/terrafying/components/instance.rb +1 -5
- data/lib/terrafying/components/prometheus.rb +15 -22
- data/lib/terrafying/components/service.rb +1 -1
- data/lib/terrafying/components/staticset.rb +1 -1
- data/lib/terrafying/components/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: a597ed1a9773ee6eef4e65893a4edf3a69091c289132b56fb700841e34fe1a59
|
4
|
+
data.tar.gz: 45294b5718c25d69537e3ce17e23b5b04d11b7596cdaba7bf2f680d7e2a3a39f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 783f6277ce5541c5dc86a8245a3b0eeed51dba6d7ff6c40529f094c5f63ffb5d4dfd576d837b23fbbe6df422167535d3a2c24bfc75145ccd1b5351b77249f35e
|
7
|
+
data.tar.gz: '0558b9b6b004597060200dbc490ec36b6aa072e94b9d0deb69f5e0a8e6de460bd61c9a13a1a2b6821c48168785742d2f567fb4cb1759a0543cf8813e4b8f6e92'
|
@@ -33,7 +33,7 @@ module Terrafying
|
|
33
33
|
options = {
|
34
34
|
public: false,
|
35
35
|
ami: aws.ami('base-image-24b8d5fb', owners = ['136393635417']),
|
36
|
-
instance_type: '
|
36
|
+
instance_type: 't3a.micro',
|
37
37
|
instances: { min: 1, max: 1, desired: 1, tags: {} },
|
38
38
|
ports: [],
|
39
39
|
instance_profile: nil,
|
@@ -30,8 +30,7 @@ module Terrafying
|
|
30
30
|
def create_in(vpc, name, options = {})
|
31
31
|
options = {
|
32
32
|
public: false,
|
33
|
-
instance_type: '
|
34
|
-
cpu_credits: 'unlimited',
|
33
|
+
instance_type: 't3a.micro',
|
35
34
|
instance_profile: nil,
|
36
35
|
ports: [],
|
37
36
|
tags: {},
|
@@ -82,9 +81,6 @@ module Terrafying
|
|
82
81
|
@id = resource :aws_instance, ident, {
|
83
82
|
ami: options[:ami],
|
84
83
|
instance_type: options[:instance_type],
|
85
|
-
credit_specification: {
|
86
|
-
cpu_credits: options[:cpu_credits]
|
87
|
-
},
|
88
84
|
iam_instance_profile: profile_from(options[:instance_profile]),
|
89
85
|
subnet_id: @subnet.id,
|
90
86
|
associate_public_ip_address: options[:public],
|
@@ -24,8 +24,7 @@ module Terrafying
|
|
24
24
|
prom_name: 'prometheus',
|
25
25
|
prom_version: 'v2.9.2',
|
26
26
|
instances: 2,
|
27
|
-
instance_type: 't3a.small'
|
28
|
-
instance_cpu_credits: 'standard'
|
27
|
+
instance_type: 't3a.small'
|
29
28
|
)
|
30
29
|
super()
|
31
30
|
@vpc = vpc
|
@@ -35,7 +34,6 @@ module Terrafying
|
|
35
34
|
@prom_version = prom_version
|
36
35
|
@instances = instances
|
37
36
|
@instance_type = instance_type
|
38
|
-
@instance_cpu_credits = instance_cpu_credits
|
39
37
|
end
|
40
38
|
|
41
39
|
def find
|
@@ -55,13 +53,16 @@ module Terrafying
|
|
55
53
|
@prometheus = create_prom
|
56
54
|
|
57
55
|
@security_group = @prometheus.egress_security_group
|
58
|
-
# Allow thanos-query connections to thanos-sidecar on prometheus instances
|
59
|
-
@vpc.zone.add_srv_in(self, prometheus_thanos_sidecar_hostname, 'grpc', 10_901, 'tcp', @prom_service.domain_names.drop(1))
|
60
56
|
|
61
|
-
|
57
|
+
# Form SRV record with thanos-sidecars
|
58
|
+
@vpc.zone.add_srv_in(self, prometheus_thanos_sidecar_hostname, 'grpc', 10_901, 'tcp', @prom_service.domain_names.drop(1))
|
62
59
|
|
63
|
-
|
64
|
-
@thanos.
|
60
|
+
# Allow Prometheus to scrape Thanos Query
|
61
|
+
@thanos.used_by(@prometheus) { |port| port[:upstream_port] == 10_902 }
|
62
|
+
# Allow Thanos Query instance to reach Prometheus running Thanos Sidecar
|
63
|
+
@prometheus.used_by(@thanos) { |port| port[:upstream_port] == 10_901 }
|
64
|
+
# Allow connections from VPC to Thanos Query services
|
65
|
+
@thanos.used_by_cidr(@vpc.cidr) { |port| [10_902, 10_901].include? port[:upstream_port] }
|
65
66
|
end
|
66
67
|
|
67
68
|
def create_prom
|
@@ -75,10 +76,13 @@ module Terrafying
|
|
75
76
|
{
|
76
77
|
type: 'tcp',
|
77
78
|
number: 10_902
|
79
|
+
},
|
80
|
+
{
|
81
|
+
type: 'tcp',
|
82
|
+
number: 10_901
|
78
83
|
}
|
79
84
|
],
|
80
85
|
instance_type: @instance_type,
|
81
|
-
cpu_credits: @instance_cpu_credits,
|
82
86
|
iam_policy_statements: thanos_store_access,
|
83
87
|
instances: [{}] * @instances,
|
84
88
|
units: [prometheus_unit, thanos_sidecar_unit],
|
@@ -92,22 +96,12 @@ module Terrafying
|
|
92
96
|
)
|
93
97
|
end
|
94
98
|
|
95
|
-
def allow_prometheus_thanos_sidecar_grpc(security_group, source_security_group)
|
96
|
-
rule_ident = Digest::SHA2.hexdigest([security_group, source_security_group, @vpc.name, 'thanos-sidecar'].join('-'))[0..24]
|
97
|
-
resource :aws_security_group_rule, rule_ident,
|
98
|
-
security_group_id: security_group,
|
99
|
-
type: 'ingress',
|
100
|
-
from_port: 10_901,
|
101
|
-
to_port: 10_901,
|
102
|
-
protocol: 'tcp',
|
103
|
-
source_security_group_id: source_security_group
|
104
|
-
end
|
105
|
-
|
106
99
|
def create_thanos(prometheus_thanos_sidecar_srv_fqdn)
|
107
100
|
@thanos_service = add! Terrafying::Components::Service.create_in(
|
108
101
|
@vpc, @thanos_name,
|
109
102
|
ports: [
|
110
103
|
{
|
104
|
+
type: 'tcp',
|
111
105
|
number: 10_902,
|
112
106
|
health_check: {
|
113
107
|
protocol: 'HTTP',
|
@@ -115,6 +109,7 @@ module Terrafying
|
|
115
109
|
}
|
116
110
|
},
|
117
111
|
{
|
112
|
+
type: 'tcp',
|
118
113
|
number: 10_901,
|
119
114
|
health_check: {
|
120
115
|
protocol: 'TCP'
|
@@ -122,11 +117,9 @@ module Terrafying
|
|
122
117
|
}
|
123
118
|
],
|
124
119
|
instance_type: @instance_type,
|
125
|
-
cpu_credits: @instance_cpu_credits,
|
126
120
|
units: [thanos_unit(prometheus_thanos_sidecar_srv_fqdn)],
|
127
121
|
instances: [{}] * @instances,
|
128
122
|
loadbalancer: true,
|
129
|
-
metrics_ports: [10_902],
|
130
123
|
tags: {
|
131
124
|
prometheus_port: 10_902,
|
132
125
|
prometheus_path: '/metrics'
|