Use LoggingConfig within LogOptions

Co-authored-by: mengjiao.liu <mengjiao.liu@daocloud.io>
Co-authored-by: Jordan Liggitt <jordan@liggitt.net>
Co-authored-by: Heisenberg <yuzhiquanlong@gmail.com>
This commit is contained in:
Marek Siarkowicz
2021-05-29 17:37:29 +02:00
committed by Marek Siarkowicz
parent 36896f9cab
commit f9343f837d
8 changed files with 70 additions and 46 deletions

View File

@@ -62,6 +62,9 @@ func TestValidateKubeletConfiguration(t *testing.T) {
"CustomCPUCFSQuotaPeriod": true,
"GracefulNodeShutdown": true,
},
Logging: componentbaseconfig.LoggingConfiguration{
Format: "text",
},
}
if allErrors := ValidateKubeletConfiguration(successCase1); allErrors != nil {
t.Errorf("expect no errors, got %v", allErrors)
@@ -102,6 +105,9 @@ func TestValidateKubeletConfiguration(t *testing.T) {
FeatureGates: map[string]bool{
"CustomCPUCFSQuotaPeriod": true,
},
Logging: componentbaseconfig.LoggingConfiguration{
Format: "text",
},
}
if allErrors := ValidateKubeletConfiguration(successCase2); allErrors != nil {
t.Errorf("expect no errors, got %v", allErrors)
@@ -178,8 +184,11 @@ func TestValidateKubeletConfiguration(t *testing.T) {
CPUCFSQuotaPeriod: metav1.Duration{Duration: 100 * time.Millisecond},
ShutdownGracePeriod: metav1.Duration{Duration: 30 * time.Second},
ShutdownGracePeriodCriticalPods: metav1.Duration{Duration: 60 * time.Second},
Logging: componentbaseconfig.LoggingConfiguration{
Format: "",
},
}
const numErrsErrorCase1 = 28
const numErrsErrorCase1 = 29
if allErrors := ValidateKubeletConfiguration(errorCase1); len(allErrors.(utilerrors.Aggregate).Errors()) != numErrsErrorCase1 {
t.Errorf("expect %d errors, got %v", numErrsErrorCase1, len(allErrors.(utilerrors.Aggregate).Errors()))
}
@@ -220,6 +229,9 @@ func TestValidateKubeletConfiguration(t *testing.T) {
"CustomCPUCFSQuotaPeriod": true,
"GracefulNodeShutdown": true,
},
Logging: componentbaseconfig.LoggingConfiguration{
Format: "text",
},
}
const numErrsErrorCase2 = 3
if allErrors := ValidateKubeletConfiguration(errorCase2); len(allErrors.(utilerrors.Aggregate).Errors()) != numErrsErrorCase2 {