kubernetes-client
kubernetes-client copied to clipboard
Adding data to configMap errors
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?