cloud-mu 3.1.6 → 3.2.0
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/bin/mu-adopt +4 -12
- data/bin/mu-azure-tests +57 -0
- data/bin/mu-cleanup +2 -4
- data/bin/mu-configure +37 -1
- data/bin/mu-deploy +3 -3
- data/bin/mu-findstray-tests +25 -0
- data/bin/mu-gen-docs +2 -4
- data/bin/mu-run-tests +23 -10
- data/cloud-mu.gemspec +2 -2
- data/cookbooks/mu-tools/libraries/helper.rb +1 -1
- data/cookbooks/mu-tools/recipes/apply_security.rb +14 -14
- data/cookbooks/mu-tools/recipes/aws_api.rb +9 -0
- data/extras/generate-stock-images +1 -0
- data/modules/mu.rb +82 -95
- data/modules/mu/adoption.rb +356 -56
- data/modules/mu/cleanup.rb +21 -20
- data/modules/mu/cloud.rb +79 -1753
- data/modules/mu/cloud/database.rb +49 -0
- data/modules/mu/cloud/dnszone.rb +46 -0
- data/modules/mu/cloud/machine_images.rb +212 -0
- data/modules/mu/cloud/providers.rb +81 -0
- data/modules/mu/cloud/resource_base.rb +920 -0
- data/modules/mu/cloud/server.rb +40 -0
- data/modules/mu/cloud/server_pool.rb +1 -0
- data/modules/mu/cloud/ssh_sessions.rb +228 -0
- data/modules/mu/cloud/winrm_sessions.rb +237 -0
- data/modules/mu/cloud/wrappers.rb +165 -0
- data/modules/mu/config.rb +122 -80
- data/modules/mu/config/alarm.rb +2 -6
- data/modules/mu/config/bucket.rb +1 -1
- data/modules/mu/config/cache_cluster.rb +1 -1
- data/modules/mu/config/collection.rb +1 -1
- data/modules/mu/config/container_cluster.rb +2 -2
- data/modules/mu/config/database.rb +83 -104
- data/modules/mu/config/database.yml +1 -2
- data/modules/mu/config/dnszone.rb +1 -1
- data/modules/mu/config/doc_helpers.rb +4 -5
- data/modules/mu/config/endpoint.rb +1 -1
- data/modules/mu/config/firewall_rule.rb +3 -19
- data/modules/mu/config/folder.rb +1 -1
- data/modules/mu/config/function.rb +1 -1
- data/modules/mu/config/group.rb +1 -1
- data/modules/mu/config/habitat.rb +1 -1
- data/modules/mu/config/loadbalancer.rb +57 -11
- data/modules/mu/config/log.rb +1 -1
- data/modules/mu/config/msg_queue.rb +1 -1
- data/modules/mu/config/nosqldb.rb +1 -1
- data/modules/mu/config/notifier.rb +1 -1
- data/modules/mu/config/ref.rb +30 -4
- data/modules/mu/config/role.rb +1 -1
- data/modules/mu/config/schema_helpers.rb +30 -34
- data/modules/mu/config/search_domain.rb +1 -1
- data/modules/mu/config/server.rb +4 -12
- data/modules/mu/config/server_pool.rb +3 -7
- data/modules/mu/config/storage_pool.rb +1 -1
- data/modules/mu/config/tail.rb +10 -0
- data/modules/mu/config/user.rb +1 -1
- data/modules/mu/config/vpc.rb +12 -17
- data/modules/mu/defaults/AWS.yaml +32 -32
- data/modules/mu/defaults/Azure.yaml +1 -0
- data/modules/mu/defaults/Google.yaml +1 -0
- data/modules/mu/deploy.rb +16 -15
- data/modules/mu/groomer.rb +15 -0
- data/modules/mu/groomers/chef.rb +3 -0
- data/modules/mu/logger.rb +120 -144
- data/modules/mu/master.rb +1 -1
- data/modules/mu/mommacat.rb +54 -25
- data/modules/mu/mommacat/daemon.rb +10 -7
- data/modules/mu/mommacat/naming.rb +82 -3
- data/modules/mu/mommacat/search.rb +47 -15
- data/modules/mu/mommacat/storage.rb +72 -41
- data/modules/mu/{clouds → providers}/README.md +1 -1
- data/modules/mu/{clouds → providers}/aws.rb +114 -47
- data/modules/mu/{clouds → providers}/aws/alarm.rb +1 -1
- data/modules/mu/{clouds → providers}/aws/bucket.rb +2 -2
- data/modules/mu/{clouds → providers}/aws/cache_cluster.rb +10 -46
- data/modules/mu/{clouds → providers}/aws/collection.rb +3 -3
- data/modules/mu/{clouds → providers}/aws/container_cluster.rb +15 -33
- data/modules/mu/providers/aws/database.rb +1744 -0
- data/modules/mu/{clouds → providers}/aws/dnszone.rb +2 -5
- data/modules/mu/{clouds → providers}/aws/endpoint.rb +2 -11
- data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +33 -29
- data/modules/mu/{clouds → providers}/aws/folder.rb +0 -0
- data/modules/mu/{clouds → providers}/aws/function.rb +2 -10
- data/modules/mu/{clouds → providers}/aws/group.rb +9 -13
- data/modules/mu/{clouds → providers}/aws/habitat.rb +1 -1
- data/modules/mu/{clouds → providers}/aws/loadbalancer.rb +41 -33
- data/modules/mu/{clouds → providers}/aws/log.rb +2 -2
- data/modules/mu/{clouds → providers}/aws/msg_queue.rb +2 -8
- data/modules/mu/{clouds → providers}/aws/nosqldb.rb +0 -0
- data/modules/mu/{clouds → providers}/aws/notifier.rb +0 -0
- data/modules/mu/{clouds → providers}/aws/role.rb +7 -7
- data/modules/mu/{clouds → providers}/aws/search_domain.rb +8 -13
- data/modules/mu/{clouds → providers}/aws/server.rb +55 -90
- data/modules/mu/{clouds → providers}/aws/server_pool.rb +10 -33
- data/modules/mu/{clouds → providers}/aws/storage_pool.rb +19 -36
- data/modules/mu/{clouds → providers}/aws/user.rb +8 -12
- data/modules/mu/{clouds → providers}/aws/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/aws/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/aws/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/aws/vpc.rb +135 -70
- data/modules/mu/{clouds → providers}/aws/vpc_subnet.rb +0 -0
- data/modules/mu/{clouds → providers}/azure.rb +4 -1
- data/modules/mu/{clouds → providers}/azure/container_cluster.rb +1 -5
- data/modules/mu/{clouds → providers}/azure/firewall_rule.rb +8 -1
- data/modules/mu/{clouds → providers}/azure/habitat.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/loadbalancer.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/role.rb +0 -0
- data/modules/mu/{clouds → providers}/azure/server.rb +30 -23
- data/modules/mu/{clouds → providers}/azure/user.rb +1 -1
- data/modules/mu/{clouds → providers}/azure/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/azure/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/azure/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/azure/vpc.rb +4 -6
- data/modules/mu/{clouds → providers}/cloudformation.rb +1 -1
- data/modules/mu/{clouds → providers}/cloudformation/alarm.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/cache_cluster.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/collection.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/database.rb +6 -17
- data/modules/mu/{clouds → providers}/cloudformation/dnszone.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/firewall_rule.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/loadbalancer.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/log.rb +3 -3
- data/modules/mu/{clouds → providers}/cloudformation/server.rb +7 -7
- data/modules/mu/{clouds → providers}/cloudformation/server_pool.rb +5 -5
- data/modules/mu/{clouds → providers}/cloudformation/vpc.rb +3 -3
- data/modules/mu/{clouds → providers}/docker.rb +0 -0
- data/modules/mu/{clouds → providers}/google.rb +14 -6
- data/modules/mu/{clouds → providers}/google/bucket.rb +1 -1
- data/modules/mu/{clouds → providers}/google/container_cluster.rb +28 -13
- data/modules/mu/{clouds → providers}/google/database.rb +1 -8
- data/modules/mu/{clouds → providers}/google/firewall_rule.rb +2 -2
- data/modules/mu/{clouds → providers}/google/folder.rb +4 -8
- data/modules/mu/{clouds → providers}/google/function.rb +3 -3
- data/modules/mu/{clouds → providers}/google/group.rb +8 -16
- data/modules/mu/{clouds → providers}/google/habitat.rb +3 -7
- data/modules/mu/{clouds → providers}/google/loadbalancer.rb +1 -1
- data/modules/mu/{clouds → providers}/google/role.rb +42 -34
- data/modules/mu/{clouds → providers}/google/server.rb +25 -10
- data/modules/mu/{clouds → providers}/google/server_pool.rb +10 -10
- data/modules/mu/{clouds → providers}/google/user.rb +31 -21
- data/modules/mu/{clouds → providers}/google/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/google/userdata/linux.erb +0 -0
- data/modules/mu/{clouds → providers}/google/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/google/vpc.rb +37 -2
- data/modules/tests/centos6.yaml +11 -0
- data/modules/tests/centos7.yaml +11 -0
- data/modules/tests/centos8.yaml +12 -0
- data/modules/tests/rds.yaml +108 -0
- data/modules/tests/regrooms/rds.yaml +123 -0
- data/spec/mu/clouds/azure_spec.rb +2 -2
- metadata +108 -89
- data/modules/mu/clouds/aws/database.rb +0 -1974
data/modules/mu/config/alarm.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/alarm.rb
|
|
18
18
|
class Alarm
|
|
19
19
|
|
|
20
20
|
# Sections of Alarm schema shared between Alarms as a first-class
|
|
@@ -281,11 +281,7 @@ module MU
|
|
|
281
281
|
}
|
|
282
282
|
ok = false if !configurator.insertKitten(notifier, "notifiers")
|
|
283
283
|
end
|
|
284
|
-
alarm["
|
|
285
|
-
alarm["dependencies"] << {
|
|
286
|
-
"name" => alarm["notification_group"],
|
|
287
|
-
"type" => "notifier"
|
|
288
|
-
}
|
|
284
|
+
MU::Config.addDependency(alarm, alarm["notification_group"], "notifier")
|
|
289
285
|
end
|
|
290
286
|
end
|
|
291
287
|
|
data/modules/mu/config/bucket.rb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/bucket.rb
|
|
18
18
|
class Bucket
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Bucket
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/cache_cluster.rb
|
|
18
18
|
class CacheCluster
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a CacheCluster
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/collection.rb
|
|
18
18
|
class Collection
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Collection
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/container_cluster.rb
|
|
18
18
|
class ContainerCluster
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a ContainerCluster
|
|
@@ -48,7 +48,7 @@ module MU
|
|
|
48
48
|
"properties" => {
|
|
49
49
|
"version" => {
|
|
50
50
|
"type" => "string",
|
|
51
|
-
"default" => "1.
|
|
51
|
+
"default" => "1.14",
|
|
52
52
|
"description" => "Version of Kubernetes control plane to deploy",
|
|
53
53
|
},
|
|
54
54
|
"max_pods" => {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/database.rb
|
|
18
18
|
class Database
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Database
|
|
@@ -23,7 +23,7 @@ module MU
|
|
|
23
23
|
{
|
|
24
24
|
"type" => "object",
|
|
25
25
|
"description" => "Create a dedicated database server.",
|
|
26
|
-
"required" => ["name", "engine", "size", "cloud"
|
|
26
|
+
"required" => ["name", "engine", "size", "cloud"],
|
|
27
27
|
"additionalProperties" => false,
|
|
28
28
|
"properties" => {
|
|
29
29
|
"groomer" => {
|
|
@@ -53,7 +53,7 @@ module MU
|
|
|
53
53
|
},
|
|
54
54
|
"engine_version" => {"type" => "string"},
|
|
55
55
|
"engine" => {
|
|
56
|
-
"enum" => ["mysql", "postgres", "oracle-se1", "oracle-se2", "oracle-se", "oracle-ee", "sqlserver-ee", "sqlserver-se", "sqlserver-ex", "sqlserver-web", "aurora", "mariadb"],
|
|
56
|
+
"enum" => ["mysql", "postgres", "oracle", "oracle-se1", "oracle-se2", "oracle-se", "oracle-ee", "sqlserver-ee", "sqlserver-se", "sqlserver-ex", "sqlserver-web", "aurora", "mariadb"],
|
|
57
57
|
"type" => "string"
|
|
58
58
|
},
|
|
59
59
|
"add_cluster_node" => {
|
|
@@ -61,10 +61,7 @@ module MU
|
|
|
61
61
|
"description" => "Internal use",
|
|
62
62
|
"default" => false
|
|
63
63
|
},
|
|
64
|
-
"member_of_cluster" =>
|
|
65
|
-
"description" => "Internal use",
|
|
66
|
-
"type" => "object"
|
|
67
|
-
},
|
|
64
|
+
"member_of_cluster" => MU::Config::Ref.schema(type: "databases", desc: "Internal use"),
|
|
68
65
|
"dns_records" => MU::Config::DNSZone.records_primitive(need_target: false, default_type: "CNAME", need_zone: true),
|
|
69
66
|
"dns_sync_wait" => {
|
|
70
67
|
"type" => "boolean",
|
|
@@ -78,20 +75,16 @@ module MU
|
|
|
78
75
|
},
|
|
79
76
|
"storage" => {
|
|
80
77
|
"type" => "integer",
|
|
81
|
-
"description" => "Storage space for this database instance (GB)."
|
|
82
|
-
|
|
83
|
-
"storage_type" => {
|
|
84
|
-
"enum" => ["standard", "gp2", "io1"],
|
|
85
|
-
"type" => "string",
|
|
86
|
-
"default" => "gp2"
|
|
78
|
+
"description" => "Storage space for this database instance (GB).",
|
|
79
|
+
"default" => 20
|
|
87
80
|
},
|
|
88
81
|
"run_sql_on_deploy" => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
"type" => "array",
|
|
83
|
+
"minItems" => 1,
|
|
84
|
+
"items" => {
|
|
85
|
+
"description" => "Arbitrary SQL commands to run after the database is fully configred (PostgreSQL databases only).",
|
|
86
|
+
"type" => "string"
|
|
87
|
+
}
|
|
95
88
|
},
|
|
96
89
|
"port" => {"type" => "integer"},
|
|
97
90
|
"vpc" => MU::Config::VPC.reference(MU::Config::VPC::MANY_SUBNETS, MU::Config::VPC::NAT_OPTS, "all_public"),
|
|
@@ -144,22 +137,24 @@ module MU
|
|
|
144
137
|
"default" => false
|
|
145
138
|
},
|
|
146
139
|
"creation_style" => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
140
|
+
"type" => "string",
|
|
141
|
+
"enum" => ["existing", "new", "new_snapshot", "existing_snapshot", "point_in_time"],
|
|
142
|
+
"description" => "+new+ creates a pristine database instance; +existing+ clones an existing database instance; +new_snapshot+ creates a snapshot of an existing database, then creates a new instance from that snapshot; +existing_snapshot+ creates database from a pre-existing snapshot; +point_in_time+ create database from point in time backup of an existing database. All styles other than +new+ require that +identifier+ or +source+ be set.",
|
|
143
|
+
"default" => "new"
|
|
151
144
|
},
|
|
152
145
|
"identifier" => {
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
"type" => "string",
|
|
147
|
+
"description" => "Cloud id of a source database to use for creation styles other than +new+; use +source+ for more sophisticated resource references."
|
|
155
148
|
},
|
|
149
|
+
"source" => MU::Config::Ref.schema(type: "databases", "desc": "Reference a source database to use for +creation_style+ settings +existing+, +new_snapshot+, +existing_snapshot+, or +point_in_time+."),
|
|
156
150
|
"master_user" => {
|
|
157
151
|
"type" => "string",
|
|
158
152
|
"description" => "Set master user name for this database instance; if not specified a random username will be generated"
|
|
159
153
|
},
|
|
160
154
|
"restore_time" => {
|
|
161
155
|
"type" => "string",
|
|
162
|
-
"description" => "Must either be set to 'latest' or date/time value in the following format: 2015-09-12T22:30:00Z. Applies only to point_in_time creation_style"
|
|
156
|
+
"description" => "Must either be set to 'latest' or date/time value in the following format: 2015-09-12T22:30:00Z. Applies only to point_in_time creation_style",
|
|
157
|
+
"default" => "latest"
|
|
163
158
|
},
|
|
164
159
|
"create_read_replica" => {
|
|
165
160
|
"type" => "boolean",
|
|
@@ -215,27 +210,11 @@ module MU
|
|
|
215
210
|
# Schema block for other resources to use when referencing a sibling Database
|
|
216
211
|
# @return [Hash]
|
|
217
212
|
def self.reference
|
|
218
|
-
|
|
219
|
-
"
|
|
220
|
-
"
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
"properties" => {
|
|
224
|
-
"db_id" => {"type" => "string"},
|
|
225
|
-
"db_name" => {"type" => "string"},
|
|
226
|
-
"region" => MU::Config.region_primitive,
|
|
227
|
-
"cloud" => MU::Config.cloud_primitive,
|
|
228
|
-
"tag" => {
|
|
229
|
-
"type" => "string",
|
|
230
|
-
"description" => "Identify this Database by a tag (key=value). Note that this tag must not match more than one resource.",
|
|
231
|
-
"pattern" => "^[^=]+=.+"
|
|
232
|
-
},
|
|
233
|
-
"deploy_id" => {
|
|
234
|
-
"type" => "string",
|
|
235
|
-
"description" => "Look for a Database fitting this description in another Mu deployment with this id.",
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
213
|
+
schema_aliases = [
|
|
214
|
+
{ "db_id" => "id" },
|
|
215
|
+
{ "db_name" => "name" }
|
|
216
|
+
]
|
|
217
|
+
MU::Config::Ref.schema(schema_aliases, type: "databases")
|
|
239
218
|
end
|
|
240
219
|
|
|
241
220
|
# Generic pre-processing of {MU::Config::BasketofKittens::databases}, bare and unvalidated.
|
|
@@ -266,6 +245,22 @@ module MU
|
|
|
266
245
|
end
|
|
267
246
|
end
|
|
268
247
|
|
|
248
|
+
if db["identifier"]
|
|
249
|
+
if db["source"]
|
|
250
|
+
if db["source"]["id"] != db["identifier"]
|
|
251
|
+
MU.log "Database #{db['name']} specified identifier '#{db["identifier"]}' with a source parameter that doesn't match", MU::ERR, db["source"]
|
|
252
|
+
ok = false
|
|
253
|
+
end
|
|
254
|
+
else
|
|
255
|
+
db["source"] = MU::Config::Ref.get(
|
|
256
|
+
id: db["identifier"],
|
|
257
|
+
cloud: db["cloud"],
|
|
258
|
+
credentials: db["credentials"],
|
|
259
|
+
type: "databases"
|
|
260
|
+
)
|
|
261
|
+
end
|
|
262
|
+
db.delete("identifier")
|
|
263
|
+
end
|
|
269
264
|
|
|
270
265
|
if db["storage"].nil? and db["creation_style"] == "new" and !db['create_cluster']
|
|
271
266
|
MU.log "Must provide a value for 'storage' when creating a new database.", MU::ERR, details: db
|
|
@@ -296,13 +291,13 @@ module MU
|
|
|
296
291
|
|
|
297
292
|
if db["creation_style"] == "point_in_time" && db["restore_time"].nil?
|
|
298
293
|
ok = false
|
|
299
|
-
MU.log "
|
|
294
|
+
MU.log "Database '#{db['name']}' must provide restore_time when creation_style is point_in_time", MU::ERR
|
|
300
295
|
end
|
|
301
296
|
|
|
302
297
|
if %w{existing new_snapshot existing_snapshot point_in_time}.include?(db["creation_style"])
|
|
303
|
-
if db["
|
|
298
|
+
if db["source"].nil?
|
|
304
299
|
ok = false
|
|
305
|
-
MU.log "
|
|
300
|
+
MU.log "Database '#{db['name']}' needs existing database/snapshot, but no identifier or source was specified", MU::ERR
|
|
306
301
|
end
|
|
307
302
|
end
|
|
308
303
|
|
|
@@ -336,16 +331,17 @@ module MU
|
|
|
336
331
|
replica["credentials"] = db["credentials"]
|
|
337
332
|
replica['create_read_replica'] = false
|
|
338
333
|
replica["create_cluster"] = false
|
|
334
|
+
replica["region"] = db['read_replica_region']
|
|
335
|
+
if db['region'] != replica['region']
|
|
336
|
+
replica.delete("vpc")
|
|
337
|
+
end
|
|
339
338
|
replica['read_replica_of'] = {
|
|
340
|
-
"
|
|
339
|
+
"name" => db['name'],
|
|
341
340
|
"cloud" => db['cloud'],
|
|
342
|
-
"region" => db['
|
|
343
|
-
|
|
344
|
-
replica['dependencies'] << {
|
|
345
|
-
"type" => "database",
|
|
346
|
-
"name" => db["name"],
|
|
347
|
-
"phase" => "groom"
|
|
341
|
+
"region" => db['region'],
|
|
342
|
+
"credentials" => db['credentials'],
|
|
348
343
|
}
|
|
344
|
+
MU::Config.addDependency(replica, db["name"], "database", phase: "groom")
|
|
349
345
|
read_replicas << replica
|
|
350
346
|
end
|
|
351
347
|
end
|
|
@@ -354,6 +350,7 @@ module MU
|
|
|
354
350
|
# duplicating the declaration of the master as a new first-class
|
|
355
351
|
# resource and tweaking it.
|
|
356
352
|
if db["create_cluster"] and db['cluster_mode'] != "serverless"
|
|
353
|
+
db["add_cluster_node"] = false
|
|
357
354
|
(1..db["cluster_node_count"]).each{ |num|
|
|
358
355
|
node = Marshal.load(Marshal.dump(db))
|
|
359
356
|
node["name"] = "#{db['name']}-#{num}"
|
|
@@ -363,16 +360,14 @@ module MU
|
|
|
363
360
|
node["creation_style"] = "new"
|
|
364
361
|
node["add_cluster_node"] = true
|
|
365
362
|
node["member_of_cluster"] = {
|
|
366
|
-
"
|
|
363
|
+
"name" => db['name'],
|
|
367
364
|
"cloud" => db['cloud'],
|
|
368
|
-
"region" => db['region']
|
|
365
|
+
"region" => db['region'],
|
|
366
|
+
"credentials" => db['credentials'],
|
|
367
|
+
"type" => "databases"
|
|
369
368
|
}
|
|
370
369
|
# AWS will figure out for us which database instance is the writer/master so we can create all of them concurrently.
|
|
371
|
-
node[
|
|
372
|
-
"type" => "database",
|
|
373
|
-
"name" => db["name"],
|
|
374
|
-
"phase" => "groom"
|
|
375
|
-
}
|
|
370
|
+
MU::Config.addDependency(node, db["name"], "database", phase: "groom")
|
|
376
371
|
cluster_nodes << node
|
|
377
372
|
|
|
378
373
|
# Alarms are set on each DB cluster node, not on the cluster itself,
|
|
@@ -387,55 +382,39 @@ module MU
|
|
|
387
382
|
end
|
|
388
383
|
|
|
389
384
|
if !db['read_replica_of'].nil?
|
|
390
|
-
rr = db['read_replica_of']
|
|
391
|
-
if !rr
|
|
392
|
-
db['dependencies'] << { "name" => rr
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
rr['cloud'],
|
|
398
|
-
"database",
|
|
399
|
-
deploy_id: rr["deploy_id"],
|
|
400
|
-
cloud_id: rr["db_id"],
|
|
401
|
-
tag_key: tag_key,
|
|
402
|
-
tag_value: tag_value,
|
|
403
|
-
region: rr["region"],
|
|
404
|
-
dummy_ok: true
|
|
405
|
-
)
|
|
406
|
-
ext_database = found.first if !found.nil? and found.size == 1
|
|
407
|
-
if !ext_database
|
|
408
|
-
MU.log "Couldn't resolve Database reference to a unique live Database in #{db['name']}", MU::ERR, details: rr
|
|
409
|
-
ok = false
|
|
410
|
-
end
|
|
385
|
+
rr = MU::Config::Ref.get(db['read_replica_of'])
|
|
386
|
+
if rr.name and !rr.deploy_id
|
|
387
|
+
db['dependencies'] << { "name" => rr.name, "type" => "database" }
|
|
388
|
+
MU::Config.addDependency(db, rr.name, "database")
|
|
389
|
+
elsif !rr.kitten
|
|
390
|
+
MU.log "Couldn't resolve Database reference to a unique live Database in #{db['name']}", MU::ERR, details: rr
|
|
391
|
+
ok = false
|
|
411
392
|
end
|
|
412
393
|
elsif db["member_of_cluster"]
|
|
413
|
-
|
|
414
|
-
if
|
|
415
|
-
if !configurator.haveLitterMate?(
|
|
416
|
-
MU.log "Database cluster node #{db['name']} references sibling source #{
|
|
394
|
+
cluster = MU::Config::Ref.get(db["member_of_cluster"])
|
|
395
|
+
if cluster['name']
|
|
396
|
+
if !configurator.haveLitterMate?(cluster['name'], "databases")
|
|
397
|
+
MU.log "Database cluster node #{db['name']} references sibling source #{cluster['name']}, but I have no such database", MU::ERR
|
|
417
398
|
ok = false
|
|
418
399
|
end
|
|
419
400
|
else
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
found = MU::MommaCat.findStray(
|
|
423
|
-
rr['cloud'],
|
|
424
|
-
"database",
|
|
425
|
-
deploy_id: rr["deploy_id"],
|
|
426
|
-
cloud_id: rr["db_id"],
|
|
427
|
-
tag_key: tag_key,
|
|
428
|
-
tag_value: tag_value,
|
|
429
|
-
region: rr["region"],
|
|
430
|
-
dummy_ok: true
|
|
431
|
-
)
|
|
432
|
-
ext_database = found.first if !found.nil? and found.size == 1
|
|
433
|
-
if !ext_database
|
|
434
|
-
MU.log "Couldn't resolve Database reference to a unique live Database in #{db['name']}", MU::ERR, details: rr
|
|
401
|
+
if !cluster.kitten
|
|
402
|
+
MU.log "Couldn't resolve Database reference to a unique live Database in #{db['name']}", MU::ERR, details: cluster.to_h
|
|
435
403
|
ok = false
|
|
436
404
|
end
|
|
437
405
|
end
|
|
438
406
|
end
|
|
407
|
+
|
|
408
|
+
if db["source"]
|
|
409
|
+
|
|
410
|
+
if db["source"]["name"] and
|
|
411
|
+
!db["source"]["deploy_id"] and
|
|
412
|
+
configurator.haveLitterMate?(db["source"]["name"], "databases")
|
|
413
|
+
MU::Config.addDependency(db, db["source"]["name"], "database")
|
|
414
|
+
end
|
|
415
|
+
db["source"]["cloud"] ||= db["cloud"]
|
|
416
|
+
end
|
|
417
|
+
|
|
439
418
|
db['dependencies'].uniq!
|
|
440
419
|
|
|
441
420
|
read_replicas.each { |new_replica|
|
|
@@ -4,7 +4,7 @@ name: database-complex
|
|
|
4
4
|
size: db.r4.large
|
|
5
5
|
engine: postgres
|
|
6
6
|
engine_version: 9.6.6
|
|
7
|
-
storage:
|
|
7
|
+
storage: 21
|
|
8
8
|
add_cluster_node: true
|
|
9
9
|
allow_major_version_upgrade: true
|
|
10
10
|
auto_minor_version_upgrade: false
|
|
@@ -24,6 +24,5 @@ vpc:
|
|
|
24
24
|
name: <%= vpc_name %>
|
|
25
25
|
size: <%= db_size %>
|
|
26
26
|
engine: mariadb
|
|
27
|
-
storage: 5
|
|
28
27
|
|
|
29
28
|
<% end %>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/dnszone.rb
|
|
18
18
|
class DNSZone
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a DNSZone
|
|
@@ -25,14 +25,13 @@ module MU
|
|
|
25
25
|
MU::Cloud.resource_types.each_pair { |classname, attrs|
|
|
26
26
|
MU::Cloud.supportedClouds.each { |cloud|
|
|
27
27
|
begin
|
|
28
|
-
require "mu/
|
|
28
|
+
require "mu/providers/#{cloud.downcase}/#{attrs[:cfg_name]}"
|
|
29
29
|
rescue LoadError
|
|
30
30
|
next
|
|
31
31
|
end
|
|
32
|
-
|
|
33
|
-
_required, res_schema = res_class.schema(self)
|
|
32
|
+
_required, res_schema = MU::Cloud.resourceClass(cloud, classname).schema(self)
|
|
34
33
|
docschema["properties"][attrs[:cfg_plural]]["items"]["description"] ||= ""
|
|
35
|
-
docschema["properties"][attrs[:cfg_plural]]["items"]["description"] += "\n#\n# `#{cloud}`: "+
|
|
34
|
+
docschema["properties"][attrs[:cfg_plural]]["items"]["description"] += "\n#\n# `#{cloud}`: "+MU::Cloud.resourceClass(cloud, classname).quality
|
|
36
35
|
res_schema.each { |key, cfg|
|
|
37
36
|
if !docschema["properties"][attrs[:cfg_plural]]["items"]["properties"][key]
|
|
38
37
|
only_children[attrs[:cfg_plural]] ||= {}
|
|
@@ -61,7 +60,7 @@ module MU
|
|
|
61
60
|
MU::Cloud.supportedClouds.each { |cloud|
|
|
62
61
|
res_class = nil
|
|
63
62
|
begin
|
|
64
|
-
res_class =
|
|
63
|
+
res_class = MU::Cloud.resourceClass(cloud, classname)
|
|
65
64
|
rescue MU::Cloud::MuCloudResourceNotImplemented
|
|
66
65
|
next
|
|
67
66
|
end
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/api.rb
|
|
18
18
|
class Endpoint
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for an Endpoint (e.g. AWS API Gateway)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
module MU
|
|
16
16
|
class Config
|
|
17
|
-
# Basket of Kittens config schema and parser logic. See modules/mu/
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/firewall_rule.rb
|
|
18
18
|
class FirewallRule
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a FirewallRule
|
|
@@ -119,21 +119,7 @@ module MU
|
|
|
119
119
|
if acl_include['sgs']
|
|
120
120
|
acl_include['sgs'].each { |sg_ref|
|
|
121
121
|
if haveLitterMate?(sg_ref, "firewall_rules")
|
|
122
|
-
acl
|
|
123
|
-
found = false
|
|
124
|
-
acl["dependencies"].each { |dep|
|
|
125
|
-
if dep["type"] == "firewall_rule" and dep["name"] == sg_ref
|
|
126
|
-
dep["no_create_wait"] = true
|
|
127
|
-
found = true
|
|
128
|
-
end
|
|
129
|
-
}
|
|
130
|
-
if !found
|
|
131
|
-
acl["dependencies"] << {
|
|
132
|
-
"type" => "firewall_rule",
|
|
133
|
-
"name" => sg_ref,
|
|
134
|
-
"no_create_wait" => true
|
|
135
|
-
}
|
|
136
|
-
end
|
|
122
|
+
MU::Config.addDependency(acl, sg_ref, "firewall_rule", no_create_wait: true)
|
|
137
123
|
siblingfw = haveLitterMate?(sg_ref, "firewall_rules")
|
|
138
124
|
if !siblingfw["#MU_VALIDATED"]
|
|
139
125
|
# XXX raise failure somehow
|
|
@@ -180,8 +166,6 @@ module MU
|
|
|
180
166
|
]
|
|
181
167
|
end
|
|
182
168
|
|
|
183
|
-
resclass = Object.const_get("MU").const_get("Cloud").const_get(cloud).const_get("FirewallRule")
|
|
184
|
-
|
|
185
169
|
if rules_only
|
|
186
170
|
return rules
|
|
187
171
|
end
|
|
@@ -217,7 +201,7 @@ module MU
|
|
|
217
201
|
acl['project'] = acl["vpc"]["habitat"]["id"] || acl["vpc"]["habitat"]["name"]
|
|
218
202
|
end
|
|
219
203
|
acl.delete("vpc") if !acl["vpc"]
|
|
220
|
-
if !
|
|
204
|
+
if !MU::Cloud.resourceClass(cloud, "FirewallRule").isGlobal? and !region.nil? and !region.empty?
|
|
221
205
|
acl["region"] = region
|
|
222
206
|
end
|
|
223
207
|
@admin_firewall_rules << acl if !@admin_firewall_rules.include?(acl)
|