Skip to content

Commit 3ab25f1

Browse files
committed
add LoggingConfiguration struct to component-base/config
1 parent ac8d2e8 commit 3ab25f1

File tree

22 files changed

+102
-97
lines changed

22 files changed

+102
-97
lines changed

cmd/kubeadm/app/componentconfigs/kubelet_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ var kubeletMarshalCases = []struct {
7676
httpCheckFrequency: 0s
7777
imageMinimumGCAge: 0s
7878
kind: KubeletConfiguration
79-
loggingConfig: {}
79+
logging: {}
8080
nodeStatusReportFrequency: 0s
8181
nodeStatusUpdateFrequency: 0s
8282
runtimeRequestTimeout: 0s
@@ -119,7 +119,7 @@ var kubeletMarshalCases = []struct {
119119
httpCheckFrequency: 0s
120120
imageMinimumGCAge: 0s
121121
kind: KubeletConfiguration
122-
loggingConfig: {}
122+
logging: {}
123123
nodeStatusReportFrequency: 0s
124124
nodeStatusUpdateFrequency: 0s
125125
port: 12345

cmd/kubelet/app/options/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ func AddKubeletConfigFlags(mainfs *pflag.FlagSet, c *kubeletconfig.KubeletConfig
540540
fs.StringSliceVar(&c.EnforceNodeAllocatable, "enforce-node-allocatable", c.EnforceNodeAllocatable, "A comma separated list of levels of node allocatable enforcement to be enforced by kubelet. Acceptable options are 'none', 'pods', 'system-reserved', and 'kube-reserved'. If the latter two options are specified, '--system-reserved-cgroup' and '--kube-reserved-cgroup' must also be set, respectively. If 'none' is specified, no additional options should be set. See https://kubernetes.io/docs/tasks/administer-cluster/reserve-compute-resources/ for more details.")
541541
fs.StringVar(&c.SystemReservedCgroup, "system-reserved-cgroup", c.SystemReservedCgroup, "Absolute name of the top level cgroup that is used to manage non-kubernetes components for which compute resources were reserved via '--system-reserved' flag. Ex. '/system-reserved'. [default='']")
542542
fs.StringVar(&c.KubeReservedCgroup, "kube-reserved-cgroup", c.KubeReservedCgroup, "Absolute name of the top level cgroup that is used to manage kubernetes components for which compute resources were reserved via '--kube-reserved' flag. Ex. '/kube-reserved'. [default='']")
543-
fs.StringVar(&c.LoggingConfig.LoggingFormat, "logging-format", c.LoggingConfig.LoggingFormat, `Sets the log format. Permitted formats: "text", "json".\nNon-default formats don't honor these flags: -add_dir_header, --alsologtostderr, --log_backtrace_at, --log_dir, --log_file, --log_file_max_size, --logtostderr, --skip_headers, --skip_log_headers, --stderrthreshold, --log-flush-frequency.\nNon-default choices are currently alpha and subject to change without warning.`)
543+
fs.StringVar(&c.Logging.Format, "logging-format", c.Logging.Format, `Sets the log format. Permitted formats: "text", "json".\nNon-default formats don't honor these flags: -add_dir_header, --alsologtostderr, --log_backtrace_at, --log_dir, --log_file, --log_file_max_size, --logtostderr, --skip_headers, --skip_log_headers, --stderrthreshold, --log-flush-frequency.\nNon-default choices are currently alpha and subject to change without warning.`)
544544

545545
// Graduated experimental flags, kept for backward compatibility
546546
fs.BoolVar(&c.KernelMemcgNotification, "experimental-kernel-memcg-notification", c.KernelMemcgNotification, "Use kernelMemcgNotification configuration, this flag will be removed in 1.23.")

cmd/kubelet/app/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ func UnsecuredDependencies(s *options.KubeletServer, featureGate featuregate.Fea
405405
// not be generated.
406406
func Run(s *options.KubeletServer, kubeDeps *kubelet.Dependencies, featureGate featuregate.FeatureGate, stopCh <-chan struct{}) error {
407407
logOption := logs.NewOptions()
408-
if s.LoggingConfig.LoggingFormat != "" {
409-
logOption.LogFormat = s.LoggingConfig.LoggingFormat
408+
if s.Logging.Format != "" {
409+
logOption.LogFormat = s.Logging.Format
410410
}
411411
logOption.Apply()
412412
// To help debugging, immediately log version

pkg/kubelet/apis/config/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ go_library(
2121
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
2222
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
2323
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
24+
"//staging/src/k8s.io/component-base/config:go_default_library",
2425
],
2526
)
2627

pkg/kubelet/apis/config/helpers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ var (
182182
"HairpinMode",
183183
"HealthzBindAddress",
184184
"HealthzPort",
185-
"LoggingConfig.LoggingFormat",
185+
"Logging.Format",
186186
"TLSCipherSuites[*]",
187187
"TLSMinVersion",
188188
"IPTablesDropBit",

pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ iptablesMasqueradeBit: 14
4949
kind: KubeletConfiguration
5050
kubeAPIBurst: 10
5151
kubeAPIQPS: 5
52-
loggingConfig: {}
52+
logging: {}
5353
makeIPTablesUtilChains: true
5454
maxOpenFiles: 1000000
5555
maxPods: 110

pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ iptablesMasqueradeBit: 14
4949
kind: KubeletConfiguration
5050
kubeAPIBurst: 10
5151
kubeAPIQPS: 5
52-
loggingConfig: {}
52+
logging: {}
5353
makeIPTablesUtilChains: true
5454
maxOpenFiles: 1000000
5555
maxPods: 110

pkg/kubelet/apis/config/types.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package config
1919
import (
2020
v1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
componentbaseconfig "k8s.io/component-base/config"
2223
)
2324

2425
// HairpinMode denotes how the kubelet should configure networking to handle
@@ -357,9 +358,9 @@ type KubeletConfiguration struct {
357358
// The purpose of this format is make sure you have the opportunity to notice if the next release hides additional metrics,
358359
// rather than being surprised when they are permanently removed in the release after that.
359360
ShowHiddenMetricsForVersion string
360-
// LoggingConfig specifies the options of logging.
361+
// Logging specifies the options of logging.
361362
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
362-
LoggingConfig LoggingConfig
363+
Logging componentbaseconfig.LoggingConfiguration
363364
}
364365

365366
// KubeletAuthorizationMode denotes the authorization mode for the kubelet
@@ -437,11 +438,3 @@ type SerializedNodeConfigSource struct {
437438
// +optional
438439
Source v1.NodeConfigSource
439440
}
440-
441-
// LoggingConfig contains logging options
442-
type LoggingConfig struct {
443-
// LoggingFormat Flag specifies the structure of log messages.
444-
// default value of loggingFormat is `text`
445-
// Refer [Logs Options](https://github.com/kubernetes/component-base/blob/master/logs/options.go) for more information.
446-
LoggingFormat string
447-
}

pkg/kubelet/apis/config/v1beta1/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ go_library(
2727
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
2828
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
2929
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
30+
"//staging/src/k8s.io/component-base/config/v1alpha1:go_default_library",
3031
"//staging/src/k8s.io/kubelet/config/v1beta1:go_default_library",
3132
"//vendor/k8s.io/utils/pointer:go_default_library",
3233
],

pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go

Lines changed: 3 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)