Skip to content

Commit

Permalink
Unify handling of sysconfig path
Browse files Browse the repository at this point in the history
  • Loading branch information
ananace committed Sep 25, 2024
1 parent 5a5a083 commit 3a054e6
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 19 deletions.
3 changes: 1 addition & 2 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
---
k8s::sysconfig_path: '/etc/sysconfig'
--- {}
4 changes: 2 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# @param role the role of the node
# @param runc_version version of runc to install
# @param service_cluster_cidr CIDR for the service network
# @param sysconfig_path path to the sysconfig directory
# @param sysconfig_path path to the sysconfig directory, per-OS values are configured in hiera
# @param tarball_url_template template for tarball packaging
# @param uid user id for kubernetes files and services
# @param user username for kubernetes files and services
Expand Down Expand Up @@ -82,7 +82,7 @@
String[1] $tarball_url_template = 'https://dl.k8s.io/release/v%{version}/kubernetes-%{component}-%{kernel}-%{arch}.tar.gz',
String[1] $package_template = 'kubernetes-%{component}',
String[1] $hyperkube_name = 'hyperkube',
Optional[Stdlib::Unixpath] $sysconfig_path = undef,
Stdlib::Unixpath $sysconfig_path = '/etc/sysconfig',

K8s::Node_auth $node_auth = 'bootstrap',

Expand Down
5 changes: 2 additions & 3 deletions manifests/node/kube_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@

if $k8s::packaging == 'container' {
} else {
$_sysconfig_path = pick($k8s::sysconfig_path, '/etc/sysconfig')
file { "${_sysconfig_path}/kube-proxy":
file { "${k8s::sysconfig_path}/kube-proxy":
ensure => $_ensure,
content => epp('k8s/sysconfig.epp', {
comment => 'Kubernetes kube-proxy configuration',
Expand All @@ -122,7 +121,7 @@
bin => 'kube-proxy',
}),
require => [
File["${_sysconfig_path}/kube-proxy"],
File["${k8s::sysconfig_path}/kube-proxy"],
User[$k8s::user],
],
notify => Service['kube-proxy'],
Expand Down
5 changes: 2 additions & 3 deletions manifests/node/kubelet.pp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@
node_ip => $_node_ip,
} + $arguments)

$_sysconfig_path = pick($k8s::sysconfig_path, '/etc/sysconfig')
file { "${_sysconfig_path}/kubelet":
file { "${k8s::sysconfig_path}/kubelet":
content => epp('k8s/sysconfig.epp', {
comment => 'Kubernetes Kubelet configuration',
environment_variables => {
Expand All @@ -252,7 +251,7 @@
bin => 'kubelet',
}),
require => [
File["${_sysconfig_path}/kubelet", '/etc/kubernetes/kubelet.conf'],
File["${k8s::sysconfig_path}/kubelet", '/etc/kubernetes/kubelet.conf'],
User[$k8s::user],
],
notify => Service['kubelet'],
Expand Down
5 changes: 2 additions & 3 deletions manifests/server/apiserver.pp
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,7 @@
}
# TODO: Create a dummy kube-apiserver service that just requires kubelet
} else {
$_sysconfig_path = pick($k8s::sysconfig_path, '/etc/sysconfig')
file { "${_sysconfig_path}/kube-apiserver":
file { "${k8s::sysconfig_path}/kube-apiserver":
content => epp('k8s/sysconfig.epp', {
comment => 'Kubernetes API Server configuration',
environment_variables => {
Expand All @@ -287,7 +286,7 @@
group => $k8s::group,
}),
require => [
File["${_sysconfig_path}/kube-apiserver"],
File["${k8s::sysconfig_path}/kube-apiserver"],
User[$k8s::user],
],
notify => Service['kube-apiserver'],
Expand Down
5 changes: 2 additions & 3 deletions manifests/server/controller_manager.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@
client_key => $key,
}

$_sysconfig_path = pick($k8s::sysconfig_path, '/etc/sysconfig')
file { "${_sysconfig_path}/kube-controller-manager":
file { "${k8s::sysconfig_path}/kube-controller-manager":
content => epp('k8s/sysconfig.epp', {
comment => 'Kubernetes Controller Manager configuration',
environment_variables => {
Expand All @@ -115,7 +114,7 @@
group => $k8s::group,
}),
require => [
File["${_sysconfig_path}/kube-controller-manager"],
File["${k8s::sysconfig_path}/kube-controller-manager"],
User[$k8s::user],
],
notify => Service['kube-controller-manager'],
Expand Down
5 changes: 2 additions & 3 deletions manifests/server/scheduler.pp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@
client_cert => $cert,
client_key => $key,
}
$_sysconfig_path = pick($k8s::sysconfig_path, '/etc/sysconfig')
file { "${_sysconfig_path}/kube-scheduler":
file { "${k8s::sysconfig_path}/kube-scheduler":
content => epp('k8s/sysconfig.epp', {
comment => 'Kubernetes Scheduler configuration',
environment_variables => {
Expand All @@ -93,7 +92,7 @@
group => $k8s::group,
}),
require => [
File["${_sysconfig_path}/kube-scheduler"],
File["${k8s::sysconfig_path}/kube-scheduler"],
User[$k8s::user],
],
notify => Service['kube-scheduler'],
Expand Down

0 comments on commit 3a054e6

Please sign in to comment.