Puppet Class: k8s::scheduler

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

Overview

SPDX-License-Identifier: Apache-2.0

Class that sets up and configures kube-scheduler

Parameters:

  • version (K8s::KubernetesVersion)
  • kubeconfig (Stdlib::Unixpath)
  • tls_cert_file (Stdlib::Unixpath)
  • tls_private_key_file (Stdlib::Unixpath)
  • v_log_level (Integer) (defaults to: 0)


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

class k8s::scheduler (
    K8s::KubernetesVersion $version,
    Stdlib::Unixpath $kubeconfig,
    Stdlib::Unixpath $tls_cert_file,
    Stdlib::Unixpath $tls_private_key_file,
    Integer $v_log_level = 0,
) {
    k8s::package { 'scheduler':
        package => 'master',
        version => $version,
    }

    # Create the KubeSchedulerConfiguration YAML
    $config_yaml = {
        apiVersion         => 'kubescheduler.config.k8s.io/v1beta3',
        kind               => 'KubeSchedulerConfiguration',
        clientConnection   => { kubeconfig => $kubeconfig },
    }
    $config_file = '/etc/kubernetes/kube-scheduler-config.yaml'
    file { $config_file:
        ensure  => file,
        owner   => 'kube',
        group   => 'kube',
        mode    => '0400',
        content => $config_yaml.filter |$k, $v| { $v =~ NotUndef and !$v.empty }.to_yaml,
        notify  => Service['kube-scheduler'],
        require => K8s::Package['scheduler'],
    }

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

    service { 'kube-scheduler':
        ensure    => running,
        enable    => true,
        subscribe => [
            File[$kubeconfig],
        ],
    }
}