Add option in TestRun CRD to skip initializer creation #671
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces an option to disable the initializer phase in a TestRun, allowing users to skip creating the initializer Job.
Key Changes
spec.initializer.disabledadded to the CRD with the defaultFalsevalueWhy use disabled instead of enabled?
To preserve backward compatibility.
If we introduced
enabled, omitting it would default to false and unintentionally disable the initializer for existing users. Usingdisabledavoids this problem: omitting the field preserves the current behavior.Disabledadded to thePodstructThe initializer, starter, and runner are all represented using the same
Podtype. Adding the field directly to this type ensures the API remains backward-compatible.Why store it on
Podinstead of creating a newInitializerPodtype?I explored creating a dedicated struct to have the new field for the initializer only like so:
but this approach introduced several issues:
Pod:For these reasons, I considered extending the existing Pod type as the least disruptive option.
When the initializer is disabled, stage transitions skip
"initialization". The lifecycle becomes:""→"initialized"→ …InitializerSkippedA new condition type is introduced to explicitly record whether the initializer was skipped. Both
TrueandFalsestates are used to differentiate intentional skipping from default behavior.e2e Test
I've tried the e2e setup following the instructions in
e2e/README.mdbut the first test run gets stuck with no logs to troubleshoot. For this reason, I provide my own scripts to test:Initializer skipped
Backward compatible initialization
Resolves #657