From 19d9405a1c3c383b9e1a6f9c69e09ecd97d99a8f Mon Sep 17 00:00:00 2001 From: Maksym Pavlenko Date: Fri, 17 Feb 2023 09:26:41 -0800 Subject: [PATCH] Update comments and error messages Signed-off-by: Maksym Pavlenko --- pkg/generated/openapi/zz_generated.openapi.go | 2 +- pkg/kubelet/apis/config/types.go | 3 +++ pkg/kubelet/apis/config/v1beta1/defaults_test.go | 2 ++ pkg/kubelet/kuberuntime/kuberuntime_sandbox_test.go | 2 +- staging/src/k8s.io/kubelet/config/v1beta1/types.go | 4 +++- 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index c6f961ccb9f..4289d018cd0 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -58146,7 +58146,7 @@ func schema_k8sio_kubelet_config_v1beta1_KubeletConfiguration(ref common.Referen }, "podLogsDir": { SchemaProps: spec.SchemaProps{ - Description: "podLogsDir is a custom root directory path kubelet will use to place pod's log files. Default: \"/var/log/pods\"", + Description: "podLogsDir is a custom root directory path kubelet will use to place pod's log files. Default: \"/var/log/pods/\" Note: it is not recommended to use the temp folder as a log directory as it may cause unexpected behavior in many places.", Type: []string{"string"}, Format: "", }, diff --git a/pkg/kubelet/apis/config/types.go b/pkg/kubelet/apis/config/types.go index 9f87f0be084..e44825dd652 100644 --- a/pkg/kubelet/apis/config/types.go +++ b/pkg/kubelet/apis/config/types.go @@ -89,6 +89,9 @@ type KubeletConfiguration struct { // run, or the path to a single static pod file. StaticPodPath string // podLogsDir is a custom root directory path kubelet will use to place pod's log files. + // Default: "/var/log/pods/" + // Note: it is not recommended to use the temp folder as a log directory as it may cause + // unexpected behavior in many places. PodLogsDir string // syncFrequency is the max period between synchronizing running // containers and config diff --git a/pkg/kubelet/apis/config/v1beta1/defaults_test.go b/pkg/kubelet/apis/config/v1beta1/defaults_test.go index 0fd10411bba..b7ab172929e 100644 --- a/pkg/kubelet/apis/config/v1beta1/defaults_test.go +++ b/pkg/kubelet/apis/config/v1beta1/defaults_test.go @@ -256,6 +256,8 @@ func TestSetDefaultsKubeletConfiguration(t *testing.T) { EnableDebugFlagsHandler: utilpointer.Bool(false), SeccompDefault: utilpointer.Bool(false), MemoryThrottlingFactor: utilpointer.Float64(0), + RegisterNode: utilpointer.Bool(false), + LocalStorageCapacityIsolation: utilpointer.Bool(false), PodLogsDir: "", }, &v1beta1.KubeletConfiguration{ diff --git a/pkg/kubelet/kuberuntime/kuberuntime_sandbox_test.go b/pkg/kubelet/kuberuntime/kuberuntime_sandbox_test.go index 4939ffb61ad..ab89f037fc3 100644 --- a/pkg/kubelet/kuberuntime/kuberuntime_sandbox_test.go +++ b/pkg/kubelet/kuberuntime/kuberuntime_sandbox_test.go @@ -44,7 +44,7 @@ func TestGeneratePodSandboxConfig(t *testing.T) { require.NoError(t, err) pod := newTestPod() - expectedLogDirectory := filepath.Join(testPodLogsRootDirectory, pod.Namespace+"_"+pod.Name+"_12345678") + expectedLogDirectory := filepath.Join(testPodLogsDirectory, pod.Namespace+"_"+pod.Name+"_12345678") expectedLabels := map[string]string{ "io.kubernetes.pod.name": pod.Name, "io.kubernetes.pod.namespace": pod.Namespace, diff --git a/staging/src/k8s.io/kubelet/config/v1beta1/types.go b/staging/src/k8s.io/kubelet/config/v1beta1/types.go index 421a6ff62dc..7a920e1ea9f 100644 --- a/staging/src/k8s.io/kubelet/config/v1beta1/types.go +++ b/staging/src/k8s.io/kubelet/config/v1beta1/types.go @@ -99,7 +99,9 @@ type KubeletConfiguration struct { // +optional StaticPodPath string `json:"staticPodPath,omitempty"` // podLogsDir is a custom root directory path kubelet will use to place pod's log files. - // Default: "/var/log/pods" + // Default: "/var/log/pods/" + // Note: it is not recommended to use the temp folder as a log directory as it may cause + // unexpected behavior in many places. // +optional PodLogsDir string `json:"podLogsDir,omitempty"` // syncFrequency is the max period between synchronizing running