Skip to content

Update configmap with JSON not working #1571

@raz08

Description

@raz08

What happened (please include outputs or screenshots):
Updating configmap with JSON in python programmatically. Using patch to update.

  test3 = '{test1: "test1", test2: "test2"}'
   objectMeta = client.V1ObjectMeta(name="configmap1", namespace="testns1")
   body = client.V1ConfigMap(api_version="v1",kind='ConfigMap', metadata=objectMeta, data={"proxy": test3})
   pretty = 'pretty_example'
   retpatch = clientv1.patch_namespaced_config_map("configmap1", "testns1", body, pretty=pretty)

in my config map it shows as


data:
  proxy: '{test1: "test1", test2: "test2"}'

because it is adding single quote. it is failing at mount end. And if I pass JSON object then I will get

What you expected to happen:
single quote should be removed from proxy json
How to reproduce it (as minimally and precisely as possible):

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version):
  • OS (e.g., MacOS 10.13.6):
  • Python version (python --version)
  • Python client version (pip list | grep kubernetes)

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions