feat: adding rke2 (#394)
- 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
This commit was merged in pull request #394.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'facter/util/helm'
|
||||
|
||||
Facter.add(:helm_repos) do
|
||||
confine kernel: 'Linux'
|
||||
confine enc_role: [
|
||||
'roles::infra::k8s::control',
|
||||
'roles::infra::k8s::compute'
|
||||
]
|
||||
|
||||
setcode do
|
||||
Facter::Util::Helm.get_helm_repos('/usr/bin/helm')
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'facter'
|
||||
require 'json'
|
||||
|
||||
# a simple helm module
|
||||
module Facter::Util::Helm
|
||||
def self.get_helm_repos(helm_cmd)
|
||||
return [] unless File.executable?(helm_cmd)
|
||||
|
||||
output = Facter::Core::Execution.execute(
|
||||
"#{helm_cmd} repo list --output json --repository-config /etc/helm/repositories.yaml",
|
||||
on_fail: nil
|
||||
)
|
||||
return [] if output.to_s.strip.empty?
|
||||
|
||||
parse_helm_output(output)
|
||||
rescue StandardError => e
|
||||
Facter.debug("helm_repos fact error: #{e}")
|
||||
[]
|
||||
end
|
||||
|
||||
def self.parse_helm_output(output)
|
||||
JSON.parse(output).map do |repo|
|
||||
{
|
||||
'name' => repo['name'],
|
||||
'url' => repo['url']
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user