Skip to content

wip: Alow configuration of waitForPodsReady feature - #2140

Open
MaysaMacedo wants to merge 1 commit into
openshift:mainfrom
MaysaMacedo:wait-for-pods-ready-customization
Open

wip: Alow configuration of waitForPodsReady feature#2140
MaysaMacedo wants to merge 1 commit into
openshift:mainfrom
MaysaMacedo:wait-for-pods-ready-customization

Conversation

@MaysaMacedo

@MaysaMacedo MaysaMacedo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

To be defined:

  • Should we really allow customizing all fields?
  • Do we expect the minimum timeout value to be in seconds or minutes?
  • Should a global Default for the Feature be defined?
  • Will this feature really be enabled by default?

Summary by CodeRabbit

  • New Features

    • Added configurable gang scheduling admission settings for workloads, including timeout and recoveryTimeout behavior when pods fail to become ready.
    • Introduced optional requeuing controls, including configurable backoff parameters and the time reference used for requeuing.
  • Behavior Changes

    • Updated gang scheduling policy options and validation rules to reflect the new timeout-driven admission semantics, including updated generated admission configuration defaults.
  • Tests

    • Updated expected configuration outputs to match the new admission and requeuing settings.

@openshift-ci

openshift-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

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 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 Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Walkthrough

This PR adds by-workload gang scheduling timeout, recovery timeout, and requeuing configuration, removes the None policy option, updates the CRD schema, and maps the settings into generated WaitForPodsReady configuration.

Changes

Gang scheduling configuration

Layer / File(s) Summary
Configuration contracts and schema
pkg/apis/kueueoperator/v1/types.go, manifests/kueue.openshift.io_kueues.yaml
Adds timeout and requeuing fields with validation, defines requeuing time references and backoff settings, and removes None from the gang scheduling policy values.
Configmap generation
pkg/configmap/configmap.go
Builds WaitForPodsReady conditionally from by-workload timeout, recovery timeout, admission, and requeuing settings.
Generated configuration expectations
pkg/configmap/configmap_test.go
Updates gang admission, sequential admission, framework, and generated YAML expectations for the new configuration behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ByWorkload
  participant buildWaitForPodsReady
  participant buildRequeuingStrategy
  ByWorkload->>buildWaitForPodsReady: timeout and requeuing settings
  buildWaitForPodsReady->>buildRequeuingStrategy: RequeuingStrategy
  buildRequeuingStrategy-->>buildWaitForPodsReady: configapi.RequeuingStrategy
  buildWaitForPodsReady-->>ByWorkload: configapi.WaitForPodsReady
Loading

Suggested reviewers: kannon92, sohankunkerkar

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Stable And Deterministic Test Names ✅ Passed No new Ginkgo titles were introduced; the touched tests use static map-key subtest names like 'rhoai example' and 'gang admission with requeuing strategy'.
Test Structure And Quality ✅ Passed PASS: The changed tests are table-driven unit tests, not Ginkgo; they don’t create cluster resources or wait on async ops, and assertions use cmp diffs with clear t.Fatalf/t.Errorf messages.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the only changed test file is a standard Go unit test using testing.T, not MicroShift-sensitive e2e logic.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No test/e2e files changed; the PR only touches API, configmap, generated code, and a standard testing unit test, not Ginkgo e2e specs.
Topology-Aware Scheduling Compatibility ✅ Passed Diff only updates CRD/schema and configmap mapping for waitForPodsReady; no deployment, nodeSelector, anti-affinity, or topology-spread changes were introduced.
Ote Binary Stdout Contract ✅ Passed Touched files only change schema/config mapping/tests; no new stdout writes in main/init/TestMain/suite setup. Existing fmt.Printf in cmd/kueue-operator/main.go is untouched.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds no new Ginkgo e2e tests; the only touched test is a unit test with no IPv4 or external connectivity assumptions.
No-Weak-Crypto ✅ Passed Touched files only adjust gang-scheduling config mapping; no MD5/SHA1/DES/RC4/3DES/Blowfish, custom crypto, or secret/token comparisons found.
Container-Privileges ✅ Passed Touched files are CRD/config mapping only; no added privileged, hostPID/hostNetwork/hostIPC, allowPrivilegeEscalation, SYS_ADMIN, or root settings were found.
No-Sensitive-Data-In-Logs ✅ Passed No logging statements exposing sensitive data were added in the touched files; only generic error returns and schema comments appear.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: making waitForPodsReady configurable.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci

openshift-ci Bot commented Jul 3, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: MaysaMacedo

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 Jul 3, 2026
@MaysaMacedo

