From de0ad9f9bceb1cb3769f745157903d65022aff93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Fri, 11 Mar 2022 10:15:12 +0100 Subject: [PATCH] Fix breaking changes in Kubernetes Client --- .../src/main/kotlin/theodolite/benchmark/ActionCommand.kt | 5 +---- .../theodolite/execution/operator/AbstractStateHandler.kt | 7 ++++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt b/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt index 966fa5632..a4345c43a 100644 --- a/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt +++ b/theodolite/src/main/kotlin/theodolite/benchmark/ActionCommand.kt @@ -7,7 +7,6 @@ import io.fabric8.kubernetes.client.dsl.ExecListener import io.fabric8.kubernetes.client.dsl.ExecWatch import io.fabric8.kubernetes.client.utils.Serialization import mu.KotlinLogging -import okhttp3.Response import theodolite.util.ActionCommandFailedException import theodolite.util.Configuration import java.io.ByteArrayOutputStream @@ -145,10 +144,8 @@ class ActionCommand(val client: NamespacedKubernetesClient) { } private class ActionCommandListener(val execLatch: CountDownLatch) : ExecListener { - override fun onOpen(response: Response) { - } - override fun onFailure(throwable: Throwable, response: Response) { + override fun onFailure(throwable: Throwable, response: ExecListener.Response) { execLatch.countDown() throw ActionCommandFailedException("Some error encountered while executing action, caused ${throwable.message})") } diff --git a/theodolite/src/main/kotlin/theodolite/execution/operator/AbstractStateHandler.kt b/theodolite/src/main/kotlin/theodolite/execution/operator/AbstractStateHandler.kt index 93536282e..84343ea7e 100644 --- a/theodolite/src/main/kotlin/theodolite/execution/operator/AbstractStateHandler.kt +++ b/theodolite/src/main/kotlin/theodolite/execution/operator/AbstractStateHandler.kt @@ -25,7 +25,12 @@ abstract class AbstractStateHandler<S : HasMetadata>( val resource = this.crdClient.withName(resourceName).get() if (resource != null) { val resourcePatched = setter(resource) - this.crdClient.patchStatus(resourcePatched) + // TODO replace with this.crdClient.replaceStatus(resourcePatched) with upcoming fabric8 release (> 5.12.1) + // find out the difference between patchStatus and replaceStatus + // see also https://github.com/fabric8io/kubernetes-client/pull/3798 + if (resourcePatched != null) { + this.crdClient.withName(resourcePatched.metadata.name).patchStatus(resourcePatched) + } } } catch (e: KubernetesClientException) { logger.warn(e) { "Status cannot be set for resource $resourceName." } -- GitLab