godaddy / godaddy/kubernetes-client

Adding data to configMap errors

Open
#668 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
963
Forks
189
PR merge metrics
No merged PRs in 30d

Description

This is the configMap I am trying to update and add data to:
```
kind: ConfigMap
apiVersion: v1
metadata:
name: my-config-map
data:
users.json: |-
[
{
name: 'user-one',
age: 10
}
]
```
I tried the following code, but it fails:
```
const addToConfig = {
data: {
"users.json": {
name: 'user-two',
age: 12
}
}
}

await kubeclient.api.v1.namespaces('my-namespace').configmaps('my-config-map').patch({ body: addToConfig})
```

How can I use the API to update the configMap and append data to the ```users.json``` array?

Contributor guide

Open the contributing guide

Research direction

Start at the Kubernetes client patch call shown in the issue and review how ConfigMap data is represented and patched in the client and Kubernetes API documentation. Confirm the expected value format for users.json and the read or update behavior needed for appending an array item. Done means the ConfigMap contains both users without the patch error.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, kubernetes, node.js
Domain
api, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.