diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt index 7510fd82127edfe1925d51dee756d6112d045946..21d9d53cf0b268d72eb9ec0c6135e844bc7c7ca3 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/BenchmarkExecution.kt @@ -6,6 +6,7 @@ import io.fabric8.kubernetes.client.CustomResource import theodolite.util.ConfigurationOverride import kotlin.properties.Delegates +@JsonDeserialize class BenchmarkExecution : CustomResource(){ lateinit var name: String lateinit var benchmark: String diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/DonableTestResource.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/DonableTestResource.kt deleted file mode 100644 index 3c399a76b9deecd6b3a4aef7e04b02214321b3bf..0000000000000000000000000000000000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/DonableTestResource.kt +++ /dev/null @@ -1,8 +0,0 @@ -package theodolite.benchmark - - -import io.fabric8.kubernetes.client.CustomResourceDoneable -import io.fabric8.kubernetes.api.builder.Function - -class DonableTestResource(resource: TestResource, function: Function<TestResource,TestResource>) : - CustomResourceDoneable<TestResource>(resource, function) \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestResource.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestResource.kt deleted file mode 100644 index 2b2d82e83b71bb4e92083f474c814a3c2948db9b..0000000000000000000000000000000000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestResource.kt +++ /dev/null @@ -1,6 +0,0 @@ -package theodolite.benchmark - -import io.fabric8.kubernetes.client.CustomResource - -data class TestResource(var spec: TestSpec = TestSpec()): CustomResource() { -} \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestResourceList.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestResourceList.kt deleted file mode 100644 index 043c2fcf9021d819220deb62c0a0fb9e9a6a49c7..0000000000000000000000000000000000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestResourceList.kt +++ /dev/null @@ -1,5 +0,0 @@ -package theodolite.benchmark - -import io.fabric8.kubernetes.client.CustomResourceList - -class TestResourceList : CustomResourceList<TestResource> () \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestSpec.kt b/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestSpec.kt deleted file mode 100644 index a2475abd4ad1fd23e87d4528022a53780f22240d..0000000000000000000000000000000000000000 --- a/theodolite-quarkus/src/main/kotlin/theodolite/benchmark/TestSpec.kt +++ /dev/null @@ -1,7 +0,0 @@ -package theodolite.benchmark - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize - -@JsonDeserialize -data class TestSpec(var message: String = "MEGAAIDS") { -} \ No newline at end of file diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt similarity index 55% rename from theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt rename to theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt index 5f79f65213e5f76920abc1e9f1c3ac0aebcefb6f..549b7723021a6993afff923675ac3852ff373490 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteCRDExecutor.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/execution/TheodoliteOperator.kt @@ -1,14 +1,15 @@ package theodolite.execution -import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder import io.fabric8.kubernetes.client.DefaultKubernetesClient import io.fabric8.kubernetes.client.dsl.base.CustomResourceDefinitionContext import io.fabric8.kubernetes.client.informers.ResourceEventHandler import io.quarkus.runtime.annotations.QuarkusMain import mu.KotlinLogging import theodolite.benchmark.* -import theodolite.util.YamlParser -import kotlin.system.exitProcess +import io.fabric8.kubernetes.internal.KubernetesDeserializer + + + private var DEFAULT_NAMESPACE = "default" private val logger = KotlinLogging.logger {} @@ -24,15 +25,12 @@ object TheodoliteCRDExecutor { val client = DefaultKubernetesClient().inNamespace("default") -// val customResourceDefinition = CustomResourceDefinitionBuilder() -// .withNewMetadata().withName("benchmarkExecutions.demo.k8s.io").endMetadata() -// .withNewSpec() -// .withGroup("demo.k8s.io") -// .withVersion("v1alpha1") -// .withNewNames().withKind("BenchmarkExecution").withPlural("benchmarkExecutions").endNames() -// .withScope("Namespaced") -// .endSpec() -// .build() + KubernetesDeserializer.registerCustomKind( + "demo.k8s.io/v1alpha1", + "Benchmarkexecutions", + BenchmarkExecution::class.java + ) + val context = CustomResourceDefinitionContext.Builder() .withVersion("v1alpha1") @@ -44,21 +42,23 @@ object TheodoliteCRDExecutor { val informerFactory = client.informers() - val x = informerFactory.sharedIndexInformerForCustomResource(context, TestResource::class.java, - TestResourceList::class.java,10 * 60 * 1000.toLong()) + val x = informerFactory.sharedIndexInformerForCustomResource(context, BenchmarkExecution::class.java, + BenchmarkExecutionList::class.java,10 * 60 * 1000.toLong()) - x.addEventHandler(object : ResourceEventHandler<TestResource> { - override fun onAdd(webServer: TestResource) { - println("hello there") + x.addEventHandler(object : ResourceEventHandler<BenchmarkExecution> { + override fun onAdd(webServer: BenchmarkExecution) { + println("hello there add") + println(webServer.name) } - override fun onUpdate(webServer: TestResource, newWebServer: TestResource) { - println("hello there") + override fun onUpdate(webServer: BenchmarkExecution, newWebServer: BenchmarkExecution) { + println("hello there update") } - override fun onDelete(webServer: TestResource, b: Boolean) { + override fun onDelete(webServer: BenchmarkExecution, b: Boolean) { println("delted") + println(webServer.name) } }) @@ -66,7 +66,6 @@ object TheodoliteCRDExecutor { - //println(client.apiextensions().v1beta1().customResourceDefinitions().list()) //exitProcess(0) diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/ConfigurationOverride.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/ConfigurationOverride.kt index fcf8244e87b87d0e6470c021474ca0ed5bb2eeec..4d290eab95648064a0a4efb19961ae29b92f8688 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/ConfigurationOverride.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/ConfigurationOverride.kt @@ -1,5 +1,8 @@ package theodolite.util +import com.fasterxml.jackson.databind.annotation.JsonDeserialize + +@JsonDeserialize class ConfigurationOverride { lateinit var patcher: PatcherDefinition lateinit var value: String diff --git a/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt b/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt index 13b1e721cdf1f54a43414127ffcc8b227e7693ee..fedcc0459a18b43a53e9980517da91c004a5ed97 100644 --- a/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt +++ b/theodolite-quarkus/src/main/kotlin/theodolite/util/PatcherDefinition.kt @@ -1,5 +1,8 @@ package theodolite.util +import com.fasterxml.jackson.databind.annotation.JsonDeserialize + +@JsonDeserialize class PatcherDefinition { lateinit var type: String lateinit var resource: String diff --git a/theodolite-quarkus/src/main/resources/yaml/testResource.yaml b/theodolite-quarkus/src/main/resources/yaml/resource.yaml similarity index 51% rename from theodolite-quarkus/src/main/resources/yaml/testResource.yaml rename to theodolite-quarkus/src/main/resources/yaml/resource.yaml index 81c3b2b96e26fb1d2fe21b174c3e9f2563556817..15b45b191a98a5e375e2f27596489c9ffb06d228 100644 --- a/theodolite-quarkus/src/main/resources/yaml/testResource.yaml +++ b/theodolite-quarkus/src/main/resources/yaml/resource.yaml @@ -1,5 +1,6 @@ apiVersion: demo.k8s.io/v1alpha1 kind: Benchmarkexecutions metadata: - name: example-webserver -name: "Theodolite Test Context" \ No newline at end of file + name: aids-webserver +spec: + message: "Theodolite Test Context" \ No newline at end of file