Puppet Class: calico::cni

Defined in:
modules/calico/manifests/cni.pp

Overview

Parameters:

  • master_fqdn (Stdlib::Host)
  • calico_cni_username (String)
  • calico_cni_token (String)


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
# File 'modules/calico/manifests/cni.pp', line 5

class calico::cni(
    Stdlib::Host  $master_fqdn,
    String        $calico_cni_username,
    String        $calico_cni_token,
) {
    require ::calico

    file { ['/etc/cni', '/etc/cni/net.d']:
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    case $::calico::calico_version {
        '3': {
            # Generate a dedicated kubeconfig for the cni plugin to use
            $kubeconfig = '/etc/cni/net.d/calico-kubeconfig'
            k8s::kubeconfig { $kubeconfig:
                master_host => $master_fqdn,
                username    => $calico_cni_username,
                token       => $calico_cni_token,
            }

            file { '/etc/cni/net.d/10-calico.conflist':
                content => template('calico/cni.conf_v3.erb'),
                owner   => 'root',
                group   => 'root',
                mode    => '0755',
            }
        }
        default: { fail('Unsupported calico version') }
    }

}