Skip to content

MG-182: add since and sinceTime fields in the MG CR and CRD#323

Open
praveencodes wants to merge 4 commits intoopenshift:masterfrom
praveencodes:MG-182
Open

MG-182: add since and sinceTime fields in the MG CR and CRD#323
praveencodes wants to merge 4 commits intoopenshift:masterfrom
praveencodes:MG-182

Conversation

@praveencodes
Copy link
Contributor

@praveencodes praveencodes commented Feb 2, 2026

MG-182: since and sinceTime are introduced in the gatherSpec inside MustGather spec to reduce the time taken to collect the Mustgather logs thus reducing the size.

Note: The --since and --sinceTime flags are already available in the CLI oc adm mustgather. We are introducing these fields in the must gather operator now.

Summary by CodeRabbit

  • New Features

    • Time-based log collection filters added: since (duration) and sinceTime (timestamp); values are clamped relative to cluster creation when available. Jobs still created if cluster creation time can't be determined.
  • Validation

    • Stronger spec validation: command/args disallowed unless imageStreamRef is set; only one of since or sinceTime may be specified.
  • Documentation

    • Spec docs and CRD schema updated; new examples demonstrating since/sinceTime.
  • Tests

    • Expanded tests for time filters, clamping, proxy/audit behavior, and CA mount handling.
  • Chores

    • ClusterRole updated to allow watch on cluster version.

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

openshift-ci-robot commented Feb 2, 2026

@praveencodes: This pull request references MG-182 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

MG-182: since and sinceTime are introduced in the gatherSpec inside MustGather spec to reduce the time taken to collect the Mustgather logs thus reducing the size.

Note: The --since and --sinceTime flags are already available in the CLI oc adm mustgather. We are introducing these fields in the must gather operator now.

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
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

Adds optional time-based log collection filters to GatherSpec (Since, SinceTime) with mutual-exclusion validation; controller best-effort fetches ClusterVersion creation time and forwards it to template logic, which builds/clamps a time filter and injects gatherEnvSince/gatherEnvSinceTime into the gather container.

Changes

Cohort / File(s) Summary
Type Definitions & CRD
api/v1alpha1/mustgather_types.go, deploy/crds/operator.openshift.io_mustgathers.yaml
Added Since (metav1.Duration) and SinceTime (metav1.Time) to GatherSpec, XValidation to forbid both, updated docs and CRD validations; refined validation for gatherSpec.command/args to require imageStreamRef when present/non-empty.
Controller Logic
controllers/mustgather/mustgather_controller.go
Added getClusterCreationTime helper to read ClusterVersion "version" CreationTimestamp; getJobFromInstance best-effort fetches and forwards clusterCreationTime to getJobTemplate without blocking on failure.
Template Generation
controllers/mustgather/template.go
Introduced GatherTimeFilter and testable timeNow; updated getJobTemplate and getGatherContainer signatures to accept clusterCreationTime and timeFilter; build and clamp time filters and inject gatherEnvSince/gatherEnvSinceTime env vars into the gather container.
Tests
controllers/mustgather/template_test.go
Expanded tests to cover Since/SinceTime scenarios, deterministic timeNow, clamping behavior relative to cluster creation, CA configmap mounts, proxy/audit interactions; added helpers to find containers and env values.
Examples
examples/mustgather_with_since.yaml, examples/mustgather_with_sincetime.yaml
Added example manifests demonstrating since: 10m and sinceTime: <RFC3339> usage with SFTP upload configuration.
RBAC
deploy/02_must-gather-operator.ClusterRole.yaml
Added watch verb to clusterversions rules in ClusterRole.

Sequence Diagram(s)

sequenceDiagram
    participant Controller as Controller\n(getJobFromInstance)
    participant APIServer as API Server\n(ClusterVersion)
    participant Template as Template\n(getJobTemplate)
    participant Container as Gather Container\n(getGatherContainer)

    Controller->>APIServer: GET ClusterVersion "version"
    APIServer-->>Controller: CreationTimestamp or error
    Controller->>Template: getJobTemplate(..., clusterCreationTime)
    Template->>Template: Build GatherTimeFilter from Since/SinceTime
    Template->>Container: getGatherContainer(timeFilter, clusterCreationTime)
    Container->>Container: Clamp Since to cluster age\nClamp SinceTime not before cluster creation
    Container-->>Controller: Return Job with envs set (gatherEnvSince/gatherEnvSinceTime)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% 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 directly and specifically describes the main change: adding since and sinceTime fields to the MustGather CR and CRD, which aligns with the core purpose of the PR.
Stable And Deterministic Test Names ✅ Passed All test names are static, descriptive strings without dynamic content such as generated IDs, timestamps, pod names, or IP addresses.
Test Structure And Quality ✅ Passed Test file demonstrates excellent quality: table-driven patterns with single responsibility, proper setup/cleanup via t.Cleanup(), comprehensive assertion messages, no indefinite waits, and consistent Go testing patterns.

✏️ 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

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 2, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: praveencodes
Once this PR has been reviewed and has the lgtm label, please assign smarthall for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 10, 2026
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 23, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 23, 2026

@praveencodes: This pull request references MG-182 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

MG-182: since and sinceTime are introduced in the gatherSpec inside MustGather spec to reduce the time taken to collect the Mustgather logs thus reducing the size.

Note: The --since and --sinceTime flags are already available in the CLI oc adm mustgather. We are introducing these fields in the must gather operator now.

Summary by CodeRabbit

  • New Features

  • Added time-based log collection filtering with since (duration) and sinceTime (timestamp) options in MustGatherSpec.

  • Enforced mutual exclusivity validation: only one time filter may be specified.

  • Documentation

  • Added example configurations demonstrating since and sinceTime usage.

  • Tests

  • Expanded test coverage for time-filtering and clamping behaviors.

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@controllers/mustgather/template_test.go`:
- Around line 549-567: The test panics because tt.audit can be nil and the
MustGatherTimeout field is not wired; update the MustGather creation (mg :=
MustGather{...}) so GatherSpec.Audit is set safely (e.g., assign Audit: tt.audit
or use a conditional to copy *tt.audit only when tt.audit != nil) to avoid
dereferencing nil, and add Spec.MustGatherTimeout = tt.wantTimeout (or set from
tt.wantTimeout) so the test's expected timeout is populated; locate and change
the MustGather construction in template_test.go (mg, Spec, GatherSpec,
UploadTarget) to apply these fixes.

In `@examples/mustgather_with_since.yaml`:
- Around line 5-10: The example places the audit field at the top-level under
spec where it won't be applied; move the audit boolean into the gatherSpec
object so it matches the API (i.e., under gatherSpec alongside since). Update
the YAML so gatherSpec contains both since: 10m and audit: false (preserve
spacing/indentation and keep serviceAccountName at the same spec level).

In `@examples/mustgather_with_sincetime.yaml`:
- Around line 5-10: The example places the audit field at the top level under
spec instead of inside gatherSpec; move the audit: false entry into the
gatherSpec mapping (so spec.gatherSpec.audit: false) to match the API contract
and ensure it is applied by the controller (leave other keys like sinceTime and
serviceAccountName unchanged).

Comment on lines +5 to +10
spec:
# Only collect logs from the last 10 minutes (reduces output size significantly)
gatherSpec:
since: 10m
audit: false
serviceAccountName: must-gather-admin
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Move audit under gatherSpec to match the API.

At the current level, audit won’t be applied (and may be pruned), so the example is misleading.

✅ Proposed fix
 spec:
   # Only collect logs from the last 10 minutes (reduces output size significantly)
   gatherSpec:
     since: 10m
-  audit: false
+    audit: false
   serviceAccountName: must-gather-admin
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/mustgather_with_since.yaml` around lines 5 - 10, The example places
the audit field at the top-level under spec where it won't be applied; move the
audit boolean into the gatherSpec object so it matches the API (i.e., under
gatherSpec alongside since). Update the YAML so gatherSpec contains both since:
10m and audit: false (preserve spacing/indentation and keep serviceAccountName
at the same spec level).

Comment on lines +5 to +10
spec:
gatherSpec:
sinceTime: "2026-02-02T00:00:00Z"
audit: false
serviceAccountName: must-gather-admin
uploadTarget:
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Move audit under gatherSpec to match the API.

This example currently places audit at the wrong level, so it won’t be applied.

✅ Proposed fix
 spec: 
   gatherSpec:
     sinceTime: "2026-02-02T00:00:00Z"
-  audit: false
+    audit: false
   serviceAccountName: must-gather-admin
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
spec:
gatherSpec:
sinceTime: "2026-02-02T00:00:00Z"
audit: false
serviceAccountName: must-gather-admin
uploadTarget:
spec:
gatherSpec:
sinceTime: "2026-02-02T00:00:00Z"
audit: false
serviceAccountName: must-gather-admin
uploadTarget:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/mustgather_with_sincetime.yaml` around lines 5 - 10, The example
places the audit field at the top level under spec instead of inside gatherSpec;
move the audit: false entry into the gatherSpec mapping (so
spec.gatherSpec.audit: false) to match the API contract and ensure it is applied
by the controller (leave other keys like sinceTime and serviceAccountName
unchanged).

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 23, 2026

@praveencodes: This pull request references MG-182 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

MG-182: since and sinceTime are introduced in the gatherSpec inside MustGather spec to reduce the time taken to collect the Mustgather logs thus reducing the size.

Note: The --since and --sinceTime flags are already available in the CLI oc adm mustgather. We are introducing these fields in the must gather operator now.

Summary by CodeRabbit

  • New Features

  • Time-based log collection filters added: since (duration) and sinceTime (timestamp); clamped relative to cluster creation when available.

  • Controller continues to create jobs if cluster creation time cannot be determined.

  • Documentation

  • Updated MustGatherSpec docs and added examples demonstrating since and sinceTime.

  • Tests

  • Expanded tests for time-filtering, clamping behavior, proxy/audit cases, and CA mount handling.

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
controllers/mustgather/template_test.go (1)

278-303: Consider using explicit expected values instead of name-based branching.

The assertions branch on tt.name string comparison, which is fragile—if a test name changes, the wrong assertion branch could execute silently. Consider adding explicit expected fields (e.g., wantSinceEnv, wantSinceTimeEnv, expectSinceOmitted bool) to the test struct for clearer intent and safer refactoring.

♻️ Example refactor
 	tests := []struct {
 		name            string
 		// ... existing fields ...
 		timeFilter      *GatherTimeFilter
 		clusterCreation *time.Time
+		wantSinceEnv      string // expected MUST_GATHER_SINCE value, empty means not set
+		wantSinceTimeEnv  string // expected MUST_GATHER_SINCE_TIME value, empty means not set
+		expectSinceOmitted bool  // true if MUST_GATHER_SINCE should be absent
 	}{

Then assertions become:

if tt.expectSinceOmitted {
    if _, ok := envMap[gatherEnvSince]; ok {
        t.Fatalf("did not expect %s env var", gatherEnvSince)
    }
} else if tt.wantSinceEnv != "" {
    if envMap[gatherEnvSince] != tt.wantSinceEnv {
        t.Fatalf("expected %s=%s, got %s", gatherEnvSince, tt.wantSinceEnv, envMap[gatherEnvSince])
    }
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@controllers/mustgather/template_test.go` around lines 278 - 303, The test
branches on tt.name which is fragile; modify the test case struct (used in
template_test.go) to include explicit expectation fields like wantSinceEnv
string, wantSinceTimeEnv string, and expectSinceOmitted bool, then replace the
name-based conditional logic around envValues(container)/envMap assertions
(currently referencing tt.timeFilter, gatherEnvSince, gatherEnvSinceTime) to
check these new fields: if expectSinceOmitted ensure gatherEnvSince is absent,
else if wantSinceEnv != "" assert envMap[gatherEnvSince] == wantSinceEnv;
similarly assert wantSinceTimeEnv against envMap[gatherEnvSinceTime] when
non-empty. Update each test case entry to populate these new expectation fields
instead of relying on tt.name.
ℹ️ Review info

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

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 917cf0a and 11b6d59.

📒 Files selected for processing (2)
  • controllers/mustgather/template_test.go
  • deploy/crds/operator.openshift.io_mustgathers.yaml
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@controllers/mustgather/template_test.go`:
- Around line 278-303: The test branches on tt.name which is fragile; modify the
test case struct (used in template_test.go) to include explicit expectation
fields like wantSinceEnv string, wantSinceTimeEnv string, and expectSinceOmitted
bool, then replace the name-based conditional logic around
envValues(container)/envMap assertions (currently referencing tt.timeFilter,
gatherEnvSince, gatherEnvSinceTime) to check these new fields: if
expectSinceOmitted ensure gatherEnvSince is absent, else if wantSinceEnv != ""
assert envMap[gatherEnvSince] == wantSinceEnv; similarly assert wantSinceTimeEnv
against envMap[gatherEnvSinceTime] when non-empty. Update each test case entry
to populate these new expectation fields instead of relying on tt.name.

@praveencodes praveencodes marked this pull request as ready for review February 23, 2026 07:59
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 23, 2026
@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.13%. Comparing base (2ba0426) to head (b3023b1).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #323      +/-   ##
==========================================
+ Coverage   58.56%   63.13%   +4.57%     
==========================================
  Files           8        8              
  Lines         806      849      +43     
==========================================
+ Hits          472      536      +64     
+ Misses        322      306      -16     
+ Partials       12        7       -5     
Files with missing lines Coverage Δ
api/v1alpha1/mustgather_types.go 100.00% <ø> (ø)
controllers/mustgather/mustgather_controller.go 60.54% <100.00%> (+1.22%) ⬆️
controllers/mustgather/template.go 100.00% <100.00%> (+10.29%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Feb 24, 2026

@praveencodes: This pull request references MG-182 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

MG-182: since and sinceTime are introduced in the gatherSpec inside MustGather spec to reduce the time taken to collect the Mustgather logs thus reducing the size.

Note: The --since and --sinceTime flags are already available in the CLI oc adm mustgather. We are introducing these fields in the must gather operator now.

Summary by CodeRabbit

  • New Features

  • Time-based log collection filters added: since (duration) and sinceTime (timestamp); values are clamped relative to cluster creation when available.

  • Jobs continue to be created even if cluster creation time can't be determined.

  • Validation

  • Stronger spec validation: command/args now disallowed unless imageStreamRef is set; only one of since or sinceTime may be specified.

  • Documentation

  • MustGatherSpec docs and CRD schema updated; new examples demonstrating since/sinceTime.

  • Tests

  • Expanded tests for time-filtering, clamping, proxy/audit behavior, and CA mount handling.

  • Chores

  • Cluster role updated to allow watch on cluster version.

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@api/v1alpha1/mustgather_types.go`:
- Around line 40-44: Update the Go doc comment above the GatherSpec field in
mustgather_types.go: remove the inaccurate sentence "This field is ignored if
ImageStreamRef is not specified" and replace it with a precise description
noting that while command/args from GatherSpec are only applied when
ImageStreamRef is provided, time-based filters (since and sinceTime) are
applicable even without ImageStreamRef; reference the GatherSpec field,
ImageStreamRef, and the since/sinceTime filters in the comment so the generated
CRD correctly documents the behavior.

In `@deploy/crds/operator.openshift.io_mustgathers.yaml`:
- Around line 44-46: The gatherSpec description incorrectly states the whole
field is ignored without ImageStreamRef; update the doc text for gatherSpec to
clarify that only command and args are ignored when ImageStreamRef is not
specified, while time-based filters (since and sinceTime) remain honored;
reference the gatherSpec, ImageStreamRef, command, args, since and sinceTime
symbols so the maintainer changes the descriptive block accordingly to reflect
current validation.

ℹ️ Review info

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

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 11b6d59 and 2861904.

📒 Files selected for processing (5)
  • api/v1alpha1/mustgather_types.go
  • deploy/02_must-gather-operator.ClusterRole.yaml
  • deploy/crds/operator.openshift.io_mustgathers.yaml
  • examples/mustgather_with_since.yaml
  • examples/mustgather_with_sincetime.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • examples/mustgather_with_sincetime.yaml

Comment on lines +40 to 44
// GatherSpec allows overriding the command and/or arguments for the custom must-gather image
// and configures time-based collection filters.
// This field is ignored if ImageStreamRef is not specified.
// +kubebuilder:validation:Optional
GatherSpec *GatherSpec `json:"gatherSpec,omitempty"`
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Root cause of the misleading description — update the Go doc comment.

Same issue as in the CRD: line 42 states "This field is ignored if ImageStreamRef is not specified," which is no longer accurate since since/sinceTime are usable without imageStreamRef. The CRD is generated from these markers, so the fix belongs here.

Proposed fix
-	// GatherSpec allows overriding the command and/or arguments for the custom must-gather image
-	// and configures time-based collection filters.
-	// This field is ignored if ImageStreamRef is not specified.
+	// GatherSpec allows overriding the command and/or arguments for the custom must-gather image
+	// and configures time-based collection filters.
+	// The command and args fields are only honored when ImageStreamRef is specified.
+	// Time-based filters (since, sinceTime) apply regardless of ImageStreamRef.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/v1alpha1/mustgather_types.go` around lines 40 - 44, Update the Go doc
comment above the GatherSpec field in mustgather_types.go: remove the inaccurate
sentence "This field is ignored if ImageStreamRef is not specified" and replace
it with a precise description noting that while command/args from GatherSpec are
only applied when ImageStreamRef is provided, time-based filters (since and
sinceTime) are applicable even without ImageStreamRef; reference the GatherSpec
field, ImageStreamRef, and the since/sinceTime filters in the comment so the
generated CRD correctly documents the behavior.

Comment on lines +44 to 46
GatherSpec allows overriding the command and/or arguments for the custom must-gather image
and configures time-based collection filters.
This field is ignored if ImageStreamRef is not specified.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

gatherSpec description is now misleading — since/sinceTime should work without imageStreamRef.

Line 46 says "This field is ignored if ImageStreamRef is not specified," but that's no longer true. The since and sinceTime sub-fields are not gated behind imageStreamRef (only command/args are, per the validation on lines 234–236). A user reading this description may think time filtering requires a custom image.

Consider updating to something like:

Proposed fix
                description: |-
                  GatherSpec allows overriding the command and/or arguments for the custom must-gather image
                  and configures time-based collection filters.
