mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-27 21:26:03 +00:00
add LoggingConfiguration struct to component-base/config
This commit is contained in:
@@ -21,6 +21,7 @@ go_library(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//staging/src/k8s.io/component-base/config:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
|
@@ -182,7 +182,7 @@ var (
|
||||
"HairpinMode",
|
||||
"HealthzBindAddress",
|
||||
"HealthzPort",
|
||||
"LoggingConfig.LoggingFormat",
|
||||
"Logging.Format",
|
||||
"TLSCipherSuites[*]",
|
||||
"TLSMinVersion",
|
||||
"IPTablesDropBit",
|
||||
|
@@ -49,7 +49,7 @@ iptablesMasqueradeBit: 14
|
||||
kind: KubeletConfiguration
|
||||
kubeAPIBurst: 10
|
||||
kubeAPIQPS: 5
|
||||
loggingConfig: {}
|
||||
logging: {}
|
||||
makeIPTablesUtilChains: true
|
||||
maxOpenFiles: 1000000
|
||||
maxPods: 110
|
||||
|
@@ -49,7 +49,7 @@ iptablesMasqueradeBit: 14
|
||||
kind: KubeletConfiguration
|
||||
kubeAPIBurst: 10
|
||||
kubeAPIQPS: 5
|
||||
loggingConfig: {}
|
||||
logging: {}
|
||||
makeIPTablesUtilChains: true
|
||||
maxOpenFiles: 1000000
|
||||
maxPods: 110
|
||||
|
@@ -19,6 +19,7 @@ package config
|
||||
import (
|
||||
v1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
componentbaseconfig "k8s.io/component-base/config"
|
||||
)
|
||||
|
||||
// HairpinMode denotes how the kubelet should configure networking to handle
|
||||
@@ -357,9 +358,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
|
||||
// LoggingConfig specifies the options of logging.
|
||||
// Logging specifies the options of logging.
|
||||
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
|
||||
LoggingConfig LoggingConfig
|
||||
Logging componentbaseconfig.LoggingConfiguration
|
||||
}
|
||||
|
||||
// KubeletAuthorizationMode denotes the authorization mode for the kubelet
|
||||
@@ -437,11 +438,3 @@ 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
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ go_library(
|
||||
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
|
||||
"//staging/src/k8s.io/component-base/config/v1alpha1:go_default_library",
|
||||
"//staging/src/k8s.io/kubelet/config/v1beta1:go_default_library",
|
||||
"//vendor/k8s.io/utils/pointer:go_default_library",
|
||||
],
|
||||
|
@@ -26,6 +26,7 @@ import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1alpha1 "k8s.io/component-base/config/v1alpha1"
|
||||
v1beta1 "k8s.io/kubelet/config/v1beta1"
|
||||
config "k8s.io/kubernetes/pkg/kubelet/apis/config"
|
||||
)
|
||||
@@ -107,16 +108,6 @@ 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 {
|
||||
@@ -352,7 +343,7 @@ func autoConvert_v1beta1_KubeletConfiguration_To_config_KubeletConfiguration(in
|
||||
out.VolumePluginDir = in.VolumePluginDir
|
||||
out.ProviderID = in.ProviderID
|
||||
out.KernelMemcgNotification = in.KernelMemcgNotification
|
||||
if err := Convert_v1beta1_LoggingConfig_To_config_LoggingConfig(&in.LoggingConfig, &out.LoggingConfig, s); err != nil {
|
||||
if err := v1alpha1.Convert_v1alpha1_LoggingConfiguration_To_config_LoggingConfiguration(&in.Logging, &out.Logging, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -499,7 +490,7 @@ func autoConvert_config_KubeletConfiguration_To_v1beta1_KubeletConfiguration(in
|
||||
out.EnforceNodeAllocatable = *(*[]string)(unsafe.Pointer(&in.EnforceNodeAllocatable))
|
||||
out.ReservedSystemCPUs = in.ReservedSystemCPUs
|
||||
out.ShowHiddenMetricsForVersion = in.ShowHiddenMetricsForVersion
|
||||
if err := Convert_config_LoggingConfig_To_v1beta1_LoggingConfig(&in.LoggingConfig, &out.LoggingConfig, s); err != nil {
|
||||
if err := v1alpha1.Convert_config_LoggingConfiguration_To_v1alpha1_LoggingConfiguration(&in.Logging, &out.Logging, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
@@ -578,26 +569,6 @@ 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.LoggingConfig.LoggingFormat != "" {
|
||||
logOption.LogFormat = kc.LoggingConfig.LoggingFormat
|
||||
if kc.Logging.Format != "" {
|
||||
logOption.LogFormat = kc.Logging.Format
|
||||
}
|
||||
allErrors = append(allErrors, logOption.Validate()...)
|
||||
|
||||
|
18
pkg/kubelet/apis/config/zz_generated.deepcopy.go
generated
18
pkg/kubelet/apis/config/zz_generated.deepcopy.go
generated
@@ -185,7 +185,7 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) {
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
out.LoggingConfig = in.LoggingConfig
|
||||
out.Logging = in.Logging
|
||||
return
|
||||
}
|
||||
|
||||
@@ -258,22 +258,6 @@ 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