Skip to content

Commit 9505a24

Browse files
committed
hotfix serializing quantity
Kubernetes will sometimes convert quantity to a more convenient format eg. 2048Mi -> 2Gi. This results in an endless loop since the operator is trying to update it. There is a bug report on it operator-framework/java-operator-sdk#2509.
1 parent e331a39 commit 9505a24

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/kotlin/no/fintlabs/Application.kt

+4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package no.fintlabs
22

33
import com.fasterxml.jackson.databind.ObjectMapper
4+
import com.fasterxml.jackson.module.kotlin.addMixIn
45
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
6+
import io.fabric8.kubernetes.api.model.Quantity
57
import io.fabric8.kubernetes.client.KubernetesClientBuilder
68
import io.fabric8.kubernetes.client.utils.KubernetesSerialization
79
import io.javaoperatorsdk.operator.Operator
810
import io.javaoperatorsdk.operator.api.config.ConfigurationService
911
import io.javaoperatorsdk.operator.api.reconciler.Reconciler
1012
import no.fintlabs.operator.applicationReconcilerModule
13+
import no.fintlabs.serialization.QuantityMixIn
1114
import org.koin.core.context.startKoin
1215
import org.koin.dsl.module
1316
import org.koin.mp.KoinPlatform.getKoin
@@ -27,6 +30,7 @@ val baseModule = module {
2730
single(createdAtStart = true) { defaultConfig() }
2831
single {
2932
ObjectMapper().apply {
33+
addMixIn<Quantity, QuantityMixIn>()
3034
registerKotlinModule()
3135
}
3236
}

0 commit comments

Comments
 (0)