feat: make rke2 registries.yaml conditional on manage_registries (#472)

Add/Remove the registries.yaml file based on the manage_registries
boolean. We are leaving it on default=false now as the artifactapi
server was broken.

---------

Co-authored-by: Ben Vincent <ben@unkin.net>
Reviewed-on: #472
This commit was merged in pull request #472.
This commit is contained in:
2026-06-27 07:50:31 +10:00
parent e140b300bb
commit 97d21c81c5
3 changed files with 19 additions and 8 deletions
+17 -8
View File
@@ -7,6 +7,7 @@ class rke2::config (
Stdlib::Fqdn $bootstrap_node = $rke2::bootstrap_node, Stdlib::Fqdn $bootstrap_node = $rke2::bootstrap_node,
String $node_token = $rke2::node_token, String $node_token = $rke2::node_token,
Array[String[1]] $extra_config_files = $rke2::extra_config_files, Array[String[1]] $extra_config_files = $rke2::extra_config_files,
Boolean $manage_registries = $rke2::manage_registries,
){ ){
# if its not the bootstrap node, add join path to config # if its not the bootstrap node, add join path to config
@@ -28,14 +29,22 @@ class rke2::config (
$config = $config_hash $config = $config_hash
} }
file { '/etc/rancher/rke2/registries.yaml': if $manage_registries {
ensure => file, file { '/etc/rancher/rke2/registries.yaml':
owner => 'root', ensure => file,
group => 'root', owner => 'root',
mode => '0644', group => 'root',
source => 'puppet:///modules/rke2/registries.yaml', mode => '0644',
require => Package["rke2-${node_type}"], source => 'puppet:///modules/rke2/registries.yaml',
notify => Service["rke2-${node_type}"], require => Package["rke2-${node_type}"],
notify => Service["rke2-${node_type}"],
}
}else{
file { '/etc/rancher/rke2/registries.yaml':
ensure => absent,
require => Package["rke2-${node_type}"],
notify => Service["rke2-${node_type}"],
}
} }
# create the config file # create the config file
+1
View File
@@ -12,6 +12,7 @@ class rke2 (
Hash $helm_repos = $rke2::params::helm_repos, Hash $helm_repos = $rke2::params::helm_repos,
Array[String[1]] $extra_config_files = $rke2::params::extra_config_files, Array[String[1]] $extra_config_files = $rke2::params::extra_config_files,
Stdlib::HTTPUrl $container_archive_source = $rke2::params::container_archive_source, Stdlib::HTTPUrl $container_archive_source = $rke2::params::container_archive_source,
Boolean $manage_registries = $rke2::params::manage_registries,
) inherits rke2::params { ) inherits rke2::params {
include rke2::install include rke2::install
+1
View File
@@ -12,4 +12,5 @@ class rke2::params (
Hash $helm_repos = {}, Hash $helm_repos = {},
Array[String[1]] $extra_config_files = [], Array[String[1]] $extra_config_files = [],
Stdlib::HTTPUrl $container_archive_source = 'https://github.com/rancher/rke2/releases/download', Stdlib::HTTPUrl $container_archive_source = 'https://github.com/rancher/rke2/releases/download',
Boolean $manage_registries = false,
) {} ) {}