MaysaMacedo commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

/cc @kannon92
when you can, could you provide some input into the TBD stated in the PR description? Thanks

@openshift-ci
openshift-ci Bot requested a review from kannon92 July 3, 2026 18:31

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/apis/kueueoperator/v1/types.go`:
- Around line 401-425: Add lower-bound validation markers to the
RequeuingStrategy fields so negative values are rejected before they reach
buildRequeuingStrategy. Update the BackoffLimitCount, BackoffBaseSeconds, and
BackoffMaxSeconds definitions in RequeuingStrategy to include appropriate
+kubebuilder:validation:Minimum constraints, matching the existing validation
style used in this type. Keep the JSON field names and comments intact while
ensuring the generated schema enforces valid non-negative backoff settings.
- Around line 368-388: Add non-negative validation to both TimeoutSeconds and
RecoveryTimeoutSeconds in the workload readiness spec so invalid negative values
are rejected at CRD admission. Update the markers on the fields in types.go with
kubebuilder Minimum constraints consistent with other numeric fields in this
API, and then run make generate so the regenerated CRD manifests reflect the new
validation.

In `@pkg/configmap/configmap.go`:
- Around line 164-178: Add table-driven tests in configmap_test.go to cover the
new mapping branches in buildRequeuingStrategy and buildWaitForPodsReady. Verify
buildRequeuingStrategy returns nil for nil input, maps
BackoffLimitCount/BackoffBaseSeconds/BackoffMaxSeconds, and leaves Timestamp
unset when TimeReference is empty. Also cover buildWaitForPodsReady for timeout
override, recovery timeout, requeuing strategy passthrough, and the nil
TimeReference path, using the existing helper names so the cases are easy to
locate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 8880f7a9-227c-4f54-ac26-7475b2670324

📥 Commits

Reviewing files that changed from the base of the PR and between 56e355f and f61c796.

⛔ Files ignored due to path filters (4)
  • pkg/apis/kueueoperator/v1/zz_generated.deepcopy.go is excluded by !**/zz_generated*
  • pkg/generated/applyconfiguration/kueueoperator/v1/byworkload.go is excluded by !**/generated/**
  • pkg/generated/applyconfiguration/kueueoperator/v1/requeuingstrategy.go is excluded by !**/generated/**
  • pkg/generated/applyconfiguration/utils.go is excluded by !**/generated/**
📒 Files selected for processing (3)
  • manifests/kueue.openshift.io_kueues.yaml
  • pkg/apis/kueueoperator/v1/types.go
  • pkg/configmap/configmap.go

Comment thread pkg/apis/kueueoperator/v1/types.go
Comment thread pkg/apis/kueueoperator/v1/types.go Outdated
Comment on lines +164 to +178
func buildRequeuingStrategy(s *kueue.RequeuingStrategy) *configapi.RequeuingStrategy {
if s == nil {
return nil
}
out := &configapi.RequeuingStrategy{
BackoffLimitCount: s.BackoffLimitCount,
BackoffBaseSeconds: s.BackoffBaseSeconds,
BackoffMaxSeconds: s.BackoffMaxSeconds,
}
if s.TimeReference != "" {
ts := configapi.RequeuingTimestamp(s.TimeReference)
out.Timestamp = &ts
}
return out
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n -C3 'buildRequeuingStrategy|RecoveryTimeoutSeconds|RequeuingStrategy' pkg/configmap/configmap_test.go

Repository: openshift/kueue-operator

Length of output: 162


🏁 Script executed:

#!/bin/bash
set -euo pipefail
printf '\n## configmap.go outline\n'
ast-grep outline pkg/configmap/configmap.go --view expanded
printf '\n## configmap_test.go outline\n'
ast-grep outline pkg/configmap/configmap_test.go --view expanded
printf '\n## relevant test text\n'
rg -n -C4 'buildWaitForPodsReady|WaitForPodsReady|Requeuing|RecoveryTimeout|TimeoutOverride|TimeReference|buildRequeuingStrategy' pkg/configmap/configmap_test.go pkg/configmap/configmap.go

Repository: openshift/kueue-operator

Length of output: 6302


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '## files'
git ls-files 'pkg/configmap/*'

echo '## outline of configmap.go'
ast-grep outline pkg/configmap/configmap.go --view expanded

echo '## outline of configmap_test.go'
ast-grep outline pkg/configmap/configmap_test.go --view expanded

echo '## search all tests for relevant mapping coverage'
rg -n -C3 'buildWaitForPodsReady|buildRequeuingStrategy|RecoveryTimeoutSeconds|RequeuingStrategy|TimeReference|TimeoutOverride|WaitForPodsReady' pkg test . -g '*_test.go'

Repository: openshift/kueue-operator

Length of output: 2598


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,260p' pkg/configmap/configmap_test.go

Repository: openshift/kueue-operator

Length of output: 6947


Add table-driven coverage for the new config mapping branches. pkg/configmap/configmap_test.go should cover buildRequeuingStrategy plus the buildWaitForPodsReady cases for timeout override, recovery timeout, requeuing strategy passthrough, and nil TimeReference.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/configmap/configmap.go` around lines 164 - 178, Add table-driven tests in
configmap_test.go to cover the new mapping branches in buildRequeuingStrategy
and buildWaitForPodsReady. Verify buildRequeuingStrategy returns nil for nil
input, maps BackoffLimitCount/BackoffBaseSeconds/BackoffMaxSeconds, and leaves
Timestamp unset when TimeReference is empty. Also cover buildWaitForPodsReady
for timeout override, recovery timeout, requeuing strategy passthrough, and the
nil TimeReference path, using the existing helper names so the cases are easy to
locate.

@MaysaMacedo
MaysaMacedo force-pushed the wait-for-pods-ready-customization branch from f61c796 to 6934b55 Compare July 30, 2026 19:25
@MaysaMacedo MaysaMacedo changed the title Alow configuration of waitForPodsReady feature wip: Alow configuration of waitForPodsReady feature Jul 30, 2026
@MaysaMacedo
MaysaMacedo marked this pull request as ready for review July 30, 2026 19:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/apis/kueueoperator/v1/types.go`:
- Around line 311-315: Retain the deprecated None enum value and
GangSchedulingPolicyNone constant alongside GangSchedulingPolicyByWorkload in
pkg/apis/kueueoperator/v1/types.go. Regenerate
manifests/kueue.openshift.io_kueues.yaml so the v1 schema includes None as a
temporary compatibility value.
- Around line 367-373: Make the documented 1800-second timeout effective
everywhere: in pkg/apis/kueueoperator/v1/types.go lines 367-373, add the
Kubebuilder default marker; regenerate manifests/kueue.openshift.io_kueues.yaml
lines 235-243 so the schema contains default: 1800; update
pkg/configmap/configmap.go lines 147-149 to fall back to 1800 seconds for
existing CRs with no value; and update pkg/configmap/configmap_test.go lines
144-146, 264-266, and 329-336 to expect that default, including a custom-timeout
case.

In `@pkg/configmap/configmap_test.go`:
- Around line 281-287: Update the ByWorkload fixture in the config mapping test
to include the required Admission field, setting it to
GangSchedulingWorkloadAdmissionParallel while preserving the existing
RequeuingStrategy values.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: 95c2b6ec-347c-45cc-8d4c-6b81643142bc

📥 Commits

Reviewing files that changed from the base of the PR and between f61c796 and 6934b55.

⛔ Files ignored due to path filters (5)
  • pkg/apis/kueueoperator/v1/zz_generated.deepcopy.go is excluded by !**/zz_generated*
  • pkg/generated/applyconfiguration/kueueoperator/v1/byworkload.go is excluded by !**/generated/**
  • pkg/generated/applyconfiguration/kueueoperator/v1/gangscheduling.go is excluded by !**/generated/**
  • pkg/generated/applyconfiguration/kueueoperator/v1/requeuingstrategy.go is excluded by !**/generated/**
  • pkg/generated/applyconfiguration/utils.go is excluded by !**/generated/**
📒 Files selected for processing (4)
  • manifests/kueue.openshift.io_kueues.yaml
  • pkg/apis/kueueoperator/v1/types.go
  • pkg/configmap/configmap.go
  • pkg/configmap/configmap_test.go

Comment on lines +311 to 315
// +kubebuilder:validation:Enum=ByWorkload;""
type GangSchedulingPolicy string

const (
GangSchedulingPolicyByWorkload GangSchedulingPolicy = "ByWorkload"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Keep None readable during the v1 API transition. Removing it from the only stored API version invalidates already persisted configuration and blocks future updates.

  • pkg/apis/kueueoperator/v1/types.go#L311-L315: retain None as a deprecated enum/constant until migration is complete.
  • manifests/kueue.openshift.io_kueues.yaml#L258-L260: regenerate the schema with the temporary compatibility value included.
📍 Affects 2 files
  • pkg/apis/kueueoperator/v1/types.go#L311-L315 (this comment)
  • manifests/kueue.openshift.io_kueues.yaml#L258-L260
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/apis/kueueoperator/v1/types.go` around lines 311 - 315, Retain the
deprecated None enum value and GangSchedulingPolicyNone constant alongside
GangSchedulingPolicyByWorkload in pkg/apis/kueueoperator/v1/types.go. Regenerate
manifests/kueue.openshift.io_kueues.yaml so the v1 schema includes None as a
temporary compatibility value.

