Skip to content

Commit

Permalink
fix(Matomo): fix config serialization error caused by using wrong Obj…
Browse files Browse the repository at this point in the history
…ectMapper instance
  • Loading branch information
kosmoz authored and pmig committed Jun 27, 2023
1 parent 7823739 commit dd2e11c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package eu.glasskube.operator.apps.matomo.dependent

import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import eu.glasskube.kubernetes.api.model.metadata
import eu.glasskube.kubernetes.api.model.secret
Expand All @@ -11,7 +12,6 @@ import eu.glasskube.operator.apps.matomo.resourceLabels
import eu.glasskube.operator.decodeBase64
import eu.glasskube.operator.encodeBase64
import io.fabric8.kubernetes.api.model.Secret
import io.fabric8.kubernetes.client.utils.Serialization
import io.javaoperatorsdk.operator.api.reconciler.Context
import io.javaoperatorsdk.operator.api.reconciler.ResourceIDMatcherDiscriminator
import io.javaoperatorsdk.operator.processing.dependent.kubernetes.CRUDKubernetesDependentResource
Expand All @@ -22,7 +22,8 @@ import io.javaoperatorsdk.operator.processing.event.ResourceID
labelSelector = MatomoReconciler.SELECTOR,
resourceDiscriminator = MatomoConfigSecret.Discriminator::class
)
class MatomoConfigSecret : CRUDKubernetesDependentResource<Secret, Matomo>(Secret::class.java) {
class MatomoConfigSecret(private val objectMapper: ObjectMapper) :
CRUDKubernetesDependentResource<Secret, Matomo>(Secret::class.java) {
class Discriminator : ResourceIDMatcherDiscriminator<Secret, Matomo>({ ResourceID(it.configSecretName) })

override fun desired(primary: Matomo, context: Context<Matomo>) = secret {
Expand All @@ -36,7 +37,7 @@ class MatomoConfigSecret : CRUDKubernetesDependentResource<Secret, Matomo>(Secre
}

private val Matomo.installJson
get() = with(Serialization.jsonMapper()) {
get() = with(objectMapper) {
readValue<MatomoInstallConfig>(MatomoConfigMap::class.java.getResource("config.json")!!)
.apply {
val smtp = spec.smtp
Expand Down

0 comments on commit dd2e11c

Please sign in to comment.