-                 This field is ignored if ImageStreamRef is not specified.
+                 The command and args fields are only honored when ImageStreamRef is specified.
+                 Time-based filters (since, sinceTime) apply regardless of ImageStreamRef.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
GatherSpec allows overriding the command and/or arguments for the custom must-gather image
and configures time-based collection filters.
This field is ignored if ImageStreamRef is not specified.
GatherSpec allows overriding the command and/or arguments for the custom must-gather image
and configures time-based collection filters.
The command and args fields are only honored when ImageStreamRef is specified.
Time-based filters (since, sinceTime) apply regardless of ImageStreamRef.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy/crds/operator.openshift.io_mustgathers.yaml` around lines 44 - 46, The
gatherSpec description incorrectly states the whole field is ignored without
ImageStreamRef; update the doc text for gatherSpec to clarify that only command
and args are ignored when ImageStreamRef is not specified, while time-based
filters (since and sinceTime) remain honored; reference the gatherSpec,
ImageStreamRef, command, args, since and sinceTime symbols so the maintainer
changes the descriptive block accordingly to reflect current validation.

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 4, 2026

@praveencodes: This pull request references MG-182 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 story to target the "4.22.0" version, but no target version was set.

Details

In response to this:

MG-182: since and sinceTime are introduced in the gatherSpec inside MustGather spec to reduce the time taken to collect the Mustgather logs thus reducing the size.

Note: The --since and --sinceTime flags are already available in the CLI oc adm mustgather. We are introducing these fields in the must gather operator now.

Summary by CodeRabbit

  • New Features

  • Time-based log collection filters added: since (duration) and sinceTime (timestamp); values are clamped relative to cluster creation when available. Jobs still created if cluster creation time can't be determined.

  • Validation

  • Stronger spec validation: command/args disallowed unless imageStreamRef is set; only one of since or sinceTime may be specified.

  • Documentation

  • Spec docs and CRD schema updated; new examples demonstrating since/sinceTime.

  • Tests

  • Expanded tests for time filters, clamping, proxy/audit behavior, and CA mount handling.

  • Chores

  • ClusterRole updated to allow watch on cluster version.

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
deploy/crds/operator.openshift.io_mustgathers.yaml (1)

44-46: ⚠️ Potential issue | 🟡 Minor

Clarify gatherSpec docs: only command/args are gated by imageStreamRef.

Line 46 still implies all of gatherSpec is ignored without imageStreamRef, which is not true for since/sinceTime.

Proposed doc fix
                 description: |-
                   GatherSpec allows overriding the command and/or arguments for the custom must-gather image
                   and configures time-based collection filters.
-                  This field is ignored if ImageStreamRef is not specified.
+                  The command and args fields are only honored when ImageStreamRef is specified.
+                  Time-based filters (since, sinceTime) apply regardless of ImageStreamRef.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@deploy/crds/operator.openshift.io_mustgathers.yaml` around lines 44 - 46, The
gatherSpec documentation incorrectly states the entire field is ignored if
ImageStreamRef is not specified; update the text for gatherSpec to clarify that
only the custom image overrides (command and args) are ignored when
ImageStreamRef is not provided, while time-based filters (since and sinceTime)
still apply; reference the gatherSpec object and the ImageStreamRef field and
explicitly mention the command, args, since, and sinceTime properties in the
revised sentence so readers know which parts are gated by ImageStreamRef and
which are independent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@deploy/crds/operator.openshift.io_mustgathers.yaml`:
- Around line 44-46: The gatherSpec documentation incorrectly states the entire
field is ignored if ImageStreamRef is not specified; update the text for
gatherSpec to clarify that only the custom image overrides (command and args)
are ignored when ImageStreamRef is not provided, while time-based filters (since
and sinceTime) still apply; reference the gatherSpec object and the
ImageStreamRef field and explicitly mention the command, args, since, and
sinceTime properties in the revised sentence so readers know which parts are
gated by ImageStreamRef and which are independent.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Pro

Run ID: e7bde281-a126-45bf-9f75-e93aa3220f64

📥 Commits

Reviewing files that changed from the base of the PR and between 2861904 and b3023b1.

⛔ Files ignored due to path filters (1)
  • api/v1alpha1/zz_generated.deepcopy.go is excluded by !**/zz_generated*
📒 Files selected for processing (1)
  • deploy/crds/operator.openshift.io_mustgathers.yaml

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 4, 2026

@praveencodes: 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/e2e-gcp-operator b3023b1 link true /test e2e-gcp-operator
ci/prow/validate-boilerplate b3023b1 link false /test validate-boilerplate

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

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants