kubernetes/0008-Kubelet-server-handler-cleanup.patch
liuxu d958dcc6a9 fix CVE-2025-0426
Signed-off-by: liuxu <liuxu156@huawei.com>
2025-03-04 06:50:11 +08:00

53 lines
1.9 KiB
Diff

From ce40efb4ef6efddc12e371a688687aa818d1ee53 Mon Sep 17 00:00:00 2001
From: Tim Allclair <tallclair@google.com>
Date: Tue, 21 Jan 2025 16:31:52 -0800
Subject: [PATCH] Kubelet server handler cleanup
---
pkg/kubelet/server/server.go | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/pkg/kubelet/server/server.go b/pkg/kubelet/server/server.go
index 87a017f9ccc..483faa60f4f 100644
--- a/pkg/kubelet/server/server.go
+++ b/pkg/kubelet/server/server.go
@@ -443,17 +443,6 @@ func (s *Server) InstallDefaultHandlers() {
s.restfulCont.Handle(proberMetricsPath,
compbasemetrics.HandlerFor(p, compbasemetrics.HandlerOpts{ErrorHandling: compbasemetrics.ContinueOnError}),
)
-
- // Only enable checkpoint API if the feature is enabled
- if utilfeature.DefaultFeatureGate.Enabled(features.ContainerCheckpoint) {
- s.addMetricsBucketMatcher("checkpoint")
- ws = &restful.WebService{}
- ws.Path("/checkpoint").Produces(restful.MIME_JSON)
- ws.Route(ws.POST("/{podNamespace}/{podID}/{containerName}").
- To(s.checkpoint).
- Operation("checkpoint"))
- s.restfulCont.Add(ws)
- }
}
// InstallDebuggingHandlers registers the HTTP request patterns that serve logs or run commands/containers
@@ -548,6 +537,17 @@ func (s *Server) InstallDebuggingHandlers() {
To(s.getRunningPods).
Operation("getRunningPods"))
s.restfulCont.Add(ws)
+
+ // Only enable checkpoint API if the feature is enabled
+ if utilfeature.DefaultFeatureGate.Enabled(features.ContainerCheckpoint) {
+ s.addMetricsBucketMatcher("checkpoint")
+ ws = &restful.WebService{}
+ ws.Path("/checkpoint").Produces(restful.MIME_JSON)
+ ws.Route(ws.POST("/{podNamespace}/{podID}/{containerName}").
+ To(s.checkpoint).
+ Operation("checkpoint"))
+ s.restfulCont.Add(ws)
+ }
}
// InstallDebuggingDisabledHandlers registers the HTTP request patterns that provide better error message
--
2.34.1