Puppet Class: k8s::proxy

Defined in:
modules/k8s/manifests/proxy.pp

Overview

Class that sets up and configures kube-proxy

Parameters:

  • kubeconfig (String)
  • masquerade_all (Boolean)
  • proxy_mode (String) (defaults to: 'iptables')
  • logtostderr (Boolean) (defaults to: true)
  • v_log_level (Integer) (defaults to: 0)
  • packages_from_future (Boolean) (defaults to: false)
  • metrics_bind_address (Optional[String]) (defaults to: undef)
  • cluster_cidr (Optional[K8s::ClusterCIDR]) (defaults to: undef)


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
# File 'modules/k8s/manifests/proxy.pp', line 2

class k8s::proxy(
    String $kubeconfig,
    Boolean $masquerade_all,
    String $proxy_mode = 'iptables',
    Boolean $logtostderr = true,
    Integer $v_log_level = 0,
    Boolean $packages_from_future = false,
    Optional[String] $metrics_bind_address = undef,
    Optional[K8s::ClusterCIDR] $cluster_cidr = undef,
) {
    if $packages_from_future {
        if debian::codename::le('buster'){
            apt::package_from_component { 'proxy-kubernetes-future':
                component => 'component/kubernetes-future',
                packages  => ['kubernetes-node'],
            }
        } else {
            apt::package_from_component { 'proxy-kubernetes116':
                component => 'component/kubernetes116',
                packages  => ['kubernetes-node'],
            }
        }
    } else {
        ensure_packages('kubernetes-node')
    }

    file { '/etc/default/kube-proxy':
        ensure  => file,
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
        content => template('k8s/kube-proxy.default.erb'),
        notify  => Service['kube-proxy'],
    }

    service { 'kube-proxy':
        ensure    => running,
        enable    => true,
        subscribe => [
            File[$kubeconfig],
            File['/etc/default/kube-proxy'],
        ],

    }
}