add default for loggingconfiguration struct
This commit is contained in:
parent
3ab25f1876
commit
b92b04e7cd
@ -405,9 +405,7 @@ func UnsecuredDependencies(s *options.KubeletServer, featureGate featuregate.Fea
|
||||
// not be generated.
|
||||
func Run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, featureGate featuregate.FeatureGate, stopCh <-chan struct{}) error {
|
||||
logOption := logs.NewOptions()
|
||||
if s.Logging.Format != "" {
|
||||
logOption.LogFormat = s.Logging.Format
|
||||
}
|
||||
logOption.LogFormat = s.Logging.Format
|
||||
logOption.Apply()
|
||||
// To help debugging, immediately log version
|
||||
klog.Infof("Version: %+v", version.Get())
|
||||
|
@ -100,6 +100,9 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
obj.ConfigMapAndSecretChangeDetectionStrategy = "Watch"
|
||||
obj.AllowedUnsafeSysctls = []string{}
|
||||
obj.VolumePluginDir = kubeletconfigv1beta1.DefaultVolumePluginDir
|
||||
if obj.Logging.Format == "" {
|
||||
obj.Logging.Format = "text"
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,8 @@ iptablesMasqueradeBit: 14
|
||||
kind: KubeletConfiguration
|
||||
kubeAPIBurst: 10
|
||||
kubeAPIQPS: 5
|
||||
logging: {}
|
||||
logging:
|
||||
format: text
|
||||
makeIPTablesUtilChains: true
|
||||
maxOpenFiles: 1000000
|
||||
maxPods: 110
|
||||
|
@ -49,7 +49,8 @@ iptablesMasqueradeBit: 14
|
||||
kind: KubeletConfiguration
|
||||
kubeAPIBurst: 10
|
||||
kubeAPIQPS: 5
|
||||
logging: {}
|
||||
logging:
|
||||
format: text
|
||||
makeIPTablesUtilChains: true
|
||||
maxOpenFiles: 1000000
|
||||
maxPods: 110
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
componentbaseconfigv1alpha1 "k8s.io/component-base/config/v1alpha1"
|
||||
kubeletconfigv1beta1 "k8s.io/kubelet/config/v1beta1"
|
||||
// TODO: Cut references to k8s.io/kubernetes, eventually there should be none from this package
|
||||
"k8s.io/kubernetes/pkg/kubelet/qos"
|
||||
@ -233,4 +234,6 @@ func SetDefaults_KubeletConfiguration(obj *kubeletconfigv1beta1.KubeletConfigura
|
||||
if obj.VolumePluginDir == "" {
|
||||
obj.VolumePluginDir = DefaultVolumePluginDir
|
||||
}
|
||||
// Use the Default LoggingConfiguration option
|
||||
componentbaseconfigv1alpha1.RecommendedLoggingConfiguration(&obj.Logging)
|
||||
}
|
||||
|
@ -95,3 +95,18 @@ func NewRecommendedDebuggingConfiguration() *DebuggingConfiguration {
|
||||
RecommendedDebuggingConfiguration(ret)
|
||||
return ret
|
||||
}
|
||||
|
||||
// RecommendedLoggingConfiguration defaults logging configuration.
|
||||
// This will set the recommended default
|
||||
// values, but they may be subject to change between API versions. This function
|
||||
// is intentionally not registered in the scheme as a "normal" `SetDefaults_Foo`
|
||||
// function to allow consumers of this type to set whatever defaults for their
|
||||
// embedded configs. Forcing consumers to use these defaults would be problematic
|
||||
// as defaulting in the scheme is done as part of the conversion, and there would
|
||||
// be no easy way to opt-out. Instead, if you want to use this defaulting method
|
||||
// run it in your wrapper struct of this type in its `SetDefaults_` method.
|
||||
func RecommendedLoggingConfiguration(obj *LoggingConfiguration) {
|
||||
if obj.Format == "" {
|
||||
obj.Format = "text"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user