Puppet Class: k8s::install::crictl

Defined in:
manifests/install/crictl.pp

Summary

installs the crictl debugging tool

Overview

Class: k8s::install::crictl

Parameters:

  • ensure (K8s::Ensure) (defaults to: $k8s::ensure)

    set ensure for installation or deinstallation

  • version (String[1]) (defaults to: 'v1.26.0')

    the k8s version

  • arch (String[1]) (defaults to: 'amd64')

    os architecture

  • config (Hash) (defaults to: {})

    config for crictl, for example: k8s::install::crictl::config:

    'runtime-endpoint': 'unix:///run/containerd/containerd.sock'
    'image-endpoint': 'unix:///run/containerd/containerd.sock'
    
  • crictl_package (Optional[String[1]]) (defaults to: $k8s::crictl_package)

    the package name of crictl

  • manage_repo (Boolean) (defaults to: $k8s::manage_repo)

    whether to manage the repo or not

  • download_url (Stdlib::HTTPUrl) (defaults to: "https://github.com/kubernetes-sigs/cri-tools/releases/download/${version}/crictl-${version}-linux-${arch}.tar.gz")

    where to download the tar.gz from



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
49
50
51
52
53
54
# File 'manifests/install/crictl.pp', line 16

class k8s::install::crictl (
  Boolean $manage_repo                = $k8s::manage_repo,
  Hash $config                        = {},
  K8s::Ensure $ensure                 = $k8s::ensure,
  Optional[String[1]] $crictl_package = $k8s::crictl_package,
  String[1] $arch                     = 'amd64',
  String[1] $version                  = 'v1.26.0',
  Stdlib::HTTPUrl $download_url       = "https://github.com/kubernetes-sigs/cri-tools/releases/download/${version}/crictl-${version}-linux-${arch}.tar.gz",
) {
  if $manage_repo {
    $pkg = pick($crictl_package, 'cri-tools')

    package { $pkg:
      ensure => stdlib::ensure($ensure, 'package'),
    }

    Class['k8s::repo'] -> Package[$pkg]

    $config_require = Package[$pkg]
  } else {
    archive { 'crictl':
      ensure       => $ensure,
      path         => "/tmp/crictl-${version}-linux-${arch}.tar.gz",
      source       => $download_url,
      extract      => true,
      extract_path => '/usr/local/bin',
      creates      => '/usr/local/bin/crictl',
      cleanup      => true,
    }

    $config_require = Archive['crictl']
  }

  file { '/etc/crictl.yaml':
    ensure  => $k8s::ensure,
    content => $config.to_yaml,
    require => $config_require,
  }
}