Skip to content

Conversation

littlejawa
Copy link
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

This commit implements the ReopenContainerLog function. This fixes an issue where kata container logs could not be rotated.

This required duplicating part of the createContainerIO function, so I am moving this in its own subfunction for reuse.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Fix log rotation not working for containers running with the kata-containers runtime

@littlejawa littlejawa requested a review from fidencio as a code owner August 28, 2025 14:29
@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. labels Aug 28, 2025
@openshift-ci openshift-ci bot requested review from bitoku and klihub August 28, 2025 14:29
@bitoku
Copy link
Contributor

bitoku commented Aug 28, 2025

Thank you @littlejawa !
Can we have an integration test for it?

This commit implements the ReopenContainerLog function.
This fixes an issue where kata container logs could not be rotated.

This required duplicating part of the createContainerIO function, so I am moving
this in its own subfunction for reuse.

Signed-off-by: Julien Ropé <jrope@redhat.com>
Copy link

codecov bot commented Aug 28, 2025

Codecov Report

❌ Patch coverage is 0% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.07%. Comparing base (d79c6c6) to head (15233a7).
⚠️ Report is 15 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9433      +/-   ##
==========================================
- Coverage   67.15%   67.07%   -0.09%     
==========================================
  Files         202      202              
  Lines       27900    27945      +45     
==========================================
+ Hits        18737    18743       +6     
- Misses       7594     7633      +39     
  Partials     1569     1569              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@erwbgy
Copy link

erwbgy commented Aug 29, 2025

/retest

@littlejawa littlejawa requested a review from mrunalp as a code owner September 1, 2025 09:02
@littlejawa
Copy link
Contributor Author

Can we have an integration test for it?

Hey @bitoku -
I have added a test for log rotation.
Without the patch in this commit, this test passes for regular containers and fails for kata.
With the patch applied, the test passes for both runtimes.

This commit adds a test that simulates log rotation, making sure
that the log file can be re-opened and used as expected.

Signed-off-by: Julien Ropé <jrope@redhat.com>
Copy link
Contributor

@gkurz gkurz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an expert with the CRI-O code base but this change looks good to me AND it is really required by kata otherwise a long running kata guest could potentially saturate some storage in the host.

Copy link
Contributor

openshift-ci bot commented Sep 1, 2025

@gkurz: changing LGTM is restricted to collaborators

In response to this:

Not an expert with the CRI-O code base but this change looks good to me AND it is really required by kata otherwise a long running kata guest could potentially saturate some storage in the host.

Instructions 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.

@haircommander
Copy link
Member

/approve

LGTM, thanks!

Copy link
Contributor

openshift-ci bot commented Sep 2, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gkurz, haircommander, littlejawa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 2, 2025
Copy link
Contributor

@bitoku bitoku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 2, 2025
@openshift-merge-bot openshift-merge-bot bot merged commit 5a8a443 into cri-o:main Sep 2, 2025
74 of 76 checks passed
@littlejawa
Copy link
Contributor Author

Thanks @haircommander @bitoku!

Can this be backported to previous versions?
We'd need to get it on 1.31 and later

@haircommander
Copy link
Member

yup!

@littlejawa littlejawa deleted the kata_fix_logrotate branch September 4, 2025 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants