kubelet: reject empty log path in container log Clean()#138379
kubelet: reject empty log path in container log Clean()#138379gregkh wants to merge 1 commit intokubernetes:masterfrom
Conversation
The Clean() method in containerLogManager constructs a glob pattern
directly from the LogPath returned by the CRI runtime's ContainerStatus
response. If the runtime returns an empty LogPath (the protobuf default
for an unset string field, or as a result of a runtime bug or race
during container creation), the resulting pattern is "*", which matches
every file in the kubelet's working directory. Each match is then passed
to Remove() which would not be a good idea to have happen.
Reject an empty LogPath before constructing the glob pattern. The
sibling processContainer() path is naturally guarded by Stat("")
returning ENOENT before reaching rotateLog().
|
Please note that we're already in Code Freeze for the upcoming v1.36.0 release. Adding the milestone to this PR is strictly prohibited without proper approval. If this PR needs to be included in the v1.36.0 release:
We're also in Test Freeze for the Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Tue Apr 14 14:21:49 UTC 2026. |
|
|
|
Hi @gregkh. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: gregkh The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/triage accepted @gregkh Please, add unit test(s). |
|
/ok-to-test |
|
@gregkh: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
The Clean() method in containerLogManager constructs a glob pattern directly from the LogPath returned by the CRI runtime's ContainerStatus response. If the runtime returns an empty LogPath (the protobuf default for an unset string field, or as a result of a runtime bug or race during container creation), the resulting pattern is "*", which matches every file in the kubelet's working directory. Each match is then passed to Remove() which would not be a good idea to have happen.
Reject an empty LogPath before constructing the glob pattern. The sibling processContainer() path is naturally guarded by Stat("") returning ENOENT before reaching rotateLog().
/kind bug