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.
This seems to be similar to kubernetes/kubernetes issue 36222 when creating configMap from files.
In your case, that happens when created from a data
block.
The recent kubernetes/kubernetes issue 63503 references all printed issues.
I added a new line in a configMap using Tab for identation. After changing to Spaces instead of Tab, I was able to see the configmap as expected...
As stated in the Github issue, you need to remove all whitespace from the end of each line, and make sure you don't have any special characters as well.
If you are doing this programatically, you'll have better luck 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