Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the io.fabric8.kubernetes-client dependency from 6.10.0 to the latest 7.1.0 #774

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vinokurig
Copy link
Contributor

What does this PR do?

Update the io.fabric8.kubernetes-client dependency from 6.10.0 to the latest 7.1.0

Screenshot/screencast of this PR

What issues does this PR fix or reference?

How to test this PR?

N/A

PR Checklist

As the author of this Pull Request I made sure that:

Release Notes

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Copy link

openshift-ci bot commented Feb 28, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vinokurig

The full list of commands accepted by this bot can be found here.

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

@vinokurig vinokurig force-pushed the che-23272 branch 3 times, most recently from 72e34b0 to 55312a2 Compare February 28, 2025 13:48
@@ -59,15 +59,16 @@
<com.googlecode.gson.version>2.10.1</com.googlecode.gson.version>
<com.h2database.version>2.2.224</com.h2database.version>
<com.jcraft.jsch.version>0.1.55</com.jcraft.jsch.version>
<com.squareup.okhttp3.version>4.12.0</com.squareup.okhttp3.version>
<com.squareup.okhttp3.version>5.0.0-alpha.12</com.squareup.okhttp3.version>
Copy link
Member

Choose a reason for hiding this comment

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

should we really use alpha here? cc: @manusa
maybe we should also consider switching to another client - https://blog.marcnuri.com/kubernetes-client-6-httpclient-how-to

Copy link

Choose a reason for hiding this comment

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

So in version 7 the default client is no longer OkHttp but Vertx:

You no longer need a dependency to OkHttp unless you actually do the opposite that's explained in the referenced blog post.

To be clear, OkHttp and any reference should be removed.

Copy link
Contributor Author

@vinokurig vinokurig Mar 3, 2025

Choose a reason for hiding this comment

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

I still need the com.squareup.okhttp3:mockwebserver dependency, otherwise I get the test compilation error:

[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/ivinokur/projects/che-server/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/configurator/SshKeysConfiguratorTest.java:[62,21] cannot access org.junit.rules.ExternalResource
  class file for org.junit.rules.ExternalResource not found
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

The test is failing on kubernetes initialisation step:

According to square/okhttp#7987 (comment) we need the com.squareup.okhttp3:mockwebserver dependency to use the junit 5 module.

@manusa could you please take a look?

Copy link

Choose a reason for hiding this comment

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

You should not be using ExternalResource (it's JUnit4)

Switch to use the @EnableKubernetesMockClient(crud = true)

For some reason you're using a very convoluted way to set up the mock server in your tests.

Copy link

Choose a reason for hiding this comment

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

If you want, I can update this test in a separate PR so you can follow the pattern for any other test doing the same weird setup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@manusa

Switch to use the @EnableKubernetesMockClient(crud = true)

Unfortunately @EnableKubernetesMockClient did not work for me.

If you want, I can update this test in a separate PR so you can follow the pattern for any other test doing the same weird setup

Thank you, that would be much appreciated.

Copy link

Choose a reason for hiding this comment

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

I see you're not using JUnit (neither 4 or 5) but TestNG instead.

I'll make another set of updates that should be v7-compatible.

Copy link

Choose a reason for hiding this comment

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

I created #776

Once merged, you should rebase this PR and replace okhttp3.mockwebserver.MockWebServer with io.fabric8.mockwebserver.MockWebServer

https://github.com/fabric8io/kubernetes-client/blob/main/doc/MIGRATION-v7.md#mockwebserver-okhttp-replacements

----> No OkHttp dependency should remain.

Comment on lines 33 to 36
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<artifactId>okhttp-jvm</artifactId>
</dependency>
Copy link

Choose a reason for hiding this comment

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

pom.xml Outdated
<com.squareup.okio.version>3.6.0</com.squareup.okio.version>
<commons-fileupload.version>1.5</commons-fileupload.version>
<commons-io.version>2.14.0</commons-io.version>
<commons-lang.version>2.6</commons-lang.version>
<enforcer.skip>false</enforcer.skip>
<integration.mysql.db.image>quay.io/eclipse/che--centos--mysql-57-centos7:latest-e08ee4d43b7356607685b69bde6335e27cf20c020f345b6c6c59400183882764</integration.mysql.db.image>
<integration.postgresql.db.image>quay.io/eclipse/che--centos--postgresql-13-centos7:1-71b24684d64da46f960682cc4216222a7e4ed8b1a31dd5a865b3e71afdea20d2</integration.postgresql.db.image>
<io.fabric8.kubernetes-client>6.10.0</io.fabric8.kubernetes-client>
<io.fabric8.kubernetes-client.version>7.1.0</io.fabric8.kubernetes-client.version>
<io.fabric8.openshift-server-mock.version>6.13.5</io.fabric8.openshift-server-mock.version>
Copy link

Choose a reason for hiding this comment

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

You should remove this.
OpenShift Mock Server is not needed, you should switch to the vanilla Kubernetes Mock Server.
If you have trouble migrating, give me an example file and I'll show you the exact replacements you need to perform.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

pom.xml Outdated
Comment on lines 290 to 294
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-jvm</artifactId>
<version>${com.squareup.okhttp3.version}</version>
</dependency>
Copy link

Choose a reason for hiding this comment

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

pom.xml Outdated
Comment on lines 332 to 336
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-server-mock</artifactId>
<version>${io.fabric8.kubernetes-client}</version>
<version>${io.fabric8.openshift-server-mock.version}</version>
</dependency>
Copy link

Choose a reason for hiding this comment

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

Copy link

openshift-ci bot commented Mar 3, 2025

@vinokurig: The following tests 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/v14-gitlab-no-pat-oauth-flow e8143c5 link true /test v14-gitlab-no-pat-oauth-flow
ci/prow/v14-gitlab-no-pat-oauth-flow-raw-devfile-url e8143c5 link true /test v14-gitlab-no-pat-oauth-flow-raw-devfile-url
ci/prow/v14-bitbucket-no-pat-oauth-flow e8143c5 link true /test v14-bitbucket-no-pat-oauth-flow
ci/prow/v14-github-no-pat-oauth-flow e8143c5 link true /test v14-github-no-pat-oauth-flow
ci/prow/v14-gitea-with-pat-setup-flow e8143c5 link true /test v14-gitea-with-pat-setup-flow
ci/prow/v14-azure-with-pat-setup-flow e8143c5 link true /test v14-azure-with-pat-setup-flow
ci/prow/v14-azure-no-pat-oauth-flow-raw-devfile-url e8143c5 link true /test v14-azure-no-pat-oauth-flow-raw-devfile-url
ci/prow/v14-github-no-pat-oauth-flow-raw-devfile-url e8143c5 link true /test v14-github-no-pat-oauth-flow-raw-devfile-url
ci/prow/v14-github-no-pat-oauth-flow-ssh-url e8143c5 link true /test v14-github-no-pat-oauth-flow-ssh-url
ci/prow/v14-github-with-pat-setup-flow e8143c5 link true /test v14-github-with-pat-setup-flow
ci/prow/v14-gitlab-no-pat-oauth-flow-ssh-url e8143c5 link true /test v14-gitlab-no-pat-oauth-flow-ssh-url
ci/prow/v14-bitbucket-no-pat-oauth-flow-ssh-url e8143c5 link true /test v14-bitbucket-no-pat-oauth-flow-ssh-url
ci/prow/v14-azure-no-pat-oauth-flow-ssh-url e8143c5 link true /test v14-azure-no-pat-oauth-flow-ssh-url
ci/prow/v14-azure-no-pat-oauth-flow e8143c5 link true /test v14-azure-no-pat-oauth-flow
ci/prow/v14-che-smoke-test e8143c5 link true /test v14-che-smoke-test
ci/prow/v14-gitlab-with-pat-setup-flow e8143c5 link true /test v14-gitlab-with-pat-setup-flow
ci/prow/v14-gitea-no-pat-oauth-flow e8143c5 link true /test v14-gitea-no-pat-oauth-flow
ci/prow/v14-bitbucket-no-pat-oauth-flow-raw-devfile-url e8143c5 link true /test v14-bitbucket-no-pat-oauth-flow-raw-devfile-url
ci/prow/v14-gitlab-with-oauth-setup-flow e8143c5 link true /test v14-gitlab-with-oauth-setup-flow

Full PR test history. Your PR dashboard.

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants