Skip to content

Flag for opting out delete CRDs for LocallyRunOperatorExtension#3315

Open
csviri wants to merge 3 commits intomainfrom
delete-crds-config
Open

Flag for opting out delete CRDs for LocallyRunOperatorExtension#3315
csviri wants to merge 3 commits intomainfrom
delete-crds-config

Conversation

@csviri
Copy link
Copy Markdown
Collaborator

@csviri csviri commented Apr 27, 2026

Signed-off-by: Attila Mészáros a_meszaros@apple.com

Copilot AI review requested due to automatic review settings April 27, 2026 08:10
@openshift-ci openshift-ci Bot requested review from metacosm and xstefank April 27, 2026 08:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an opt-out flag to prevent CRD deletion when using LocallyRunOperatorExtension, and updates sample E2E tests to disable CRD cleanup for local runs.

Changes:

  • Add withDeleteCRDs(boolean) to LocallyRunOperatorExtension.Builder and wire it into CRD cleanup behavior.
  • Update multiple sample operator E2E tests to call withDeleteCRDs(false) for local execution.
  • Make ClusterDeployedOperatorExtension more tolerant when no CRD files are present under ./target/classes/META-INF/fabric8/.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
sample-operators/webpage/src/test/java/io/javaoperatorsdk/operator/sample/WebPageOperatorE2E.java Disables CRD deletion for locally-run E2E execution.
sample-operators/tomcat-operator/src/test/java/io/javaoperatorsdk/operator/sample/TomcatOperatorE2E.java Disables CRD deletion for locally-run E2E execution.
sample-operators/mysql-schema/src/test/java/io/javaoperatorsdk/operator/sample/MySQLSchemaOperatorE2E.java Disables CRD deletion for locally-run E2E execution.
sample-operators/metrics-processing/src/test/java/io/javaoperatorsdk/operator/sample/metrics/MetricsHandlingE2E.java Disables CRD deletion for locally-run E2E execution.
operator-framework-junit/src/main/java/io/javaoperatorsdk/operator/junit/LocallyRunOperatorExtension.java Introduces builder override for CRD deletion behavior (currently implemented via mutable static state).
operator-framework-junit/src/main/java/io/javaoperatorsdk/operator/junit/ClusterDeployedOperatorExtension.java Avoids NPE when CRD directory has no matching files; logs a warning instead.

Copy link
Copy Markdown
Collaborator

@xstefank xstefank left a comment

Choose a reason for hiding this comment

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

I still don't understand why it would be useful for somebody though.

@csviri
Copy link
Copy Markdown
Collaborator Author

csviri commented Apr 27, 2026

I still don't understand why it would be useful for somebody though.

Let's say you have a test cluster that runs the operator, and have pre installled CRDs. But you want to run also integrationt tests on that cluster, you don't want to delete CRDs after tests are already run.

Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri csviri force-pushed the delete-crds-config branch from 89293a9 to 0e3d86a Compare April 27, 2026 08:55
csviri added 2 commits April 27, 2026 12:17
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
@csviri
Copy link
Copy Markdown
Collaborator Author

csviri commented Apr 27, 2026

But I was thinking maybe we could do this more intelligent, and apply the CRD only if not exists, and delete it if we applied in the test. WDYT? @metacosm @xstefank (that would be without a flag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants