Skip to content

NO-ISSUE: Allow setting kubeletconfig log level to zero#5757

Open
ngopalak-redhat wants to merge 1 commit intoopenshift:mainfrom
ngopalak-redhat:ngopalak/allow_zero
Open

NO-ISSUE: Allow setting kubeletconfig log level to zero#5757
ngopalak-redhat wants to merge 1 commit intoopenshift:mainfrom
ngopalak-redhat:ngopalak/allow_zero

Conversation

@ngopalak-redhat
Copy link
Contributor

@ngopalak-redhat ngopalak-redhat commented Mar 11, 2026

- What I did
While working on https://github.com/openshift/api/pull/2651/changes#r2895572721, its identified that 0 is a valid value for log level.
Currently setting it to zero gives the error:

    Last Transition Time:  2026-03-11T02:37:49Z
    Message:               Error: KubeletConfig's LogLevel is not valid [1,10]: 0xc0008b95cc
    Status:                True
    Type:                  Failure

There are 2 issues:

  • The zero value is rejected
  • The error message shows pointer address instead of value: 0xc0008b95cc

Also the documentation already lists zero as valid value: https://docs.redhat.com/en/documentation/openshift_container_platform/4.21/html/api_overview/editing-kubelet-log-level-verbosity

The fix just includes zero in the validation code and fixes the error message.

- How to verify it

  • Added unit test
  • Verified it with the source code of kubernetes

- Description for the changelog

Summary by CodeRabbit

  • Bug Fixes

    • Updated kubelet configuration LogLevel validation to accept 0 as a valid value; valid range is now 0-10 (previously 1-10).
    • Improved error messages for invalid LogLevel values to clearly display the valid range.
  • Tests

    • Added comprehensive test coverage for LogLevel validation scenarios.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 11, 2026
@openshift-ci-robot
Copy link
Contributor

@ngopalak-redhat: This pull request explicitly references no jira issue.

Details

In response to this:

- What I did
While working on https://github.com/openshift/api/pull/2651/changes#r2895572721, its identified that 0 is a valid value for log level.
Currently setting it to zero gives the error:

   Last Transition Time:  2026-03-11T02:37:49Z
   Message:               Error: KubeletConfig's LogLevel is not valid [1,10]: 0xc0008b95cc
   Status:                True
   Type:                  Failure

There are 2 issues:

  • The zero value is rejected
  • The error message shows pointer address instead of value: 0xc0008b95cc

Also the documentation already lists zero as valid value: https://docs.redhat.com/en/documentation/openshift_container_platform/4.21/html/api_overview/editing-kubelet-log-level-verbosity

The fix just includes zero in the validation code and fixes the error message.

- How to verify it

  • Added unit test
  • Verified it with the source code of kubernetes

- Description for the changelog

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from cheesesashimi and djoshy March 11, 2026 03:15
@coderabbitai
Copy link

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c189f7f0-d1f9-462e-a3c0-80854a6a21fe

📥 Commits

Reviewing files that changed from the base of the PR and between 3c7a1fc and 63d1f54.

📒 Files selected for processing (2)
  • pkg/controller/kubelet-config/helpers.go
  • pkg/controller/kubelet-config/kubelet_config_controller_test.go

Walkthrough

The changes adjust KubeletConfig.LogLevel validation threshold from [1,10] to [0,10], allowing 0 as a valid value. Error formatting is updated to use %d instead of %v, and the error message reflects the new valid range. Comprehensive test coverage is added to verify validation behavior for valid and invalid values.

Changes

Cohort / File(s) Summary
KubeletConfig LogLevel Validation
pkg/controller/kubelet-config/helpers.go
Adjusts validation threshold for LogLevel from [1,10] to [0,10]. Updates error formatting from %v to %d and error message to reflect new range [0,10].
LogLevel Validation Tests
pkg/controller/kubelet-config/kubelet_config_controller_test.go
Adds TestKubeletConfigLogLevel function with test cases for valid values (0, 2, 10, nil) and invalid values (-1, 11). Includes error message assertion and imports strings package.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adjusting KubeletConfig.LogLevel validation to accept zero as a valid value.
Stable And Deterministic Test Names ✅ Passed PR uses standard Go testing with t.Run() rather than Ginkgo. Test names are static and deterministic with no dynamic values.
Test Structure And Quality ✅ Passed The custom check is designed for Ginkgo test code, but this PR adds standard Go unit tests using the built-in testing package and t.Run() patterns, which are not applicable to this check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.5.0)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Comment @coderabbitai help to get the list of available commands and usage tips.

@bitoku
Copy link
Contributor

bitoku commented Mar 11, 2026

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 11, 2026
@ngopalak-redhat
Copy link
Contributor Author

cc: @haircommander

/assign @isabella-janssen

@ngopalak-redhat
Copy link
Contributor Author

/verified by ci

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 12, 2026
@openshift-ci-robot
Copy link
Contributor

@ngopalak-redhat: This PR has been marked as verified by ci.

Details

In response to this:

/verified by ci

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 openshift-eng/jira-lifecycle-plugin repository.

Copy link
Member

@isabella-janssen isabella-janssen left a comment

Choose a reason for hiding this comment

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

/lgtm

Change looks good & the need mades sense based on the linked API conversation and docs. The new units for this are also passing, so this should be good to go. Thank you @ngopalak-redhat

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 12, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bitoku, isabella-janssen, ngopalak-redhat

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

The pull request process is described here

Details 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 Mar 12, 2026
@ngopalak-redhat
Copy link
Contributor Author

/retest-required

1 similar comment
@isabella-janssen
Copy link
Member

/retest-required

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 13, 2026

@ngopalak-redhat: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-op-ocl-part1 63d1f54 link false /test e2e-gcp-op-ocl-part1

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@isabella-janssen
Copy link
Member

/override ci/prow/e2e-hypershift

This change should have no impact on Hypershift & the test is generally not doing well, so I am going to override it.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 13, 2026

@isabella-janssen: Overrode contexts on behalf of isabella-janssen: ci/prow/e2e-hypershift

Details

In response to this:

/override ci/prow/e2e-hypershift

This change should have no impact on Hypershift & the test is generally not doing well, so I am going to override it.

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.

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. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants