Puppet Class: calico

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

Overview

SPDX-License-Identifier: Apache-2.0

Class calico

Installs calico-cni and calicoctl

Parameters:

  • master_fqdn (Stdlib::Host)
  • calicoctl_username (String)
  • calicoctl_token (String)
  • calico_version (Calico::CalicoVersion) (defaults to: '3.17')


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/init.pp', line 5

class calico (
    Stdlib::Host            $master_fqdn,
    String                  $calicoctl_username,
    String                  $calicoctl_token,
    Calico::CalicoVersion   $calico_version     = '3.17',
) {
    file { '/etc/calico':
        ensure => directory,
        owner  => 'root',
        group  => 'root',
        mode   => '0755',
    }

    $component_title = "calico${regsubst($calico_version, '\\.', '')}"
    apt::package_from_component { $component_title:
        component => "component/${component_title}",
        packages  => ['calicoctl', 'calico-cni'],
    }

    # Create a kubeconfig for calicoctl to use.
    $kubeconfig = '/etc/calico/calicoctl-kubeconfig'
    k8s::kubeconfig { $kubeconfig:
        master_host => $master_fqdn,
        username    => $calicoctl_username,
        token       => $calicoctl_token,
    }

    file { '/etc/calico/calicoctl.cfg':
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('calico/calicoctl.cfg_v3.erb'),
    }
}