From aadad094101e4b69f8b3fc245925ad630f90f337 Mon Sep 17 00:00:00 2001 From: Aravindh Puthiyaparambil Date: Mon, 6 Mar 2023 14:38:33 -0800 Subject: [PATCH] api: Add EnableNodeLogQuery to KubeletConfiguration Added EnableNodeLogQuery field to kubelet/apis/config/types.go and staging/src/k8s.io/kubelet/config/v1beta1/types.go, then executed. `hack/update-codegen.sh`. This new field will default to off and will need to be explicitly enabled in addition to the NodeLogQuery gate to use the feature. --- pkg/generated/openapi/zz_generated.openapi.go | 7 +++++++ pkg/kubelet/apis/config/fuzzer/fuzzer.go | 1 + pkg/kubelet/apis/config/helpers_test.go | 1 + .../testdata/KubeletConfiguration/after/v1beta1.yaml | 1 + .../KubeletConfiguration/roundtrip/default/v1beta1.yaml | 1 + pkg/kubelet/apis/config/types.go | 5 +++++ pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go | 6 ++++++ staging/src/k8s.io/kubelet/config/v1beta1/types.go | 6 ++++++ .../k8s.io/kubelet/config/v1beta1/zz_generated.deepcopy.go | 5 +++++ 9 files changed, 33 insertions(+) diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 9df7d19d0ed..c3f141c8ecd 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -58282,6 +58282,13 @@ func schema_k8sio_kubelet_config_v1beta1_KubeletConfiguration(ref common.Referen Format: "", }, }, + "enableSystemLogQuery": { + SchemaProps: spec.SchemaProps{ + Description: "enableSystemLogQuery enables the node log query feature on the /logs endpoint. EnableSystemLogHandler has to be enabled in addition for this feature to work. Default: false", + Type: []string{"boolean"}, + Format: "", + }, + }, "shutdownGracePeriod": { SchemaProps: spec.SchemaProps{ Description: "shutdownGracePeriod specifies the total duration that the node should delay the shutdown and total grace period for pod termination during a node shutdown. Default: \"0s\"", diff --git a/pkg/kubelet/apis/config/fuzzer/fuzzer.go b/pkg/kubelet/apis/config/fuzzer/fuzzer.go index 4ca102f9009..79748b4b93f 100644 --- a/pkg/kubelet/apis/config/fuzzer/fuzzer.go +++ b/pkg/kubelet/apis/config/fuzzer/fuzzer.go @@ -55,6 +55,7 @@ func Funcs(codecs runtimeserializer.CodecFactory) []interface{} { obj.EventRecordQPS = 5 obj.EnableControllerAttachDetach = true obj.EnableDebuggingHandlers = true + obj.EnableSystemLogQuery = false obj.FileCheckFrequency = metav1.Duration{Duration: 20 * time.Second} obj.HealthzBindAddress = "127.0.0.1" obj.HealthzPort = 10248 diff --git a/pkg/kubelet/apis/config/helpers_test.go b/pkg/kubelet/apis/config/helpers_test.go index 6c6a5eca91b..286602099f4 100644 --- a/pkg/kubelet/apis/config/helpers_test.go +++ b/pkg/kubelet/apis/config/helpers_test.go @@ -190,6 +190,7 @@ var ( "EnableControllerAttachDetach", "EnableDebugFlagsHandler", "EnableDebuggingHandlers", + "EnableSystemLogQuery", "EnableProfilingHandler", "EnableServer", "EnableSystemLogHandler", diff --git a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml index 8306dd69d38..16406184bd6 100644 --- a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml +++ b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/after/v1beta1.yaml @@ -29,6 +29,7 @@ enableDebuggingHandlers: true enableProfilingHandler: true enableServer: true enableSystemLogHandler: true +enableSystemLogQuery: false enforceNodeAllocatable: - pods eventBurst: 100 diff --git a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml index 785010e2abb..12aea87941e 100644 --- a/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml +++ b/pkg/kubelet/apis/config/scheme/testdata/KubeletConfiguration/roundtrip/default/v1beta1.yaml @@ -29,6 +29,7 @@ enableDebuggingHandlers: true enableProfilingHandler: true enableServer: true enableSystemLogHandler: true +enableSystemLogQuery: false enforceNodeAllocatable: - pods eventBurst: 10 diff --git a/pkg/kubelet/apis/config/types.go b/pkg/kubelet/apis/config/types.go index 059c20f6050..91e3b9ba5e9 100644 --- a/pkg/kubelet/apis/config/types.go +++ b/pkg/kubelet/apis/config/types.go @@ -393,6 +393,11 @@ type KubeletConfiguration struct { Logging logsapi.LoggingConfiguration // EnableSystemLogHandler enables /logs handler. EnableSystemLogHandler bool + // EnableSystemLogQuery enables the node log query feature on the /logs endpoint. + // EnableSystemLogHandler has to be enabled in addition for this feature to work. + // +featureGate=NodeLogQuery + // +optional + EnableSystemLogQuery bool // ShutdownGracePeriod specifies the total duration that the node should delay the shutdown and total grace period for pod termination during a node shutdown. // Defaults to 0 seconds. // +featureGate=GracefulNodeShutdown diff --git a/pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go b/pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go index 6d8162dbdbe..5376913670c 100644 --- a/pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go +++ b/pkg/kubelet/apis/config/v1beta1/zz_generated.conversion.go @@ -491,6 +491,9 @@ func autoConvert_v1beta1_KubeletConfiguration_To_config_KubeletConfiguration(in if err := v1.Convert_Pointer_bool_To_bool(&in.EnableSystemLogHandler, &out.EnableSystemLogHandler, s); err != nil { return err } + if err := v1.Convert_Pointer_bool_To_bool(&in.EnableSystemLogQuery, &out.EnableSystemLogQuery, s); err != nil { + return err + } out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods out.ShutdownGracePeriodByPodPriority = *(*[]config.ShutdownGracePeriodByPodPriority)(unsafe.Pointer(&in.ShutdownGracePeriodByPodPriority)) @@ -673,6 +676,9 @@ func autoConvert_config_KubeletConfiguration_To_v1beta1_KubeletConfiguration(in if err := v1.Convert_bool_To_Pointer_bool(&in.EnableSystemLogHandler, &out.EnableSystemLogHandler, s); err != nil { return err } + if err := v1.Convert_bool_To_Pointer_bool(&in.EnableSystemLogQuery, &out.EnableSystemLogQuery, s); err != nil { + return err + } out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods out.ShutdownGracePeriodByPodPriority = *(*[]v1beta1.ShutdownGracePeriodByPodPriority)(unsafe.Pointer(&in.ShutdownGracePeriodByPodPriority)) diff --git a/staging/src/k8s.io/kubelet/config/v1beta1/types.go b/staging/src/k8s.io/kubelet/config/v1beta1/types.go index 5822cb3f924..4fbafa8c395 100644 --- a/staging/src/k8s.io/kubelet/config/v1beta1/types.go +++ b/staging/src/k8s.io/kubelet/config/v1beta1/types.go @@ -692,6 +692,12 @@ type KubeletConfiguration struct { // Default: true // +optional EnableSystemLogHandler *bool `json:"enableSystemLogHandler,omitempty"` + // enableSystemLogQuery enables the node log query feature on the /logs endpoint. + // EnableSystemLogHandler has to be enabled in addition for this feature to work. + // Default: false + // +featureGate=NodeLogQuery + // +optional + EnableSystemLogQuery *bool `json:"enableSystemLogQuery,omitempty"` // shutdownGracePeriod specifies the total duration that the node should delay the // shutdown and total grace period for pod termination during a node shutdown. // Default: "0s" diff --git a/staging/src/k8s.io/kubelet/config/v1beta1/zz_generated.deepcopy.go b/staging/src/k8s.io/kubelet/config/v1beta1/zz_generated.deepcopy.go index f5b2819e61f..85e564e3ea9 100644 --- a/staging/src/k8s.io/kubelet/config/v1beta1/zz_generated.deepcopy.go +++ b/staging/src/k8s.io/kubelet/config/v1beta1/zz_generated.deepcopy.go @@ -413,6 +413,11 @@ func (in *KubeletConfiguration) DeepCopyInto(out *KubeletConfiguration) { *out = new(bool) **out = **in } + if in.EnableSystemLogQuery != nil { + in, out := &in.EnableSystemLogQuery, &out.EnableSystemLogQuery + *out = new(bool) + **out = **in + } out.ShutdownGracePeriod = in.ShutdownGracePeriod out.ShutdownGracePeriodCriticalPods = in.ShutdownGracePeriodCriticalPods if in.ShutdownGracePeriodByPodPriority != nil {