@@ -11,6 +11,7 @@ import (
1111 "text/template"
1212
1313 kubeadmconstants "k8s.io/kubernetes/cmd/kubeadm/app/constants"
14+ kubeletconfigv1beta1 "k8s.io/kubernetes/pkg/kubelet/apis/kubeletconfig/v1beta1"
1415
1516 "github.com/platform9/nodeadm/apis"
1617 "github.com/platform9/nodeadm/constants"
@@ -21,14 +22,16 @@ import (
2122
2223func InstallMasterComponents (config * apis.InitConfiguration ) {
2324 PopulateCache ()
24-
25+ placeKubeComponents ()
26+ placeCNIPlugin ()
2527 if err := systemd .StopIfActive ("kubelet.service" ); err != nil {
2628 log .Fatalf ("Failed to install kubelet service: %v" , err )
2729 }
2830 if err := systemd .DisableIfEnabled ("kubelet.service" ); err != nil {
2931 log .Fatalf ("Failed to install kubelet service: %v" , err )
3032 }
31- PlaceComponentsFromCache (config .Networking )
33+ placeKubeletSystemAndDropinFiles (config .Networking , config .Kubelet )
34+ placeNetworkConfig ()
3235 if err := systemd .Enable ("kubelet.service" ); err != nil {
3336 log .Fatalf ("Failed to install kubelet service: %v" , err )
3437 }
@@ -49,19 +52,20 @@ func InstallMasterComponents(config *apis.InitConfiguration) {
4952 if err := systemd .Start ("keepalived.service" ); err != nil {
5053 log .Fatalf ("Failed to install keepalived service: %v" , err )
5154 }
52-
5355}
5456
5557func InstallNodeComponents (config * apis.JoinConfiguration ) {
5658 PopulateCache ()
57-
59+ placeKubeComponents ()
60+ placeCNIPlugin ()
5861 if err := systemd .StopIfActive ("kubelet.service" ); err != nil {
5962 log .Fatalf ("Failed to install kubelet service: %v" , err )
6063 }
6164 if err := systemd .DisableIfEnabled ("kubelet.service" ); err != nil {
6265 log .Fatalf ("Failed to install kubelet service: %v" , err )
6366 }
64- PlaceComponentsFromCache (config .Networking )
67+ placeKubeletSystemAndDropinFiles (config .Networking , config .Kubelet )
68+ placeNetworkConfig ()
6569 if err := systemd .Enable ("kubelet.service" ); err != nil {
6670 log .Fatalf ("Failed to install kubelet service: %v" , err )
6771 }
@@ -70,13 +74,10 @@ func InstallNodeComponents(config *apis.JoinConfiguration) {
7074 }
7175}
7276
73- func PlaceComponentsFromCache (netConfig apis.Networking ) {
74- placeKubeComponents ()
75- placeCNIPlugin ()
77+ func placeKubeletSystemAndDropinFiles (netConfig apis.Networking , kubeletConfig * kubeletconfigv1beta1.KubeletConfiguration ) {
7678 placeAndModifyKubeletServiceFile ()
77- placeAndModifyKubeadmKubeletSystemdDropin (netConfig )
78- placeAndModifyNodeadmKubeletSystemdDropin (netConfig )
79- placeNetworkConfig ()
79+ placeAndModifyKubeadmKubeletSystemdDropin ()
80+ placeAndModifyNodeadmKubeletSystemdDropin (netConfig , kubeletConfig )
8081}
8182
8283func placeAndModifyKubeletServiceFile () {
@@ -85,7 +86,7 @@ func placeAndModifyKubeletServiceFile() {
8586 ReplaceString (serviceFile , "/usr/bin" , constants .BaseInstallDir )
8687}
8788
88- func placeAndModifyKubeadmKubeletSystemdDropin (netConfig apis. Networking ) {
89+ func placeAndModifyKubeadmKubeletSystemdDropin () {
8990 err := os .MkdirAll (filepath .Join (constants .SystemdDir , "kubelet.service.d" ), constants .Execute )
9091 if err != nil {
9192 log .Fatalf ("Failed to create dir with error %v\n " , err )
@@ -95,7 +96,7 @@ func placeAndModifyKubeadmKubeletSystemdDropin(netConfig apis.Networking) {
9596 ReplaceString (confFile , "/usr/bin" , constants .BaseInstallDir )
9697}
9798
98- func placeAndModifyNodeadmKubeletSystemdDropin (netConfig apis.Networking ) {
99+ func placeAndModifyNodeadmKubeletSystemdDropin (netConfig apis.Networking , kubeletConfig * kubeletconfigv1beta1. KubeletConfiguration ) {
99100 err := os .MkdirAll (filepath .Join (constants .SystemdDir , "kubelet.service.d" ), constants .Execute )
100101 if err != nil {
101102 log .Fatalf ("Failed to create dir with error %v\n " , err )
@@ -114,22 +115,22 @@ func placeAndModifyNodeadmKubeletSystemdDropin(netConfig apis.Networking) {
114115
115116 data := struct {
116117 FailSwapOn bool
117- MaxPods int
118+ MaxPods int32
118119 ClusterDNS string
119120 ClusterDomain string
120121 HostnameOverride string
121- KubeAPIQPS int
122- KubeAPIBurst int
122+ KubeAPIQPS int32
123+ KubeAPIBurst int32
123124 EvictionHard string
124125 FeatureGates string
125126 }{
126- FailSwapOn : constants . KubeletFailSwapOn ,
127- MaxPods : constants . KubeletMaxPods ,
127+ FailSwapOn : * kubeletConfig . FailSwapOn ,
128+ MaxPods : kubeletConfig . MaxPods ,
128129 ClusterDNS : dnsIP .String (),
129130 ClusterDomain : netConfig .DNSDomain ,
130131 HostnameOverride : hostnameOverride ,
131- KubeAPIQPS : constants . KubeletKubeAPIQPS ,
132- KubeAPIBurst : constants . KubeletKubeAPIBurst ,
132+ KubeAPIQPS : * kubeletConfig . KubeAPIQPS ,
133+ KubeAPIBurst : kubeletConfig . KubeAPIBurst ,
133134 EvictionHard : constants .KubeletEvictionHard ,
134135 FeatureGates : constants .FeatureGates ,
135136 }
0 commit comments