Comment on lines +367 to +373
// timeoutSeconds defines the time for an admitted workload to have it's pods scheduled.
// When the timeoutSeconds is expired, the workload is evicted and requeued.
// The value must be between 1 and 31536000 (one year in seconds). Defaults to 1800 seconds.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=31536000
// +optional
TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Make the 1800-second default effective end-to-end. The API documentation promises 1800 seconds, but omitted fields currently produce timeout: 0s.

  • pkg/apis/kueueoperator/v1/types.go#L367-L373: add the Kubebuilder default marker for 1800 seconds.
  • manifests/kueue.openshift.io_kueues.yaml#L235-L243: regenerate with default: 1800.
  • pkg/configmap/configmap.go#L147-L149: fall back to 1800 seconds for existing CRs that lack the new field.
  • pkg/configmap/configmap_test.go#L144-L146: expect the effective default.
  • pkg/configmap/configmap_test.go#L264-L266: expect the effective default.
  • pkg/configmap/configmap_test.go#L329-L336: expect the effective default and add a custom-timeout case.
📍 Affects 4 files
  • pkg/apis/kueueoperator/v1/types.go#L367-L373 (this comment)
  • manifests/kueue.openshift.io_kueues.yaml#L235-L243
  • pkg/configmap/configmap.go#L147-L149
  • pkg/configmap/configmap_test.go#L144-L146
  • pkg/configmap/configmap_test.go#L264-L266
  • pkg/configmap/configmap_test.go#L329-L336
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/apis/kueueoperator/v1/types.go` around lines 367 - 373, Make the
documented 1800-second timeout effective everywhere: in
pkg/apis/kueueoperator/v1/types.go lines 367-373, add the Kubebuilder default
marker; regenerate manifests/kueue.openshift.io_kueues.yaml lines 235-243 so the
schema contains default: 1800; update pkg/configmap/configmap.go lines 147-149
to fall back to 1800 seconds for existing CRs with no value; and update
pkg/configmap/configmap_test.go lines 144-146, 264-266, and 329-336 to expect
that default, including a custom-timeout case.

Comment on lines 281 to +287
ByWorkload: &kueue.ByWorkload{
Admission: kueue.GangSchedulingWorkloadAdmissionSequential,
RequeuingStrategy: &kueue.RequeuingStrategy{
TimeReference: kueue.EvictionTimestamp,
BackoffLimitCount: 5,
BackoffBaseSeconds: 120,
BackoffMaxSeconds: 7200,
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a CRD-valid ByWorkload input.

admission is required by the API/CRD, but this test omits it. Set Admission: GangSchedulingWorkloadAdmissionParallel so the mapping test represents a deployable configuration.

Proposed fix
 ByWorkload: &kueue.ByWorkload{
+    Admission: kueue.GangSchedulingWorkloadAdmissionParallel,
     RequeuingStrategy: &kueue.RequeuingStrategy{
📝 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
ByWorkload: &kueue.ByWorkload{
Admission: kueue.GangSchedulingWorkloadAdmissionSequential,
RequeuingStrategy: &kueue.RequeuingStrategy{
TimeReference: kueue.EvictionTimestamp,
BackoffLimitCount: 5,
BackoffBaseSeconds: 120,
BackoffMaxSeconds: 7200,
},
ByWorkload: &kueue.ByWorkload{
Admission: kueue.GangSchedulingWorkloadAdmissionParallel,
RequeuingStrategy: &kueue.RequeuingStrategy{
TimeReference: kueue.EvictionTimestamp,
BackoffLimitCount: 5,
BackoffBaseSeconds: 120,
BackoffMaxSeconds: 7200,
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/configmap/configmap_test.go` around lines 281 - 287, Update the
ByWorkload fixture in the config mapping test to include the required Admission
field, setting it to GangSchedulingWorkloadAdmissionParallel while preserving
the existing RequeuingStrategy values.

@openshift-ci

openshift-ci Bot commented Jul 30, 2026

Copy link
Copy Markdown

@MaysaMacedo: 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/test-e2e-ci-build-downstream-4-22 6934b55 link true /test test-e2e-ci-build-downstream-4-22

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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants