inbinder
inbinder

Reputation: 722

Kubernetes ConfigMap issue

I'm struggling to hunt down the cause of this error, though it seems like a string/bool/Dict or some value is not where ConfigMap wants it. I've verified that the JSON is valid that I'm passing, so that's where I started and everything was legal.

- name: Create appsettings ConfigMap
  k8s:
    state: "{{ service_state }}"
    kubeconfig: "{{ tempdir.path }}/.kubeconfig"
    resource_definition:
      apiVersion: v1
      kind: ConfigMap
      metadata:
        name: appsettingconf
        namespace: "{{ cust_reports_namespace }}"
      data:
        "app-settings.json": "{{ lookup('template', 'appsettings.json.j2') }}"

ERROR: 1.ConfigMap.Data: ReadString: expects \\\\\" or n, but found {, error found in #10 byte of ...|gs.json\\\\\":{\\\\\"applicati|..., bigger context ...|{\\\\\"apiVersion\\\\\":\\\\\"v1\\\\\",\\\\\"data\\\\\":{\\\\\"app-settings.json\\\\\":{\\\\\"applicationSettings\\\\\":{\\\\\"reportingApiUrl\\\\\":\\\\\"http://a|...\",\"reason\":\"Invalid\",\"details\":{\"causes\":[{\"reason\":\"FieldValueInvalid\",\"message\":\"Invalid value: \\\\\"{\\\\\\\

Upvotes: 0

Views: 1001

Answers (1)

inbinder
inbinder

Reputation: 722

Solved. template | tojson | b64encode. Always something simple....

Upvotes: 1

Related Questions