- manage rke2 repos - add rke2 module (init, params, install, config, service) - split roles::infra::k8s::node -> control/compute roles - moved common k8s config into k8s.yaml - add bootstrap_node, manage server and token fields in rke2 config - manage install of helm - manage node attributes (from puppet facts) - manage frr exclusions for service/cluster network Reviewed-on: #394
45 lines
1.2 KiB
Puppet
45 lines
1.2 KiB
Puppet
|
|
# manage helm
|
|
class rke2::helm (
|
|
Enum['server', 'agent'] $node_type = $rke2::node_type,
|
|
Stdlib::Fqdn $bootstrap_node = $rke2::bootstrap_node,
|
|
Boolean $helm_install = $rke2::helm_install,
|
|
Hash $helm_repos = $rke2::helm_repos
|
|
){
|
|
|
|
# when installing helm, manage the repos
|
|
if $helm_install {
|
|
|
|
package {'helm':
|
|
ensure => installed,
|
|
}
|
|
|
|
file { '/etc/helm':
|
|
ensure => directory,
|
|
owner => 'root',
|
|
group => 'root',
|
|
mode => '0755',
|
|
}
|
|
|
|
# on the controller nodes only
|
|
if $node_type == 'server' {
|
|
|
|
# check if the repo already exists
|
|
$helm_repos.each | String $repo, Stdlib::HTTPSUrl $url | {
|
|
|
|
# if repo isnt in repo list from helm, install it
|
|
if ! $facts['helm_repos'].any |$existing| { $existing['name'] == $repo } {
|
|
|
|
exec { "helm_add_repo_${repo}":
|
|
command => "helm repo add ${repo} ${url} --repository-config /etc/helm/repositories.yaml",
|
|
path => ['/usr/bin'],
|
|
environment => [
|
|
'KUBECONFIG=/etc/rancher/rke2/rke2.yaml',
|
|
],
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|