Puppet Class: profile::toolforge::docker::image_builder

Defined in:
modules/profile/manifests/toolforge/docker/image_builder.pp

Overview

Parameters:

  • docker_username (String) (defaults to: lookup('docker::username'))
  • docker_password (String) (defaults to: lookup('docker::password'))
  • docker_registry (Stdlib::Fqdn) (defaults to: lookup('docker::registry'))
  • component (String) (defaults to: lookup('profile::wmcs::kubeadm::component', {default_value => 'thirdparty/kubeadm-k8s-1-15'}))


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
# File 'modules/profile/manifests/toolforge/docker/image_builder.pp', line 1

class profile::toolforge::docker::image_builder(
    String       $docker_username = lookup('docker::username'),
    String       $docker_password = lookup('docker::password'),
    Stdlib::Fqdn $docker_registry = lookup('docker::registry'),
    String $component = lookup('profile::wmcs::kubeadm::component', {default_value => 'thirdparty/kubeadm-k8s-1-15'}),
) {
    # This should be building with the same docker we are running
    class { '::kubeadm::repo':
        component => $component,
    }

    labs_lvm::volume { 'docker':
        size      => '70%FREE',
        mountat   => '/var/lib/docker',
        mountmode => '711',
    } -> class {'profile::labs::lvm::srv': }

    class { '::kubeadm::docker': }

    class { '::docker::baseimages':
        docker_registry => $docker_registry,
    }

    git::clone { 'operations/docker-images/toollabs-images':
        ensure    => present,
        directory => '/srv/images/toolforge',
    }

    # Registry credentials require push privilages
    # uses strict_encode64 since encode64 adds newlines?!
    $docker_auth = inline_template("<%= require 'base64'; Base64.strict_encode64('${docker_username}:${docker_password}') -%>")

    $docker_config = {
        'auths' => {
            "${docker_registry}" => {
                'auth' => $docker_auth,
            },
        },
    }

    file { '/root/.docker':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0550',
    }

    file { '/root/.docker/config.json':
        content => ordered_json($docker_config),
        owner   => 'root',
        group   => 'docker',
        mode    => '0440',
        require => File['/root/.docker'],
    }
}