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)
  • auth_cert (Hash[String, Stdlib::Unixpath])
  • calico_version (Calico::CalicoVersion)


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,
    Hash[String, Stdlib::Unixpath] $auth_cert,
    Calico::CalicoVersion          $calico_version,
) {
    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,
        auth_cert   => $auth_cert,
    }

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