21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/kontena/cli/apps/yaml/validations.rb', line 21
def common_validations
{
'image' => optional('string'), 'extends' => optional('valid_extends'),
'stateful' => optional('boolean'),
'affinity' => optional('valid_affinities'),
'cap_add' => optional('array'),
'cap_drop' => optional('array'),
'command' => optional('string'),
'cpu_shares' => optional('integer'),
'external_links' => optional('array'),
'mem_limit' => optional('string'),
'mem_swaplimit' => optional('string'),
'environment' => optional(-> (value) { value.is_a?(Array) || value.is_a?(Hash) }),
'env_file' => optional(-> (value) { value.is_a?(String) || value.is_a?(Array) }),
'instances' => optional('integer'),
'links' => optional(-> (value) { value.is_a?(Array) || value.nil? }),
'ports' => optional('array'),
'pid' => optional('string'),
'privileged' => optional('boolean'),
'user' => optional('string'),
'volumes' => optional('array'),
'volumes_from' => optional('array'),
'secrets' => optional('valid_secrets'),
'hooks' => optional('valid_hooks'),
'deploy' => optional({
'strategy' => optional(%w(ha daemon random)),
'wait_for_port' => optional('integer'),
'min_health' => optional('float'),
'interval' => optional(/^\d+(min|h|d|)$/)
}),
'health_check' => optional({
'protocol' => /^(http|tcp)$/,
'port' => 'integer',
'uri' => optional(/\/[\S]*/),
'timeout' => optional('integer'),
'interval' => optional('integer'),
'initial_delay' => optional('integer')
})
}
end
|