Skip to content

Conversation

OwenCorrigan76
Copy link
Contributor

This PR migrates the Java Operator SDK from v4.4.2 to v5.1.2. The updated vesrion will allow Access Operator to watch Kafka clusters in a remote Kubernetes cluster, as requested in issue #44.

This PR directly addresses the follwoing issue: #89

@OwenCorrigan76 OwenCorrigan76 added this to the 0.2.0 milestone Sep 24, 2025
@OwenCorrigan76 OwenCorrigan76 self-assigned this Sep 24, 2025
Copy link
Member

@im-konge im-konge left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, few comments.

@OwenCorrigan76 OwenCorrigan76 force-pushed the Migrate_JOSDK_to_v5 branch 2 times, most recently from ec144f7 to a7b7659 Compare September 25, 2025 11:15
Copy link
Contributor

@katheris katheris left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @OwenCorrigan76. I think we need some additional changes for the switch to SSA and I don't think the Kafka Access Secret event source is being used correctly. Also from reviewing the migration docs I think we need to change the way we use the SDK generation to use the maven plugin.

@katheris katheris modified the milestones: 0.2.0, 0.3.0 Oct 2, 2025
@OwenCorrigan76 OwenCorrigan76 force-pushed the Migrate_JOSDK_to_v5 branch 2 times, most recently from ceca15e to dedd7b5 Compare October 10, 2025 10:59
@OwenCorrigan76
Copy link
Contributor Author

OwenCorrigan76 commented Oct 14, 2025

@katheris @im-konge I've reverted the SSA stuff in CreateOrUpdateSecret and tests are passing and I've tested changes in a cluster and working as expected.
Do we need to revert these changes:

@im-konge
Copy link
Member

@OwenCorrigan76 about the unused declared dependency -> you removed the ObservedGenerationAwareStatus from the KafkaAccessStatus so I think it's not needed anymore in the api module. Did you try to remove it?

@OwenCorrigan76
Copy link
Contributor Author

@OwenCorrigan76 about the unused declared dependency -> you removed the ObservedGenerationAwareStatus from the KafkaAccessStatus so I think it's not needed anymore in the api module. Did you try to remove it?

That's exactly the reason. Thanks @im-konge

Copy link
Member

@im-konge im-konge left a comment

Choose a reason for hiding this comment

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

Thanks for the changes, few more comments.

* The custom reconciler of Strimzi Access Operator
*/
@SuppressWarnings("ClassFanOutComplexity")
@SuppressWarnings({"ClassFanOutComplexity"})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@SuppressWarnings({"ClassFanOutComplexity"})
@SuppressWarnings("ClassFanOutComplexity")

I think that you can revert this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I had "ClassDataAbstractionCoupling" at one stage and didn't remove the }'s.


/**
* Prepares the event sources required for triggering the reconciliation
* Prepares the event sources required for triggering the reconciliation. This tells the JOSDK framework which resources the operator needs to watch.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Prepares the event sources required for triggering the reconciliation. This tells the JOSDK framework which resources the operator needs to watch.
* Prepares the event sources required for triggering the reconciliation.
* It configures the JOSDK framework with resources the operator needs to watch.

Or something like that?

void beforeEach() {
operator = new Operator(overrider -> overrider.withKubernetesClient(client));
operator = new Operator(overrider -> overrider.withKubernetesClient(client)
.withUseSSAToPatchPrimaryResource(false)); // Motivation: mock Kubernetes client doesn't fully support some SSA features.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add the SSA implementation issue link into the comment?

Copy link
Contributor Author

@OwenCorrigan76 OwenCorrigan76 Oct 16, 2025

Choose a reason for hiding this comment

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

Would it look like this:

    void beforeEach() {
        operator = new Operator(overrider -> overrider.withKubernetesClient(client)
                /**
                 * Disables the use of Server-Side Apply for patching the primary resource.
                 * Motivation: Mock Kubernetes client doesn't fully support SSA features.
                 * See: <a href="https://github.com/fabric8io/kubernetes-client/issues/5337">fabric8io/kubernetes-client Issue #5337</a>
                 **/
                .withUseSSAToPatchPrimaryResource(false));
        operator.register(new KafkaAccessReconciler(operator.getKubernetesClient()));
        operator.start();
    }

Or what's the best format for the comment? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding the following: return ErrorStatusUpdateControl.updateStatus(kafkaAccess);
This is deprecated in v5. The only options are : patchStatus , patchResource and patchResourceAndStatus

pom.xml Outdated
<javaoperatorsdk.version>4.4.2</javaoperatorsdk.version>
<javaoperatorsdk.version>5.1.2</javaoperatorsdk.version>
<fabric8.version>7.2.0</fabric8.version>
<fabric8-client.version>7.4.0</fabric8-client.version>
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for my ignorance, for what is this used for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added to test something and forgot to remove. Will remove

Copy link
Contributor

@katheris katheris left a comment

Choose a reason for hiding this comment

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

Thanks @OwenCorrigan76 I think we're pretty close now, but a couple more changes needed.

*
* @return The observed generation.
*/
public Long getObservedGeneration() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public Long getObservedGeneration() {
public long getObservedGeneration() {

return observedGeneration;
}

public void setObservedGeneration(Long observedGeneration) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
public void setObservedGeneration(Long observedGeneration) {
public void setObservedGeneration(long observedGeneration) {

@BeforeEach
void beforeEach() {
operator = new Operator(overrider -> overrider.withKubernetesClient(client));
operator = new Operator(overrider -> overrider.withKubernetesClient(client)
Copy link
Contributor

Choose a reason for hiding this comment

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

Presumably we need a matching change to this in the Operator class right? So it applies when running the actual operator as well as in the tests.

Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
Signed-off-by: OwenCorrigan76 <[email protected]>
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.

3 participants