Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit a573bf3

Browse files
authored
Fix the label writer (#977)
1 parent 32cd6ba commit a573bf3

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

tools/cloudflow-cli/src/main/scala/akka/cli/cloudflow/execution/CloudflowConfig.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,10 @@ object CloudflowConfig {
213213
}
214214
}
215215

216+
implicit val labelValueWriter = ConfigWriter.fromFunction[LabelValue] { label: LabelValue =>
217+
ConfigValueFactory.fromAnyRef(label.value)
218+
}
219+
216220
// LabelKey
217221

218222
final case class LabelKey(key: String)

tools/cloudflow-cli/src/test/scala/akka/cli/cloudflow/execution/CloudflowConfigSpec.scala

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,29 @@ class CloudflowConfigSpec extends AnyFlatSpec with Matchers with OptionValues wi
718718
res.failure.exception.getMessage.contains(LabelsNotAllowedOnPod) shouldBe true
719719
}
720720

721+
it should "write label values as plain strings" in {
722+
// Arrange
723+
val config = s"""cloudflow {
724+
| streamlets {
725+
| flink {
726+
| kubernetes.pods {
727+
| pod {
728+
| labels: {
729+
| mykey = myvalue
730+
| }
731+
| }
732+
| }
733+
| }
734+
| }
735+
|}""".stripMargin
736+
737+
// Act
738+
val res = ConfigFactory.empty().withFallback(writeConfig(loadAndValidate(ConfigSource.string(config)).get))
739+
740+
// Assert
741+
res.getString("cloudflow.streamlets.flink.kubernetes.pods.pod.labels.mykey") shouldBe "myvalue"
742+
}
743+
721744
it should "generate proper default mounts" in {
722745
// Arrange
723746
val crFile = new File("./cloudflow-cli/src/test/resources/swiss-knife.json")

0 commit comments

Comments
 (0)