4

I'm having problems with ConfigMap creation on OpenShift 4. I'm trying to add a data element which holds Java application.properties and to format the YAML using literal block scalar. Example:

data:
  application.properties: |
    spring.application.name=myApp
    server.port=8080
    management.server.port=8080

Everything works fine until I add a longer line which should be present in the application.properties. After I save the change literal block scalar is automatically updated to folded block scalar, like this:

data:
  application.properties: >
    spring.application.name=myApp

    server.port=8080

    management.server.port=8080

    some.long.property=this.is.some.long.property.value.which.should.be.part.of.the.properties.file

What is the cause of this and how can I fix it? Its really frustrating.

Dawid Kruk
  • 8,982
  • 2
  • 22
  • 45
dplesa
  • 1,355
  • 6
  • 23
  • 56
  • What happens if you add a minus sign (-) after the style indicator, that is |- – Saxon Jan 10 '21 at 17:23
  • Same thing happens, after I hit the save button it just converts to folded block scalar with minus sign. >- – dplesa Jan 12 '21 at 08:48

1 Answers1

0

It seems a behaviour of Openshift Web Console, it changes the yaml style when you use longer data.

If you try to change it from oc

oc edit configmap YOURCM

you can see the style won't change. If you don't want this problem probably you should create directly from oc using

oc create configmap YOURCM --from-file=application.properties