kubernetes-client / kubernetes-client/python
Can't append data
- Dominant language
- Python
- Stars
- 7.7k
- Forks
- 3.5k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 18
Description
**What happened (please include outputs or screenshots)**:
I have created a config map via create_namespaced_config_map. I am attempting to patch it by appending existing data. Tried like this
cm = client.V1ConfigMap()
cm.metadata = client.V1ObjectMeta(name=name)
cm.data = cm_data
existingCM = v1.read_namespaced_config_map("test-cm", "test-ns")
print(existingCM)
# print(existingCM)
if existingCM == False:
print(self.v1.read_namespaced_config_map(test-cm", "test-ns"))
self.v1.create_namespaced_config_map(namespace=namespace, body=cm)
print(f"Created ConfigMap {name} in namespace {namespace}")
else:
# print(existingCM)
print(existingCM.update(cm.data))
v1.patch_namespaced_config_map(name=name, namespace=namespace, body=cm)
print(f"Updated ConfigMap {name} in namespace {namespace}")
This wouldn't work. Is there an example that I can follow?
Describe the solution you'd like to see:
Example to achieve successful data append
Contributor guide
Research direction
Start with the create_namespaced_config_map, read_namespaced_config_map, and patch_namespaced_config_map entry points shown in the issue, then review the repository's existing examples for ConfigMap usage. Add a focused example covering creation and appending existing data, and verify that it demonstrates a successful patch.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kubernetes, python
- Domain
- api, documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100