Defined Type: k8s::kubeconfig

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

Overview

Parameters:

  • master_host (Stdlib::Fqdn)
  • username (String)
  • token (Optional[String]) (defaults to: undef)
  • auth_cert (Optional[Hash[String, Stdlib::Unixpath]]) (defaults to: undef)
  • owner (String) (defaults to: 'root')
  • group (String) (defaults to: 'root')
  • mode (Stdlib::Filemode) (defaults to: '0400')
  • namespace (Optional[String]) (defaults to: undef)
  • ensure (Wmflib::Ensure) (defaults to: present)


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

define k8s::kubeconfig (
    # TODO: This should actually consume master_url instead of master_host
    Stdlib::Fqdn $master_host,
    String $username,
    Optional[String] $token = undef,
    Optional[Hash[String, Stdlib::Unixpath]] $auth_cert = undef,
    String $owner = 'root',
    String $group = 'root',
    Stdlib::Filemode $mode = '0400',
    Optional[String] $namespace = undef,
    Wmflib::Ensure $ensure = present,
) {
    if $token == undef and $auth_cert == undef {
        fail('either token or auth_cert is required')
    } elsif $token != undef and $auth_cert != undef {
        fail('token and auth_cert are mutually exclusive parameters')
    }

    require k8s::base_dirs
    file { $title:
        ensure  => $ensure,
        content => template('k8s/kubeconfig-client.yaml.erb'),
        owner   => $owner,
        group   => $group,
        mode    => $mode,
    }
}