cloud-mu 3.1.5 → 3.3.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/Dockerfile +5 -1
- data/ansible/roles/mu-windows/files/LaunchConfig.json +9 -0
- data/ansible/roles/mu-windows/files/config.xml +76 -0
- data/ansible/roles/mu-windows/tasks/main.yml +16 -0
- data/bin/mu-adopt +16 -12
- data/bin/mu-azure-tests +57 -0
- data/bin/mu-cleanup +2 -4
- data/bin/mu-configure +52 -0
- data/bin/mu-deploy +3 -3
- data/bin/mu-findstray-tests +25 -0
- data/bin/mu-gen-docs +2 -4
- data/bin/mu-load-config.rb +2 -1
- data/bin/mu-node-manage +15 -16
- data/bin/mu-run-tests +37 -12
- data/cloud-mu.gemspec +3 -3
- data/cookbooks/mu-activedirectory/resources/domain.rb +4 -4
- data/cookbooks/mu-activedirectory/resources/domain_controller.rb +4 -4
- 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/cookbooks/mu-tools/recipes/eks.rb +2 -2
- data/cookbooks/mu-tools/recipes/windows-client.rb +25 -22
- data/extras/clean-stock-amis +25 -19
- data/extras/generate-stock-images +1 -0
- data/extras/image-generators/AWS/win2k12.yaml +2 -0
- data/extras/image-generators/AWS/win2k16.yaml +2 -0
- data/extras/image-generators/AWS/win2k19.yaml +2 -0
- data/modules/mommacat.ru +1 -1
- data/modules/mu.rb +86 -98
- data/modules/mu/adoption.rb +373 -58
- data/modules/mu/cleanup.rb +214 -303
- data/modules/mu/cloud.rb +128 -1733
- data/modules/mu/cloud/database.rb +49 -0
- data/modules/mu/cloud/dnszone.rb +44 -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 +929 -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 +169 -0
- data/modules/mu/config.rb +123 -81
- data/modules/mu/config/alarm.rb +2 -6
- data/modules/mu/config/bucket.rb +32 -3
- data/modules/mu/config/cache_cluster.rb +2 -2
- data/modules/mu/config/cdn.rb +100 -0
- data/modules/mu/config/collection.rb +1 -1
- data/modules/mu/config/container_cluster.rb +7 -2
- data/modules/mu/config/database.rb +84 -105
- data/modules/mu/config/database.yml +1 -2
- data/modules/mu/config/dnszone.rb +5 -4
- data/modules/mu/config/doc_helpers.rb +5 -6
- data/modules/mu/config/endpoint.rb +2 -1
- data/modules/mu/config/firewall_rule.rb +3 -19
- data/modules/mu/config/folder.rb +1 -1
- data/modules/mu/config/function.rb +17 -8
- data/modules/mu/config/group.rb +1 -1
- data/modules/mu/config/habitat.rb +1 -1
- data/modules/mu/config/job.rb +89 -0
- 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 +8 -19
- data/modules/mu/config/ref.rb +92 -14
- data/modules/mu/config/role.rb +1 -1
- data/modules/mu/config/schema_helpers.rb +38 -37
- data/modules/mu/config/search_domain.rb +1 -1
- data/modules/mu/config/server.rb +12 -13
- data/modules/mu/config/server_pool.rb +3 -7
- data/modules/mu/config/storage_pool.rb +1 -1
- data/modules/mu/config/tail.rb +11 -0
- data/modules/mu/config/user.rb +1 -1
- data/modules/mu/config/vpc.rb +27 -23
- data/modules/mu/config/vpc.yml +0 -1
- data/modules/mu/defaults/AWS.yaml +90 -90
- data/modules/mu/defaults/Azure.yaml +1 -0
- data/modules/mu/defaults/Google.yaml +1 -0
- data/modules/mu/deploy.rb +34 -20
- data/modules/mu/groomer.rb +16 -1
- data/modules/mu/groomers/ansible.rb +69 -4
- data/modules/mu/groomers/chef.rb +51 -4
- data/modules/mu/logger.rb +120 -144
- data/modules/mu/master.rb +97 -4
- data/modules/mu/mommacat.rb +160 -874
- data/modules/mu/mommacat/daemon.rb +23 -14
- data/modules/mu/mommacat/naming.rb +110 -3
- data/modules/mu/mommacat/search.rb +497 -0
- data/modules/mu/mommacat/storage.rb +252 -194
- data/modules/mu/{clouds → providers}/README.md +1 -1
- data/modules/mu/{clouds → providers}/aws.rb +258 -57
- data/modules/mu/{clouds → providers}/aws/alarm.rb +3 -3
- data/modules/mu/{clouds → providers}/aws/bucket.rb +275 -41
- data/modules/mu/{clouds → providers}/aws/cache_cluster.rb +14 -50
- data/modules/mu/providers/aws/cdn.rb +782 -0
- data/modules/mu/{clouds → providers}/aws/collection.rb +5 -5
- data/modules/mu/{clouds → providers}/aws/container_cluster.rb +95 -84
- data/modules/mu/providers/aws/database.rb +1744 -0
- data/modules/mu/{clouds → providers}/aws/dnszone.rb +26 -12
- data/modules/mu/providers/aws/endpoint.rb +1072 -0
- data/modules/mu/{clouds → providers}/aws/firewall_rule.rb +39 -32
- data/modules/mu/{clouds → providers}/aws/folder.rb +1 -1
- data/modules/mu/{clouds → providers}/aws/function.rb +289 -134
- data/modules/mu/{clouds → providers}/aws/group.rb +18 -20
- data/modules/mu/{clouds → providers}/aws/habitat.rb +3 -3
- data/modules/mu/providers/aws/job.rb +466 -0
- data/modules/mu/{clouds → providers}/aws/loadbalancer.rb +77 -47
- data/modules/mu/{clouds → providers}/aws/log.rb +5 -5
- data/modules/mu/{clouds → providers}/aws/msg_queue.rb +14 -11
- data/modules/mu/{clouds → providers}/aws/nosqldb.rb +96 -5
- data/modules/mu/{clouds → providers}/aws/notifier.rb +135 -63
- data/modules/mu/{clouds → providers}/aws/role.rb +76 -48
- data/modules/mu/{clouds → providers}/aws/search_domain.rb +172 -41
- data/modules/mu/{clouds → providers}/aws/server.rb +66 -98
- data/modules/mu/{clouds → providers}/aws/server_pool.rb +42 -60
- data/modules/mu/{clouds → providers}/aws/storage_pool.rb +21 -38
- data/modules/mu/{clouds → providers}/aws/user.rb +12 -16
- data/modules/mu/{clouds → providers}/aws/userdata/README.md +0 -0
- data/modules/mu/{clouds → providers}/aws/userdata/linux.erb +5 -4
- data/modules/mu/{clouds → providers}/aws/userdata/windows.erb +0 -0
- data/modules/mu/{clouds → providers}/aws/vpc.rb +143 -74
- data/modules/mu/{clouds → providers}/aws/vpc_subnet.rb +0 -0
- data/modules/mu/{clouds → providers}/azure.rb +13 -0
- 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 +32 -24
- 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 +10 -0
- 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 +29 -6
- data/modules/mu/{clouds → providers}/google/bucket.rb +4 -4
- data/modules/mu/{clouds → providers}/google/container_cluster.rb +38 -20
- data/modules/mu/{clouds → providers}/google/database.rb +5 -12
- data/modules/mu/{clouds → providers}/google/firewall_rule.rb +5 -5
- data/modules/mu/{clouds → providers}/google/folder.rb +5 -9
- data/modules/mu/{clouds → providers}/google/function.rb +6 -6
- data/modules/mu/{clouds → providers}/google/group.rb +9 -17
- data/modules/mu/{clouds → providers}/google/habitat.rb +4 -8
- data/modules/mu/{clouds → providers}/google/loadbalancer.rb +5 -5
- data/modules/mu/{clouds → providers}/google/role.rb +50 -31
- data/modules/mu/{clouds → providers}/google/server.rb +41 -24
- data/modules/mu/{clouds → providers}/google/server_pool.rb +14 -14
- data/modules/mu/{clouds → providers}/google/user.rb +34 -24
- 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 +45 -14
- data/modules/tests/aws-jobs-functions.yaml +46 -0
- data/modules/tests/centos6.yaml +15 -0
- data/modules/tests/centos7.yaml +15 -0
- data/modules/tests/centos8.yaml +12 -0
- data/modules/tests/ecs.yaml +2 -2
- data/modules/tests/eks.yaml +1 -1
- data/modules/tests/functions/node-function/lambda_function.js +10 -0
- data/modules/tests/functions/python-function/lambda_function.py +12 -0
- data/modules/tests/microservice_app.yaml +288 -0
- data/modules/tests/rds.yaml +108 -0
- data/modules/tests/regrooms/rds.yaml +123 -0
- data/modules/tests/server-with-scrub-muisms.yaml +1 -1
- data/modules/tests/super_complex_bok.yml +2 -2
- data/modules/tests/super_simple_bok.yml +3 -5
- data/spec/mu/clouds/azure_spec.rb +2 -2
- metadata +122 -92
- data/modules/mu/clouds/aws/database.rb +0 -1974
- data/modules/mu/clouds/aws/endpoint.rb +0 -596
|
@@ -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
|
|
@@ -60,7 +60,7 @@ module MU
|
|
|
60
60
|
# @param default_type [String]: The type of record to make default (e.g. An, CNAME, etc)
|
|
61
61
|
# @param need_zone [Boolean]: Whether to explicitly require a zone be declared
|
|
62
62
|
# @return [Hash]
|
|
63
|
-
def self.records_primitive(need_target: true, default_type: nil, need_zone: false)
|
|
63
|
+
def self.records_primitive(need_target: true, default_type: nil, need_zone: false, embedded_type: nil)
|
|
64
64
|
dns_records_primitive = {
|
|
65
65
|
"type" => "array",
|
|
66
66
|
"maxItems" => 100,
|
|
@@ -107,8 +107,9 @@ module MU
|
|
|
107
107
|
},
|
|
108
108
|
"mu_type" => {
|
|
109
109
|
"type" => "string",
|
|
110
|
-
"description" => "The
|
|
111
|
-
|
|
110
|
+
"description" => "The mu type of a resource being targeted.",
|
|
111
|
+
"enum" => embedded_type ? [embedded_type] : ["loadbalancer", "server", "database", "cache_cluster", "endpoint", "cdn"],
|
|
112
|
+
"default" => embedded_type
|
|
112
113
|
},
|
|
113
114
|
"target_type" => {
|
|
114
115
|
"description" => "If the target is a public or a private resource. This only applies to servers/server_pools when using automatic DNS registration. If set to public but the target only has a private address, the private address will be used",
|
|
@@ -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
|
|
@@ -239,7 +238,7 @@ $CONFIGURABLES
|
|
|
239
238
|
|
|
240
239
|
if class_hierarchy.size == 1
|
|
241
240
|
|
|
242
|
-
_shortclass, cfg_name, cfg_plural, _classname = MU::Cloud.getResourceNames(name)
|
|
241
|
+
_shortclass, cfg_name, cfg_plural, _classname = MU::Cloud.getResourceNames(name, false)
|
|
243
242
|
if cfg_name
|
|
244
243
|
example_path = MU.myRoot+"/modules/mu/config/"+cfg_name+".yml"
|
|
245
244
|
if File.exist?(example_path)
|
|
@@ -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)
|
|
@@ -32,6 +32,7 @@ module MU
|
|
|
32
32
|
"iam_role" => {"type" => "string"},
|
|
33
33
|
"region" => MU::Config.region_primitive,
|
|
34
34
|
"vpc" => MU::Config::VPC.reference(MU::Config::VPC::NO_SUBNETS, MU::Config::VPC::NO_NAT_OPTS),
|
|
35
|
+
"dns_records" => MU::Config::DNSZone.records_primitive(need_target: false, default_type: "CNAME", need_zone: true, embedded_type: "endpoint"),
|
|
35
36
|
"methods" => {
|
|
36
37
|
"type" => "array",
|
|
37
38
|
"items" => {
|
|
@@ -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)
|
data/modules/mu/config/folder.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/*/folder.rb
|
|
18
18
|
class Folder
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Folder
|
|
@@ -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/*/function.rb
|
|
18
18
|
class Function
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Function
|
|
@@ -71,6 +71,10 @@ module MU
|
|
|
71
71
|
"zip_file" => {
|
|
72
72
|
"type" => "string",
|
|
73
73
|
"description" => "Path to a zipped deployment package to upload."
|
|
74
|
+
},
|
|
75
|
+
"path" => {
|
|
76
|
+
"type" => "string",
|
|
77
|
+
"description" => "Path to a directory that can be zipped into deployment package to upload."
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
},
|
|
@@ -106,13 +110,18 @@ module MU
|
|
|
106
110
|
if !function['code']
|
|
107
111
|
ok = false
|
|
108
112
|
end
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
|
|
114
|
+
if function['code']
|
|
115
|
+
['zip_file', 'path'].each { |src|
|
|
116
|
+
if function['code'][src]
|
|
117
|
+
if !File.readable?(function['code'][src]) and !Dir.exists?(function['code'][src])
|
|
118
|
+
MU.log "Function '#{function['name']}' specifies a deployment package that I can't read at #{function['code'][src]}", MU::ERR
|
|
119
|
+
ok = false
|
|
120
|
+
else
|
|
121
|
+
function['code'][src] = File.realpath(File.expand_path(function['code'][src]))
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
}
|
|
116
125
|
end
|
|
117
126
|
|
|
118
127
|
ok
|
data/modules/mu/config/group.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/*/group.rb
|
|
18
18
|
class Group
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Group
|
|
@@ -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/*/project.rb
|
|
18
18
|
class Habitat
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Habitat
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Copyright:: Copyright (c) 2020 eGlobalTech, Inc., all rights reserved
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the BSD-3 license (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License in the root of the project or at
|
|
6
|
+
#
|
|
7
|
+
# http://egt-labs.com/mu/LICENSE.html
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
module MU
|
|
16
|
+
class Config
|
|
17
|
+
# Basket of Kittens config schema and parser logic. See modules/mu/providers/*/job.rb
|
|
18
|
+
class Job
|
|
19
|
+
|
|
20
|
+
# Base configuration schema for a scheduled job
|
|
21
|
+
# @return [Hash]
|
|
22
|
+
def self.schema
|
|
23
|
+
{
|
|
24
|
+
"type" => "object",
|
|
25
|
+
"additionalProperties" => false,
|
|
26
|
+
"description" => "A cloud provider-specific facility for triggered or scheduled tasks, such as AWS CloudWatch Events or Google Cloud Scheduler.",
|
|
27
|
+
"properties" => {
|
|
28
|
+
"name" => {
|
|
29
|
+
"type" => "string"
|
|
30
|
+
},
|
|
31
|
+
"region" => MU::Config.region_primitive,
|
|
32
|
+
"credentials" => MU::Config.credentials_primitive,
|
|
33
|
+
"description" => {
|
|
34
|
+
"type" => "string",
|
|
35
|
+
"description" => "Human-readable description field for this job (this will field be overriden with the Mu deploy id on most providers unless +scrub_mu_isms+ is set)"
|
|
36
|
+
},
|
|
37
|
+
"schedule" => {
|
|
38
|
+
"type" => "object",
|
|
39
|
+
"description" => "A schedule on which to invoke this task, typically unix crontab style.",
|
|
40
|
+
"properties" => {
|
|
41
|
+
"minute" => {
|
|
42
|
+
"type" => "string",
|
|
43
|
+
"description" => "The minute of the hour at which to invoke this job, typically an integer between 0 and 59. This will be validated by the cloud provider, where other more human-readable values may be supported.",
|
|
44
|
+
"default" => "0"
|
|
45
|
+
},
|
|
46
|
+
"hour" => {
|
|
47
|
+
"type" => "string",
|
|
48
|
+
"description" => "The hour at which to invoke this job, typically an integer between 0 and 23. This will be validated by the cloud provider, where other more human-readable values may be supported.",
|
|
49
|
+
"default" => "*"
|
|
50
|
+
},
|
|
51
|
+
"day_of_month" => {
|
|
52
|
+
"type" => "string",
|
|
53
|
+
"description" => "The day of the month which to invoke this job, typically an integer between 1 and 31. This will be validated by the cloud provider, where other more human-readable values may be supported.",
|
|
54
|
+
"default" => "*"
|
|
55
|
+
},
|
|
56
|
+
"month" => {
|
|
57
|
+
"type" => "string",
|
|
58
|
+
"description" => "The month in which to invoke this job, typically an integer between 1 and 12. This will be validated by the cloud provider, where other more human-readable values may be supported.",
|
|
59
|
+
"default" => "*"
|
|
60
|
+
},
|
|
61
|
+
"day_of_week" => {
|
|
62
|
+
"type" => "string",
|
|
63
|
+
"description" => "The day of the week on which to invoke this job, typically an integer between 0 and 6. This will be validated by the cloud provider, where other more human-readable values may be supported.",
|
|
64
|
+
"default" => "*"
|
|
65
|
+
},
|
|
66
|
+
"year" => {
|
|
67
|
+
"type" => "string",
|
|
68
|
+
"description" => "The year in which to invoke this job. Not honored by all cloud providers.",
|
|
69
|
+
"default" => "*"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Generic pre-processing of {MU::Config::BasketofKittens::jobs}, bare and unvalidated.
|
|
78
|
+
# @param _job [Hash]: The resource to process and validate
|
|
79
|
+
# @param _configurator [MU::Config]: The overall deployment configurator of which this resource is a member
|
|
80
|
+
# @return [Boolean]: True if validation succeeded, False otherwise
|
|
81
|
+
def self.validate(_job, _configurator)
|
|
82
|
+
ok = true
|
|
83
|
+
|
|
84
|
+
ok
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
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/*/loadbalancer.rb
|
|
18
18
|
class LoadBalancer
|
|
19
19
|
|
|
20
20
|
# Generate schema for a LoadBalancer health check
|
|
@@ -64,6 +64,45 @@ module MU
|
|
|
64
64
|
}
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
# Generate schema for a LoadBalancer redirect
|
|
68
|
+
# @return [Hash]
|
|
69
|
+
def self.redirect
|
|
70
|
+
{
|
|
71
|
+
"type" => "object",
|
|
72
|
+
"title" => "redirect",
|
|
73
|
+
"additionalProperties" => false,
|
|
74
|
+
"description" => "Instruct our LoadBalancer to redirect traffic to another host, port, and/or path.",
|
|
75
|
+
"properties" => {
|
|
76
|
+
"protocol" => {
|
|
77
|
+
"type" => "string",
|
|
78
|
+
"default" => "HTTPS"
|
|
79
|
+
},
|
|
80
|
+
"port" => {
|
|
81
|
+
"type" => "integer",
|
|
82
|
+
"default" => 443
|
|
83
|
+
},
|
|
84
|
+
"host" => {
|
|
85
|
+
"type" => "string",
|
|
86
|
+
"default" => "\#{host}"
|
|
87
|
+
},
|
|
88
|
+
"path" => {
|
|
89
|
+
"type" => "string",
|
|
90
|
+
"default" => "/\#{path}"
|
|
91
|
+
},
|
|
92
|
+
"query" => {
|
|
93
|
+
"type" => "string",
|
|
94
|
+
"default" => "\#{query}"
|
|
95
|
+
},
|
|
96
|
+
"status_code" => {
|
|
97
|
+
"type" => "integer",
|
|
98
|
+
"description" => "The HTTP status code when issuing a redirect",
|
|
99
|
+
"default" => 301,
|
|
100
|
+
"enum" => [301, 302]
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
end
|
|
105
|
+
|
|
67
106
|
# Base configuration schema for a LoadBalancer
|
|
68
107
|
# @return [Hash]
|
|
69
108
|
def self.schema
|
|
@@ -261,7 +300,7 @@ module MU
|
|
|
261
300
|
"type" => "array",
|
|
262
301
|
"items" => {
|
|
263
302
|
"type" => "object",
|
|
264
|
-
"required" => ["lb_protocol", "lb_port"
|
|
303
|
+
"required" => ["lb_protocol", "lb_port"],
|
|
265
304
|
"additionalProperties" => false,
|
|
266
305
|
"description" => "A list of port/protocols which this Load Balancer should answer.",
|
|
267
306
|
"properties" => {
|
|
@@ -279,6 +318,7 @@ module MU
|
|
|
279
318
|
"enum" => ["HTTP", "HTTPS", "TCP", "SSL", "UDP"],
|
|
280
319
|
"description" => "Specifies the load balancer transport protocol to use for routing - HTTP, HTTPS, TCP, SSL, or UDP. SSL and UDP are only valid in Google Cloud."
|
|
281
320
|
},
|
|
321
|
+
"redirect" => MU::Config::LoadBalancer.redirect,
|
|
282
322
|
"targetgroup" => {
|
|
283
323
|
"type" => "string",
|
|
284
324
|
"description" => "Which of our declared targetgroups should be the back-end for this listener's traffic"
|
|
@@ -309,14 +349,14 @@ module MU
|
|
|
309
349
|
"items" => {
|
|
310
350
|
"type" => "object",
|
|
311
351
|
"description" => "Rules to route requests to different target groups based on the request path",
|
|
312
|
-
"required" => ["
|
|
352
|
+
"required" => ["order", "conditions"],
|
|
313
353
|
"additionalProperties" => false,
|
|
314
354
|
"properties" => {
|
|
315
355
|
"conditions" => {
|
|
316
356
|
"type" => "array",
|
|
317
357
|
"items" => {
|
|
318
358
|
"type" => "object",
|
|
319
|
-
"description" => "Rule
|
|
359
|
+
"description" => "Rule conditionl; if none are specified (or if none match) the default action will be set.",
|
|
320
360
|
"required" => ["field", "values"],
|
|
321
361
|
"additionalProperties" => false,
|
|
322
362
|
"properties" => {
|
|
@@ -339,16 +379,17 @@ module MU
|
|
|
339
379
|
"type" => "array",
|
|
340
380
|
"items" => {
|
|
341
381
|
"type" => "object",
|
|
342
|
-
"description" => "Rule action",
|
|
343
|
-
"required" => ["action"
|
|
382
|
+
"description" => "Rule action, which must specify one of +targetgroup+ or +redirect+",
|
|
383
|
+
"required" => ["action"],
|
|
344
384
|
"additionalProperties" => false,
|
|
345
385
|
"properties" => {
|
|
346
386
|
"action" => {
|
|
347
387
|
"type" => "string",
|
|
348
388
|
"default" => "forward",
|
|
349
389
|
"description" => "An action to take when a match occurs. Currently, only forwarding to a targetgroup is supported.",
|
|
350
|
-
"enum" => ["forward"]
|
|
390
|
+
"enum" => ["forward", "redirect"]
|
|
351
391
|
},
|
|
392
|
+
"redirect" => MU::Config::LoadBalancer.redirect,
|
|
352
393
|
"targetgroup" => {
|
|
353
394
|
"type" => "string",
|
|
354
395
|
"description" => "Which of our declared targetgroups should be the recipient of this traffic. If left unspecified, will default to the default targetgroup of this listener."
|
|
@@ -405,13 +446,18 @@ module MU
|
|
|
405
446
|
"proto" => l["instance_protocol"],
|
|
406
447
|
"port" => l["instance_port"]
|
|
407
448
|
}
|
|
408
|
-
if
|
|
409
|
-
|
|
410
|
-
tg["
|
|
449
|
+
if l["redirect"]
|
|
450
|
+
tg["proto"] ||= l["redirect"]["protocol"]
|
|
451
|
+
tg["port"] ||= l["redirect"]["port"]
|
|
452
|
+
end
|
|
453
|
+
l['healthcheck'] ||= lb['healthcheck'] if lb['healthcheck']
|
|
454
|
+
if l["healthcheck"]
|
|
455
|
+
hc_target = l['healthcheck']['target'].match(/^([^:]+):(\d+)(.*)/)
|
|
456
|
+
tg["healthcheck"] = l['healthcheck'].dup
|
|
411
457
|
proto = ["HTTP", "HTTPS"].include?(hc_target[1]) ? hc_target[1] : l["instance_protocol"]
|
|
412
458
|
tg['healthcheck']['target'] = "#{proto}:#{hc_target[2]}#{hc_target[3]}"
|
|
413
459
|
tg['healthcheck']["httpcode"] = "200,301,302"
|
|
414
|
-
MU.log "Converting classic-style ELB health check target #{
|
|
460
|
+
MU.log "Converting classic-style ELB health check target #{l['healthcheck']['target']} to ALB style for target group #{tgname} (#{l["instance_protocol"]}:#{l["instance_port"]}).", details: tg['healthcheck']
|
|
415
461
|
end
|
|
416
462
|
lb["targetgroups"] << tg
|
|
417
463
|
}
|
data/modules/mu/config/log.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/*/log.rb
|
|
18
18
|
class Log
|
|
19
19
|
|
|
20
20
|
# Base configuration schema for a Log
|