improve: integration test to showcase external resource state in status#3480
Open
csviri wants to merge 1 commit into
Open
improve: integration test to showcase external resource state in status#3480csviri wants to merge 1 commit into
csviri wants to merge 1 commit into
Conversation
d0165ba to
3ef1ccf
Compare
3ef1ccf to
c3077df
Compare
…y status Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
c3077df to
1b6eae8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds new integration-test samples demonstrating how to manage an external resource while persisting the external resource identifier (state) directly in the primary custom resource status, including a workflow-based variant using a dependent resource. It also updates the Maven version across the multi-module build.
Changes:
- Added a base API sample reconciler + IT showing external state persisted in status and coordinated with a polling event source.
- Added a workflow sample (dependent resource + reconciler + IT) showing external state persisted in status to avoid duplicate creation.
- Updated the root and module POMs to use version
999-SNAPSHOT.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Sets root project version to 999-SNAPSHOT. |
| operator-framework/pom.xml | Updates parent version to 999-SNAPSHOT. |
| operator-framework-core/pom.xml | Updates parent version to 999-SNAPSHOT. |
| operator-framework-junit/pom.xml | Updates parent version to 999-SNAPSHOT. |
| operator-framework-bom/pom.xml | Updates BOM version to 999-SNAPSHOT. |
| micrometer-support/pom.xml | Updates parent version to 999-SNAPSHOT. |
| caffeine-bounded-cache-support/pom.xml | Updates parent version to 999-SNAPSHOT. |
| migration/pom.xml | Updates parent version to 999-SNAPSHOT. |
| bootstrapper-maven-plugin/pom.xml | Updates parent version to 999-SNAPSHOT. |
| test-index-processor/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/webpage/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/tomcat-operator/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/operations/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/mysql-schema/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/leader-election/pom.xml | Updates parent version to 999-SNAPSHOT. |
| sample-operators/controller-namespace-deletion/pom.xml | Updates parent version to 999-SNAPSHOT. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusReconciler.java | New reconciler sample managing an external resource with state stored in status. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusIT.java | New IT validating the base API “state in status” approach. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusCustomResource.java | New CR type for the base API sample. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusSpec.java | New spec POJO for the base API sample. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/baseapi/externalstateinstatus/ExternalStateInStatusStatus.java | New status POJO holding the external ID for the base API sample. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusDependentResource.java | New dependent resource implementing external resource CRUD with ID sourced from status. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusWorkflowReconciler.java | New workflow reconciler that patches status with the external ID after dependent reconciliation. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusWorkflowIT.java | New IT validating the workflow-based “state in status” approach. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusWorkflowCustomResource.java | New CR type for the workflow sample. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusSpec.java | New spec POJO for the workflow sample. |
| operator-framework/src/test/java/io/javaoperatorsdk/operator/dependent/externalstateinstatus/ExternalStateInStatusStatus.java | New status POJO holding the external ID for the workflow sample. |
Comment on lines
+71
to
+80
| if (externalResource.isEmpty()) { | ||
| // No external resource is associated with this primary yet. If we already stored an ID we | ||
| // are just waiting for the poll to catch up (do nothing), otherwise we create the external | ||
| // resource and persist its ID into the status. Relying on read-after-write consistency the | ||
| // stored ID is visible on the next reconciliation, so no duplicate is created. | ||
| if (idFromStatus(resource) == null) { | ||
| return createExternalResource(resource); | ||
| } | ||
| return UpdateControl.noUpdate(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.