Skip to content

LOG-10201: run log-file-metric-exporter directly without a bash shell wrapper - #3481

Open
jcantrill wants to merge 1 commit into
openshift:masterfrom
jcantrill:lfme-run-without-bash-LOG-10201
Open

jcantrill wants to merge 1 commit into
openshift:masterfrom
jcantrill:lfme-run-without-bash-LOG-10201

Conversation

@jcantrill

@jcantrill jcantrill commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

What

The LogFileMetricExporter (LFME) DaemonSet container was started via a bash wrapper:

command: ["/bin/bash"]
args: ["-c", "/usr/local/bin/log-file-metric-exporter -verbosity=2 ..."]

This requires bash to be present in the LFME image and inserts a shell into the process tree (bash runs as PID 1, the exporter as a child).

This change sets the container command to the exporter binary directly, with each flag as a discrete arg (no shell interpolation was relied upon):

command: ["/usr/local/bin/log-file-metric-exporter"]
args: ["-verbosity=2", "-dir=/var/log/pods", ...]

Why

  • Removes the runtime dependency on bash, enabling a smaller/hardened base image (e.g. ubi-micro) and reducing attack surface.
  • The exporter runs as PID 1, giving correct signal handling and termination semantics.

Testing

Verified on a cluster: the operator reconciles the DaemonSet to the direct-exec form; pods are Running with 0 restarts; PID 1 is the exporter binary (no bash); and the metrics endpoint returns HTTP 200 with data.

Jira

https://issues.redhat.com/browse/LOG-10201

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Updated how the log metrics exporter is launched while preserving its existing options and TLS configuration.

…0201)

The LogFileMetricExporter container was started via /bin/bash -c "<binary>
<args>", which requires bash in the image and inserts a shell as PID 1.

Set the container command to the exporter binary directly with each flag as
a discrete arg (no shell interpolation was relied upon). This removes the
runtime dependency on bash, enabling a smaller/hardened base image (e.g.
ubi-micro), and runs the exporter as PID 1 for correct signal handling.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Sep 24, 2026
@openshift-ci-robot

openshift-ci-robot commented Sep 24, 2026 •

Copy link
Copy Markdown

@jcantrill: This pull request references LOG-10201 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.8.0" version, but no target version was set.

Details

In response to this:

What

The LogFileMetricExporter (LFME) DaemonSet container was started via a bash wrapper:

command: ["/bin/bash"]
args: ["-c", "/usr/local/bin/log-file-metric-exporter -verbosity=2 ..."]

This requires bash to be present in the LFME image and inserts a shell into the process tree (bash runs as PID 1, the exporter as a child).

This change sets the container command to the exporter binary directly, with each flag as a discrete arg (no shell interpolation was relied upon):

command: ["/usr/local/bin/log-file-metric-exporter"]
args: ["-verbosity=2", "-dir=/var/log/pods", ...]

Why

  • Removes the runtime dependency on bash, enabling a smaller/hardened base image (e.g. ubi-micro) and reducing attack surface.
  • The exporter runs as PID 1, giving correct signal handling and termination semantics.

Testing

Verified on a cluster: the operator reconciles the DaemonSet to the direct-exec form; pods are Running with 0 restarts; PID 1 is the exporter binary (no bash); and the metrics endpoint returns HTTP 200 with data.

Jira

https://issues.redhat.com/browse/LOG-10201

🤖 Generated with Claude Code

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.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/cluster-logging-operator/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bce61e8e-8778-4476-9c70-94f8400d7291

📥 Commits

Reviewing files that changed from the base of the PR and between 903d6a6 and 37282e1.

📒 Files selected for processing (1)
  • internal/metrics/logfilemetricexporter/factory.go

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

The container now runs the log-file metrics exporter directly. It passes the existing options as separate arguments, including TLS settings derived from the supplied profile.

Changes

Exporter invocation

Layer / File(s) Summary
Configure direct exporter invocation
internal/metrics/logfilemetricexporter/factory.go
The container invokes the exporter binary directly instead of using /bin/bash -c. It passes the existing options as separate arguments.

Estimated code review effort: 2 (Simple) | ~8 minutes

Merge Risk: ⚪ Minimal · up to 37282

No actionable merge-blocking issue is established for this invocation change; it is mergeable subject to normal checks.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, rationale, implementation, testing, and Jira issue. It does not include the mandatory /cc reviewer assignment or /assign approver assignment, and it omits the temp… Add /cc with at least one reviewer from the top-level OWNERS file and /assign with at least one approver from the top-level OWNERS file. Include the required Links section entries, or mark them as not applicable.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: running the log-file-metric-exporter directly without a Bash wrapper.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, rationale, implementation, testing, and Jira issue. It does not include the mandatory /cc reviewer assignment or /assign approver assignment, and it omits the template's Links section structure.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

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

@jcantrill

Copy link
Copy Markdown
Contributor Author

cc @vparfonov

@openshift-ci

openshift-ci Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jcantrill

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 Sep 24, 2026
@openshift-ci

openshift-ci Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

@jcantrill: The following tests 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/functional-target 37282e1 link true /test functional-target
ci/prow/e2e-using-bundle 37282e1 link true /test e2e-using-bundle

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.

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. release/6.7

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants