@@ -27,8 +27,6 @@ import (
27
27
kubeadmapiv1beta2 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta2"
28
28
"k8s.io/kubernetes/cmd/kubeadm/app/constants"
29
29
"k8s.io/kubernetes/cmd/kubeadm/app/features"
30
- kubeletconfig "k8s.io/kubernetes/pkg/kubelet/apis/config"
31
- kubeproxyconfig "k8s.io/kubernetes/pkg/proxy/apis/config"
32
30
utilpointer "k8s.io/utils/pointer"
33
31
)
34
32
@@ -58,14 +56,16 @@ const (
58
56
59
57
// DefaultKubeProxyConfiguration assigns default values for the kube-proxy ComponentConfig
60
58
func DefaultKubeProxyConfiguration (internalcfg * kubeadmapi.ClusterConfiguration ) {
61
- externalproxycfg := & kubeproxyconfigv1alpha1.KubeProxyConfiguration {FeatureGates : make (map [string ]bool )}
62
59
kind := "KubeProxyConfiguration"
63
60
64
- // Do a roundtrip to the external version for defaulting
65
- if internalcfg .ComponentConfigs .KubeProxy != nil {
66
- Scheme .Convert (internalcfg .ComponentConfigs .KubeProxy , externalproxycfg , nil )
61
+ if internalcfg .ComponentConfigs .KubeProxy == nil {
62
+ internalcfg .ComponentConfigs .KubeProxy = & kubeproxyconfigv1alpha1.KubeProxyConfiguration {
63
+ FeatureGates : map [string ]bool {},
64
+ }
67
65
}
68
66
67
+ externalproxycfg := internalcfg .ComponentConfigs .KubeProxy
68
+
69
69
if externalproxycfg .ClusterCIDR == "" && internalcfg .Networking .PodSubnet != "" {
70
70
externalproxycfg .ClusterCIDR = internalcfg .Networking .PodSubnet
71
71
} else if internalcfg .Networking .PodSubnet != "" && externalproxycfg .ClusterCIDR != internalcfg .Networking .PodSubnet {
@@ -83,29 +83,20 @@ func DefaultKubeProxyConfiguration(internalcfg *kubeadmapi.ClusterConfiguration)
83
83
if enabled , present := internalcfg .FeatureGates [features .IPv6DualStack ]; present {
84
84
externalproxycfg .FeatureGates [features .IPv6DualStack ] = enabled
85
85
}
86
-
87
- // Run the rest of the kube-proxy defaulting code
88
- Scheme .Default (externalproxycfg )
89
-
90
- if internalcfg .ComponentConfigs .KubeProxy == nil {
91
- internalcfg .ComponentConfigs .KubeProxy = & kubeproxyconfig.KubeProxyConfiguration {}
92
- }
93
-
94
- // TODO: Figure out how to handle errors in defaulting code
95
- // Go back to the internal version
96
- Scheme .Convert (externalproxycfg , internalcfg .ComponentConfigs .KubeProxy , nil )
97
86
}
98
87
99
88
// DefaultKubeletConfiguration assigns default values for the kubelet ComponentConfig
100
89
func DefaultKubeletConfiguration (internalcfg * kubeadmapi.ClusterConfiguration ) {
101
- externalkubeletcfg := & kubeletconfigv1beta1.KubeletConfiguration {}
102
90
kind := "KubeletConfiguration"
103
91
104
- // Do a roundtrip to the external version for defaulting
105
- if internalcfg .ComponentConfigs .Kubelet != nil {
106
- Scheme .Convert (internalcfg .ComponentConfigs .Kubelet , externalkubeletcfg , nil )
92
+ if internalcfg .ComponentConfigs .Kubelet == nil {
93
+ internalcfg .ComponentConfigs .Kubelet = & kubeletconfigv1beta1.KubeletConfiguration {
94
+ FeatureGates : map [string ]bool {},
95
+ }
107
96
}
108
97
98
+ externalkubeletcfg := internalcfg .ComponentConfigs .Kubelet
99
+
109
100
if externalkubeletcfg .StaticPodPath == "" {
110
101
externalkubeletcfg .StaticPodPath = kubeadmapiv1beta2 .DefaultManifestsDir
111
102
} else if externalkubeletcfg .StaticPodPath != kubeadmapiv1beta2 .DefaultManifestsDir {
@@ -181,16 +172,6 @@ func DefaultKubeletConfiguration(internalcfg *kubeadmapi.ClusterConfiguration) {
181
172
// We cannot show a warning for RotateCertificates==false and we must hardcode it to true.
182
173
// There is no way to determine if the user has set this or not, given the field is a non-pointer.
183
174
externalkubeletcfg .RotateCertificates = kubeletRotateCertificates
184
-
185
- Scheme .Default (externalkubeletcfg )
186
-
187
- if internalcfg .ComponentConfigs .Kubelet == nil {
188
- internalcfg .ComponentConfigs .Kubelet = & kubeletconfig.KubeletConfiguration {}
189
- }
190
-
191
- // TODO: Figure out how to handle errors in defaulting code
192
- // Go back to the internal version
193
- Scheme .Convert (externalkubeletcfg , internalcfg .ComponentConfigs .Kubelet , nil )
194
175
}
195
176
196
177
// warnDefaultComponentConfigValue prints a warning if the user modified a field in a certain
0 commit comments