feat: adding rke2

- manage rke2 repos
- add rke2 module (init, params, install, config, service)
- exclude setting ips for cilium interfaces
- split roles::infra::k8s::node -> control/compute roles
This commit is contained in:
2025-09-06 23:01:57 +10:00
parent 65fb52da55
commit d0d85a4d8f
9 changed files with 325 additions and 33 deletions
+2
View File
@@ -0,0 +1,2 @@
#!/usr/bin/bash
/var/lib/rancher/rke2/bin/kubectl --kubeconfig=/etc/rancher/rke2/rke2.yaml get --raw /livez
+24
View File
@@ -0,0 +1,24 @@
# config rke2
class rke2::config (
Enum['server', 'agent'] $node_type = $rke2::node_type,
Stdlib::Absolutepath $config_file = $rke2::config_file,
Hash $config_hash = $rke2::config_hash,
){
file { $config_file:
ensure => file,
content => $config_hash.to_yaml,
owner => 'root',
group => 'root',
mode => '0644',
}
file {'/usr/local/bin/check_k8s_api.sh':
ensure => file,
owner => 'root',
group => 'root',
mode => '0755',
source => 'puppet:///modules/rke2/check_k8s_api.sh'
}
}
+13
View File
@@ -0,0 +1,13 @@
# manage rke2
class rke2 (
Enum['server', 'agent'] $node_type = $rke2::params::node_type,
Stdlib::Absolutepath $config_file = $rke2::params::config_file,
Hash $config_hash = $rke2::params::config_hash,
) inherits rke2::params {
include rke2::install
include rke2::config
include rke2::service
Class['rke2::install'] -> Class['rke2::config'] -> Class['rke2::service']
}
+10
View File
@@ -0,0 +1,10 @@
# install rke2
class rke2::install (
Enum['server', 'agent'] $node_type = $rke2::node_type,
){
package {"rke2-${node_type}":
ensure => installed,
}
}
+6
View File
@@ -0,0 +1,6 @@
# rke2 params
class rke2::params (
Enum['server', 'agent'] $node_type = 'agent',
Stdlib::Absolutepath $config_file = '/etc/rancher/rke2/config.yaml',
Hash $config_hash = {},
) {}
+13
View File
@@ -0,0 +1,13 @@
# manage rke2 service
class rke2::service (
Enum['server', 'agent'] $node_type = $rke2::node_type,
Stdlib::Absolutepath $config_file = $rke2::config_file,
){
service {"rke2-${node_type}":
ensure => true,
enable => true,
subscribe => File[$config_file],
}
}