mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 20:54:08 +00:00
add loggingConfig struct to kubelet config
This commit is contained in:
@@ -182,6 +182,7 @@ var (
|
||||
"HairpinMode",
|
||||
"HealthzBindAddress",
|
||||
"HealthzPort",
|
||||
"LoggingConfig.LoggingFormat",
|
||||
"TLSCipherSuites[*]",
|
||||
"TLSMinVersion",
|
||||
"IPTablesDropBit",
|
||||
@@ -195,7 +196,6 @@ var (
|
||||
"KubeReservedCgroup",
|
||||
"KubeReserved[*]",
|
||||
"KubeletCgroups",
|
||||
"LogFormat",
|
||||
"MakeIPTablesUtilChains",
|
||||
"RotateCertificates",
|
||||
"ServerTLSBootstrap",
|
||||
|
@@ -49,6 +49,7 @@ iptablesMasqueradeBit: 14
|
||||
kind: KubeletConfiguration
|
||||
kubeAPIBurst: 10
|
||||
kubeAPIQPS: 5
|
||||
loggingConfig: {}
|
||||
makeIPTablesUtilChains: true
|
||||
maxOpenFiles: 1000000
|
||||
maxPods: 110
|
||||
|
@@ -49,6 +49,7 @@ iptablesMasqueradeBit: 14
|
||||
kind: KubeletConfiguration
|
||||
kubeAPIBurst: 10
|
||||
kubeAPIQPS: 5
|
||||
loggingConfig: {}
|
||||
makeIPTablesUtilChains: true
|
||||
maxOpenFiles: 1000000
|
||||
maxPods: 110
|
||||
|
@@ -357,10 +357,9 @@ type KubeletConfiguration struct {
|
||||
// The purpose of this format is make sure you have the opportunity to notice if the next release hides additional metrics,
|
||||
// rather than being surprised when they are permanently removed in the release after that.
|
||||
ShowHiddenMetricsForVersion string
|
||||
// LogFormat Flag specifies the structure of log messages.
|
||||
// default value of logFormat is `text`
|
||||
// LoggingConfig specifies the options of logging.
|
||||
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
||||
LogFormat string
|
||||
LoggingConfig LoggingConfig
|
||||
}
|
||||
|
||||
// KubeletAuthorizationMode denotes the authorization mode for the kubelet
|
||||
@@ -438,3 +437,11 @@ type SerializedNodeConfigSource struct {
|
||||
// +optional
|
||||
Source v1.NodeConfigSource
|
||||
}
|
||||
|
||||
// LoggingConfig contains logging options
|
||||
type LoggingConfig struct {
|
||||
// LoggingFormat Flag specifies the structure of log messages.
|
||||
// default value of loggingFormat is `text`
|
||||
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
||||
LoggingFormat string
|
||||
}
|
||||
|
@@ -107,6 +107,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.LoggingConfig)(nil), (*config.LoggingConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_LoggingConfig_To_config_LoggingConfig(a.(*v1beta1.LoggingConfig), b.(*config.LoggingConfig), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*config.LoggingConfig)(nil), (*v1beta1.LoggingConfig)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_config_LoggingConfig_To_v1beta1_LoggingConfig(a.(*config.LoggingConfig), b.(*v1beta1.LoggingConfig), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*v1beta1.SerializedNodeConfigSource)(nil), (*config.SerializedNodeConfigSource)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta1_SerializedNodeConfigSource_To_config_SerializedNodeConfigSource(a.(*v1beta1.SerializedNodeConfigSource), b.(*config.SerializedNodeConfigSource), scope)
|
||||
}); err != nil {
|
||||
@@ -342,7 +352,9 @@ func autoConvert_v1beta1_KubeletConfiguration_To_config_KubeletConfiguration(in
|
||||
out.VolumePluginDir = in.VolumePluginDir
|
||||
out.ProviderID = in.ProviderID
|
||||
out.KernelMemcgNotification = in.KernelMemcgNotification
|
||||
out.LogFormat = in.LogFormat
|
||||
if err := Convert_v1beta1_LoggingConfig_To_config_LoggingConfig(&in.LoggingConfig, &out.LoggingConfig, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -487,7 +499,9 @@ func autoConvert_config_KubeletConfiguration_To_v1beta1_KubeletConfiguration(in
|
||||
out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable))
|
||||
out.ReservedSystemCPUs = in.ReservedSystemCPUs
|
||||
out.ShowHiddenMetricsForVersion = in.ShowHiddenMetricsForVersion
|
||||
out.LogFormat = in.LogFormat
|
||||
if err := Convert_config_LoggingConfig_To_v1beta1_LoggingConfig(&in.LoggingConfig, &out.LoggingConfig, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -564,6 +578,26 @@ func Convert_config_KubeletX509Authentication_To_v1beta1_KubeletX509Authenticati
|
||||
return autoConvert_config_KubeletX509Authentication_To_v1beta1_KubeletX509Authentication(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_LoggingConfig_To_config_LoggingConfig(in *v1beta1.LoggingConfig, out *config.LoggingConfig, s conversion.Scope) error {
|
||||
out.LoggingFormat = in.LoggingFormat
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta1_LoggingConfig_To_config_LoggingConfig is an autogenerated conversion function.
|
||||
func Convert_v1beta1_LoggingConfig_To_config_LoggingConfig(in *v1beta1.LoggingConfig, out *config.LoggingConfig, s conversion.Scope) error {
|
||||
return autoConvert_v1beta1_LoggingConfig_To_config_LoggingConfig(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_config_LoggingConfig_To_v1beta1_LoggingConfig(in *config.LoggingConfig, out *v1beta1.LoggingConfig, s conversion.Scope) error {
|
||||
out.LoggingFormat = in.LoggingFormat
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_config_LoggingConfig_To_v1beta1_LoggingConfig is an autogenerated conversion function.
|
||||
func Convert_config_LoggingConfig_To_v1beta1_LoggingConfig(in *config.LoggingConfig, out *v1beta1.LoggingConfig, s conversion.Scope) error {
|
||||
return autoConvert_config_LoggingConfig_To_v1beta1_LoggingConfig(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta1_SerializedNodeConfigSource_To_config_SerializedNodeConfigSource(in *v1beta1.SerializedNodeConfigSource, out *config.SerializedNodeConfigSource, s conversion.Scope) error {
|
||||
out.Source = in.Source
|
||||
return nil
|
||||
|
@@ -161,8 +161,8 @@ func ValidateKubeletConfiguration(kc *kubeletconfig.KubeletConfiguration) error
|
||||
allErrors = append(allErrors, metrics.ValidateShowHiddenMetricsVersion(kc.ShowHiddenMetricsForVersion)...)
|
||||
|
||||
logOption := logs.NewOptions()
|
||||
if kc.LogFormat != "" {
|
||||
logOption.LogFormat = kc.LogFormat
|
||||
if kc.LoggingConfig.LoggingFormat != "" {
|
||||
logOption.LogFormat = kc.LoggingConfig.LoggingFormat
|
||||
}
|
||||
allErrors = append(allErrors, logOption.Validate()...)
|
||||
|
||||
|
17
pkg/kubelet/apis/config/zz_generated.deepcopy.go
generated
17
pkg/kubelet/apis/config/zz_generated.deepcopy.go
generated
@@ -185,6 +185,7 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.LoggingConfig = in.LoggingConfig
|
||||
return
|
||||
}
|
||||
|
||||
@@ -257,6 +258,22 @@ func (in *KubeletX509Authentication) DeepCopy() *KubeletX509Authentication {
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *LoggingConfig) DeepCopyInto(out *LoggingConfig) {
|
||||
*out = *in
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LoggingConfig.
|
||||
func (in *LoggingConfig) DeepCopy() *LoggingConfig {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(LoggingConfig)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *SerializedNodeConfigSource) DeepCopyInto(out *SerializedNodeConfigSource) {
|
||||
*out = *in
|
||||
|
Reference in New Issue
Block a user