File tree 7 files changed +46
-15
lines changed
kubernetes/bootstrap/etcd 7 files changed +46
-15
lines changed Original file line number Diff line number Diff line change 54
54
notify => Exec[" kubelet reload daemon" ],
55
55
}
56
56
57
+ file { "/etc/kubernetes/kubelet.yaml" :
58
+ content => template (" nebula/profile/kubelet/config.yaml.erb" ),
59
+ require => Package[" kubelet" ],
60
+ notify => Service[" kubelet" ],
61
+ }
62
+
57
63
exec { 'kubelet reload daemon' :
58
64
command => " /bin/systemctl daemon-reload" ,
59
65
refreshonly => true ,
Original file line number Diff line number Diff line change 17
17
notify => Exec[' kubelet reload daemon' ],
18
18
}
19
19
20
+ $pod_manifest_path = " /etc/kubernetes/manifests"
21
+ file { "/etc/kubernetes/kubelet.yaml" :
22
+ content => template (" nebula/profile/kubelet/config.yaml.erb" ),
23
+ require => Package[" kubelet" ],
24
+ notify => Service[" kubelet" ],
25
+ }
26
+
20
27
file { '/etc/systemd/system/kubelet.service.d' :
21
28
ensure => ' directory' ,
22
29
}
Original file line number Diff line number Diff line change 105
105
106
106
it do
107
107
is_expected . to contain_file ( "/etc/systemd/system/kubelet.service.d/20-containerd-and-manifest-dir.conf" )
108
- . with_content ( /^ExecStart=\/ usr\/ bin\/ kubelet/ )
108
+ . with_content ( /^ExecStart=\/ usr\/ bin\/ kubelet --config= \/ etc \/ kubernetes \/ kubelet \. yaml$ / )
109
109
end
110
110
111
- [ "--address=127.0.0.1" ,
112
- "--pod-manifest-path=/etc/kubernetes/manifests" ,
113
- "--container-runtime=remote" ,
114
- "--container-runtime-endpoint=unix:///run/containerd/containerd.sock" ,
115
- "--cgroup-driver=systemd" ] . each do |param |
116
- it do
117
- is_expected . to contain_file ( "/etc/systemd/system/kubelet.service.d/20-containerd-and-manifest-dir.conf" )
118
- . with_content ( /^ExecStart=.+ #{ param } / )
119
- end
111
+ it do
112
+ is_expected . to contain_file ( "/etc/kubernetes/kubelet.yaml" )
113
+ . with_content ( /address:.*127.0.0.1/ )
114
+ . with_content ( /staticPodPath:.*\/ etc\/ kubernetes\/ manifests/ )
115
+ . with_content ( /cgroupDriver:.*systemd/ )
116
+ . with_content ( /containerRuntimeEndpoint:.*unix:\/ \/ \/ run\/ containerd\/ containerd.sock/ )
120
117
end
121
118
122
119
context "with pod_manifest_path set to /tmp/kubelet" do
126
123
it { is_expected . to contain_file ( "/tmp/kubelet" ) }
127
124
128
125
it do
129
- is_expected . to contain_file ( "/etc/systemd/system/ kubelet.service.d/20-containerd-and-manifest-dir.conf " )
130
- . with_content ( /^ExecStart=.+ --pod-manifest-path= \/ tmp\/ kubelet/ )
126
+ is_expected . to contain_file ( "/etc/kubernetes/ kubelet.yaml " )
127
+ . with_content ( /staticPodPath:.* \/ tmp\/ kubelet/ )
131
128
end
132
129
end
133
130
Original file line number Diff line number Diff line change 15
15
16
16
it do
17
17
is_expected . to contain_file ( '/etc/systemd/system/kubelet.service.d/20-etcd-service-manager.conf' )
18
- . with_content ( %r{^ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path= /etc/kubernetes/manifests --cgroup-driver=systemd --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock $} )
18
+ . with_content ( %r{^ExecStart=/usr/bin/kubelet --config= /etc/kubernetes/kubelet \. yaml $} )
19
19
. that_notifies ( 'Exec[kubelet reload daemon]' )
20
20
. that_requires ( 'Package[kubelet]' )
21
21
. that_requires ( 'File[/etc/systemd/system/kubelet.service.d]' )
22
22
end
23
23
24
+ it do
25
+ is_expected . to contain_file ( "/etc/kubernetes/kubelet.yaml" )
26
+ . with_content ( /address:.*127.0.0.1/ )
27
+ . with_content ( /staticPodPath:.*\/ etc\/ kubernetes\/ manifests/ )
28
+ . with_content ( /cgroupDriver:.*systemd/ )
29
+ . with_content ( /containerRuntimeEndpoint:.*unix:\/ \/ \/ run\/ containerd\/ containerd.sock/ )
30
+ end
31
+
24
32
it { is_expected . to contain_file ( '/etc/systemd/system/kubelet.service.d' ) . with_ensure ( 'directory' ) }
25
33
26
34
it do
Original file line number Diff line number Diff line change
1
+ apiVersion: "kubelet.config.k8s.io/v1beta1"
2
+ kind: "KubeletConfiguration"
3
+ address: "127.0.0.1"
4
+ staticPodPath: "<%= @pod_manifest_path %> "
5
+ cgroupDriver: "systemd"
6
+ containerRuntimeEndpoint: "unix:///run/containerd/containerd.sock"
7
+ authentication:
8
+ anonymous:
9
+ enabled: true
10
+ webhook:
11
+ enabled: false
12
+ authorization:
13
+ mode: "AlwaysAllow"
Original file line number Diff line number Diff line change 1
1
# Managed by puppet (nebula/profile/kubelet/systemd.conf.erb)
2
2
[Service]
3
3
ExecStart=
4
- ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path= <%= @pod_manifest_path %> --cgroup-driver=systemd --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock
4
+ ExecStart=/usr/bin/kubelet --config=/etc/kubernetes/kubelet.yaml
5
5
Restart=always
Original file line number Diff line number Diff line change 1
1
# Managed by puppet (nebula/profile/kubernetes/bootstrap/etcd/systemd.conf.erb)
2
2
[Service]
3
3
ExecStart=
4
- ExecStart=/usr/bin/kubelet --address=127.0.0.1 --pod-manifest-path= /etc/kubernetes/manifests --cgroup-driver=systemd --container-runtime=remote --container-runtime-endpoint=unix:///run/containerd/containerd.sock
4
+ ExecStart=/usr/bin/kubelet --config= /etc/kubernetes/kubelet.yaml
5
5
Restart=always
You can’t perform that action at this time.
0 commit comments