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

build(deps): replace direct fabric8 kubernetes-client with quarkus kubernetes-client #606

Merged
merged 1 commit into from
Aug 14, 2024

Conversation

andrewazores
Copy link
Member

@andrewazores andrewazores commented Aug 14, 2024

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-sign upstream/main


See #605

Description of the change:

Replaces the Fabric8 Kubernetes Client dependency with an equivalent Quarkus Kubernetes Client extension dependency. This uses the Quarkus BOM version so the dependency is kept at an appropriate version compatible with the Quarkus version, including usability in native mode (not relevant at this time, but interesting).

Motivation for the change:

Since #601 , Cryostat fails to start on Kubernetes/OpenShift when Kubernetes API discovery is enabled:

2024-08-14 14:32:31,741 ERROR [io.qua.run.Application] (main) Failed to start application (with profile [prod]): java.lang.RuntimeException: Failed to start quarkus
	at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
	at io.quarkus.runtime.Application.start(Application.java:101)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:61)
	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:32)
Caused by: java.lang.NoClassDefFoundError: io/fabric8/kubernetes/client/dsl/V1FlowControlAPIGroupDSL
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:105)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:65)
	at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
	at java.base/java.lang.Class.getConstructor0(Class.java:3578)
	at java.base/java.lang.Class.getConstructor(Class.java:2271)
	at io.fabric8.kubernetes.client.KubernetesClientBuilder.build(KubernetesClientBuilder.java:80)
	at io.cryostat.discovery.KubeApiDiscovery$KubeConfig$1.initialize(KubeApiDiscovery.java:524)
	at io.cryostat.discovery.KubeApiDiscovery$KubeConfig$1.initialize(KubeApiDiscovery.java:519)
	at org.apache.commons.lang3.concurrent.LazyInitializer.get(LazyInitializer.java:143)
	at io.cryostat.discovery.KubeApiDiscovery$KubeConfig.kubeClient(KubeApiDiscovery.java:555)
	at io.cryostat.discovery.KubeApiDiscovery_KubeConfig_ClientProxy.kubeClient(Unknown Source)
	at io.cryostat.discovery.KubeApiDiscovery.client(KubeApiDiscovery.java:196)
	at io.cryostat.discovery.KubeApiDiscovery$1.lambda$initialize$0(KubeApiDiscovery.java:114)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.cryostat.discovery.KubeApiDiscovery$1.initialize(KubeApiDiscovery.java:110)
	at io.cryostat.discovery.KubeApiDiscovery$1.initialize(KubeApiDiscovery.java:100)
	at org.apache.commons.lang3.concurrent.LazyInitializer.get(LazyInitializer.java:143)
	at io.cryostat.discovery.KubeApiDiscovery.safeGetInformers(KubeApiDiscovery.java:232)
	at io.cryostat.discovery.KubeApiDiscovery.onAfterStart(KubeApiDiscovery.java:161)
	at io.cryostat.discovery.KubeApiDiscovery_Subclass.onAfterStart$$superforward(Unknown Source)
	at io.cryostat.discovery.KubeApiDiscovery_Subclass$$function$$2.apply(Unknown Source)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:73)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:62)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:136)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:107)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:38)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:61)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:32)
	at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(Unknown Source)
	at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
	at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:30)
	at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:27)
	at io.cryostat.discovery.KubeApiDiscovery_Subclass.onAfterStart(Unknown Source)
	at io.cryostat.discovery.KubeApiDiscovery_Observer_onAfterStart_b19dd85e14de7e5bee356bebf2a7b82c53ef16b5.notify(Unknown Source)
	at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:346)
	at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:328)
	at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:82)
	at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:155)
	at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:106)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
	at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
	... 13 more
Caused by: java.lang.ClassNotFoundException: io.fabric8.kubernetes.client.dsl.V1FlowControlAPIGroupDSL
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:115)
	at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:65)
	... 57 more

How to manually test:

  1. Build PR, or use quay.io/andrewazores/cryostat:quarkus-k8s-client-1
  2. With a Kubernetes or OpenShift cluster, deploy the image from this PR and ensure Cryostat comes up successfully and can discover targets, ex: helm install cryostat --set authentication.openshift.enabled=true --set core.route.enabled=true --set core.image.repository=quay.io/andrewazores/cryostat --set core.image.tag=quarkus-k8s-client-1 --set pvc.enabled=true ./charts/cryostat/

@andrewazores andrewazores requested a review from a team as a code owner August 14, 2024 14:33
@andrewazores andrewazores added dependencies Pull requests that update a dependency file fix safe-to-test labels Aug 14, 2024
@github-actions github-actions bot added the needs-triage Needs thorough attention from code reviewers label Aug 14, 2024
@andrewazores andrewazores removed the needs-triage Needs thorough attention from code reviewers label Aug 14, 2024
@andrewazores
Copy link
Member Author

/build_test

Copy link

Workflow started at 8/14/2024, 10:35:03 AM. View Actions Run.

Copy link

No OpenAPI schema changes detected.

Copy link

No GraphQL schema changes detected.

Copy link

CI build and push: All tests pass ✅
https://github.com/cryostatio/cryostat/actions/runs/10389639323

@andrewazores andrewazores merged commit f7da402 into cryostatio:main Aug 14, 2024
21 checks passed
@andrewazores andrewazores deleted the k8s-client branch August 14, 2024 15:53
andrewazores added a commit to andrewazores/cryostat3 that referenced this pull request Oct 8, 2024
andrewazores added a commit that referenced this pull request Nov 21, 2024
* build(deps): update Quarkus to 3.8 LTS (#609)

* build(deps): update Quarkus to 3.8 LTS

* add hibernate format mapper override

* remove no longer necessary lazy init

* disable openapi management / swagger UI unless in dev mode

* remove duplicate healthcheck override

* reduce healthcheck start periods

* correct healthcheck URL

* use authproxy image which contains wget for healthcheck

* correct healthchecks for vertx agent test applications

* build(deps): replace direct fabric8 kubernetes-client with quarkus kubernetes-client (#606)

* compose fixup

* graphql test fixup

* auth proxy fixup

* startup discovery transactions

* chore(schema): automatic update

---------

Co-authored-by: Cryostat CI <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file fix safe-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants