0 votes
1 view
in Devops and Agile by (28.1k points)

I am trying to deploy a configmap onto a cluster

 - name: Make/Update all configmaps on the cluster

 kubernetes:

 api_endpoint: blah

 url_username: blah

 url_password: blah

 inline_data:

 apiVersion: v1

 kind: ConfigMap

 metadata: 

 name: blah

namespace: blah

 data: my-data.txt: "{{ data }}"

 state: present

data: |

 some = foo

 foo = some

(using spinnaker to attach it to pods)

When I go into the pod and open my-data.txt it displays:

some = foo\n foo = some\n

I want it to look exactly like the text and print newline rather than \n

Weird thing if I put ' ' single quotes somewhere in the text it prints the text as is but with the single quotes so :

data: |

 some = foo

 foo = some

' '

prints exactly the same.

I have tried to research but I couldn't find anything and I have been stuck on this for a while now.

1 Answer

0 votes
by (48k points)

you need to remove all whitespace from the end of each line and make sure you don't have any special characters as well.

You can use this with single-line strings, rather than multiline. e.g. in go use "" + "\n" rather than backticks.

The correct result should use a pipe |

data: |

 some = foo

 foo = some

I hope this will help to print a config map instead of a new line.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...