Defined Type: docker_registry::instance
- Defined in:
- modules/docker_registry/manifests/instance.pp
Overview
SPDX-License-Identifier: Apache-2.0 Puppet define allowing to set up a specific instance of the docker registry. Can be re-used to setup more than 1 running on a host https://distribution.github.io/distribution/about/configuration/#list-of-configuration-options prevent against tampering
17 18 19 20 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'modules/docker_registry/manifests/instance.pp', line 17
define docker_registry::instance (
Hash $backend_config,
Docker_registry::Redisconfig $redis_config,
String $registry_shared_secret,
Integer $catalog_maxentries,
Integer $port=5000,
Integer $debug_port=5001,
Boolean $redirect_backend=false,
String $log_level='info',
){
$storage_config = {
'storage' => {
's3' => $backend_config,
'redirect' => {
'disable' => !$redirect_backend,
}
}
}
# Read the basic configuration from a YAML file, merge in the parameters, spit it out as YAML file
# Why? Cause carrying the configuration in a Puppet hash, while feasible is less readable. And messing with YAML in
# ERB is most definitely not fun
$module_path = get_module_path($module_name)
$base_config = loadyaml("${module_path}/files/base-config.yaml")
$overrides = {
'log' => {
'level' => $log_level,
},
'http' => {
'addr' => ":${port}",
'secret' => $registry_shared_secret,
'debug' => {
'addr' => ":${debug_port}",
}
},
'redis' => $redis_config,
'catalog' => {
'maxentries' => $catalog_maxentries,
},
'health' => {
'tcp' => [{ 'addr' => $redis_config['addr']}],
}
}
$config = deep_merge($base_config, $overrides, $storage_config)
file { "/etc/docker/registry/config-${title}.yml":
content => stdlib::to_yaml($config),
owner => 'docker-registry',
group => 'docker-registry',
mode => '0440',
notify => Service["docker-registry-${title}"],
}
systemd::service { "docker-registry-${title}":
ensure => 'present',
content => systemd_template('registry'),
restart => true,
team => 'ServiceOps',
service_params => {
enable => true,
},
}
}
|