mirror of https://github.com/k3s-io/k3s
fix ReadOnlyPort, HealthzPort, CAdvisorPort defaulting/documentation
The ReadOnlyPort defaulting prevented passing 0 to diable via the KubeletConfiguraiton struct. The HealthzPort defaulting prevented passing 0 to disable via the KubeletConfiguration struct. The documentation also failed to mention this, but the check is performed in code. The CAdvisorPort documentation failed to mention that you can pass 0 to disable.pull/6/head
parent
acdf625e46
commit
6918ab1d70
|
@ -292,8 +292,8 @@ func AddKubeletConfigFlags(fs *pflag.FlagSet, c *kubeletconfig.KubeletConfigurat
|
|||
fs.MarkDeprecated("maximum-dead-containers-per-container", "Use --eviction-hard or --eviction-soft instead. Will be removed in a future version.")
|
||||
fs.Int32Var(&c.MaxContainerCount, "maximum-dead-containers", c.MaxContainerCount, "Maximum number of old instances of containers to retain globally. Each container takes up some disk space. To disable, set to a negative number.")
|
||||
fs.MarkDeprecated("maximum-dead-containers", "Use --eviction-hard or --eviction-soft instead. Will be removed in a future version.")
|
||||
fs.Int32Var(&c.CAdvisorPort, "cadvisor-port", c.CAdvisorPort, "The port of the localhost cAdvisor endpoint")
|
||||
fs.Int32Var(&c.HealthzPort, "healthz-port", c.HealthzPort, "The port of the localhost healthz endpoint")
|
||||
fs.Int32Var(&c.CAdvisorPort, "cadvisor-port", c.CAdvisorPort, "The port of the localhost cAdvisor endpoint (set to 0 to disable)")
|
||||
fs.Int32Var(&c.HealthzPort, "healthz-port", c.HealthzPort, "The port of the localhost healthz endpoint (set to 0 to disable)")
|
||||
fs.Var(componentconfig.IPVar{Val: &c.HealthzBindAddress}, "healthz-bind-address", "The IP address for the healthz server to serve on. (set to 0.0.0.0 for all interfaces)")
|
||||
fs.Int32Var(&c.OOMScoreAdj, "oom-score-adj", c.OOMScoreAdj, "The oom-score-adj value for kubelet process. Values must be within the range [-1000, 1000]")
|
||||
fs.BoolVar(&c.RegisterNode, "register-node", c.RegisterNode, "Register the node with the apiserver. If --kubeconfig is not provided, this flag is irrelevant, as the Kubelet won't have an apiserver to register with. Default=true.")
|
||||
|
|
|
@ -140,9 +140,9 @@ type KubeletConfiguration struct {
|
|||
// maxContainerCount is the maximum number of old instances of containers
|
||||
// to retain globally. Each container takes up some disk space.
|
||||
MaxContainerCount int32
|
||||
// cAdvisorPort is the port of the localhost cAdvisor endpoint
|
||||
// cAdvisorPort is the port of the localhost cAdvisor endpoint (set to 0 to disable)
|
||||
CAdvisorPort int32
|
||||
// healthzPort is the port of the localhost healthz endpoint
|
||||
// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
|
||||
HealthzPort int32
|
||||
// healthzBindAddress is the IP address for the healthz server to serve
|
||||
// on.
|
||||
|
|
|
@ -112,8 +112,8 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
|||
if obj.HealthzBindAddress == "" {
|
||||
obj.HealthzBindAddress = "127.0.0.1"
|
||||
}
|
||||
if obj.HealthzPort == 0 {
|
||||
obj.HealthzPort = 10248
|
||||
if obj.HealthzPort == nil {
|
||||
obj.HealthzPort = utilpointer.Int32Ptr(10248)
|
||||
}
|
||||
if obj.HostNetworkSources == nil {
|
||||
obj.HostNetworkSources = []string{kubetypes.AllSource}
|
||||
|
@ -174,8 +174,8 @@ func SetDefaults_KubeletConfiguration(obj *KubeletConfiguration) {
|
|||
if obj.Port == 0 {
|
||||
obj.Port = ports.KubeletPort
|
||||
}
|
||||
if obj.ReadOnlyPort == 0 {
|
||||
obj.ReadOnlyPort = ports.KubeletReadOnlyPort
|
||||
if obj.ReadOnlyPort == nil {
|
||||
obj.ReadOnlyPort = utilpointer.Int32Ptr(ports.KubeletReadOnlyPort)
|
||||
}
|
||||
if obj.RegisterNode == nil {
|
||||
obj.RegisterNode = boolVar(true)
|
||||
|
|
|
@ -78,7 +78,7 @@ type KubeletConfiguration struct {
|
|||
Port int32 `json:"port"`
|
||||
// readOnlyPort is the read-only port for the Kubelet to serve on with
|
||||
// no authentication/authorization (set to 0 to disable)
|
||||
ReadOnlyPort int32 `json:"readOnlyPort"`
|
||||
ReadOnlyPort *int32 `json:"readOnlyPort"`
|
||||
// tlsCertFile is the file containing x509 Certificate for HTTPS. (CA cert,
|
||||
// if any, concatenated after server cert). If tlsCertFile and
|
||||
// tlsPrivateKeyFile are not provided, a self-signed certificate
|
||||
|
@ -135,10 +135,10 @@ type KubeletConfiguration struct {
|
|||
// maxContainerCount is the maximum number of old instances of containers
|
||||
// to retain globally. Each container takes up some disk space.
|
||||
MaxContainerCount *int32 `json:"maxContainerCount"`
|
||||
// cAdvisorPort is the port of the localhost cAdvisor endpoint
|
||||
// cAdvisorPort is the port of the localhost cAdvisor endpoint (set to 0 to disable)
|
||||
CAdvisorPort *int32 `json:"cAdvisorPort"`
|
||||
// healthzPort is the port of the localhost healthz endpoint
|
||||
HealthzPort int32 `json:"healthzPort"`
|
||||
// healthzPort is the port of the localhost healthz endpoint (set to 0 to disable)
|
||||
HealthzPort *int32 `json:"healthzPort"`
|
||||
// healthzBindAddress is the IP address for the healthz server to serve
|
||||
// on.
|
||||
HealthzBindAddress string `json:"healthzBindAddress"`
|
||||
|
|
|
@ -154,7 +154,9 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
|||
}
|
||||
out.Address = in.Address
|
||||
out.Port = in.Port
|
||||
out.ReadOnlyPort = in.ReadOnlyPort
|
||||
if err := v1.Convert_Pointer_int32_To_int32(&in.ReadOnlyPort, &out.ReadOnlyPort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.TLSCertFile = in.TLSCertFile
|
||||
out.TLSPrivateKeyFile = in.TLSPrivateKeyFile
|
||||
if err := Convert_v1alpha1_KubeletAuthentication_To_kubeletconfig_KubeletAuthentication(&in.Authentication, &out.Authentication, s); err != nil {
|
||||
|
@ -190,7 +192,9 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_kubeletconfig_KubeletConfigura
|
|||
if err := v1.Convert_Pointer_int32_To_int32(&in.CAdvisorPort, &out.CAdvisorPort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.HealthzPort = in.HealthzPort
|
||||
if err := v1.Convert_Pointer_int32_To_int32(&in.HealthzPort, &out.HealthzPort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.HealthzBindAddress = in.HealthzBindAddress
|
||||
if err := v1.Convert_Pointer_int32_To_int32(&in.OOMScoreAdj, &out.OOMScoreAdj, s); err != nil {
|
||||
return err
|
||||
|
@ -313,7 +317,9 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
|||
}
|
||||
out.Address = in.Address
|
||||
out.Port = in.Port
|
||||
out.ReadOnlyPort = in.ReadOnlyPort
|
||||
if err := v1.Convert_int32_To_Pointer_int32(&in.ReadOnlyPort, &out.ReadOnlyPort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.TLSCertFile = in.TLSCertFile
|
||||
out.TLSPrivateKeyFile = in.TLSPrivateKeyFile
|
||||
if err := Convert_kubeletconfig_KubeletAuthentication_To_v1alpha1_KubeletAuthentication(&in.Authentication, &out.Authentication, s); err != nil {
|
||||
|
@ -361,7 +367,9 @@ func autoConvert_kubeletconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigura
|
|||
if err := v1.Convert_int32_To_Pointer_int32(&in.CAdvisorPort, &out.CAdvisorPort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.HealthzPort = in.HealthzPort
|
||||
if err := v1.Convert_int32_To_Pointer_int32(&in.HealthzPort, &out.HealthzPort, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.HealthzBindAddress = in.HealthzBindAddress
|
||||
if err := v1.Convert_int32_To_Pointer_int32(&in.OOMScoreAdj, &out.OOMScoreAdj, s); err != nil {
|
||||
return err
|
||||
|
|
|
@ -155,6 +155,15 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
|||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.ReadOnlyPort != nil {
|
||||
in, out := &in.ReadOnlyPort, &out.ReadOnlyPort
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
in.Authentication.DeepCopyInto(&out.Authentication)
|
||||
out.Authorization = in.Authorization
|
||||
if in.AllowPrivileged != nil {
|
||||
|
@ -227,6 +236,15 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
|||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.HealthzPort != nil {
|
||||
in, out := &in.HealthzPort, &out.HealthzPort
|
||||
if *in == nil {
|
||||
*out = nil
|
||||
} else {
|
||||
*out = new(int32)
|
||||
**out = **in
|
||||
}
|
||||
}
|
||||
if in.OOMScoreAdj != nil {
|
||||
in, out := &in.OOMScoreAdj, &out.OOMScoreAdj
|
||||
if *in == nil {
|
||||
|
|
Loading…
Reference in New Issue