Trying to patch my custom resource to add extra element into an Array.
Works fine using kubectl:
kubectl patch my-resource default --type=json -p '[ { "op":"add", "path": "/spec/data/-", "value": "3342, 43243.343, 434343" } ]' -v 9
but can't make it work using Python:
body = '[ { "op":"add", "path":"/spec/data/-", "value": "3342, 43243.343, 434343" } ]'
api_response = api_instance.patch_namespaced_custom_object(group, version, namespace, plural, name, json.loads(body) )
getting Response
"status":"Failure","message":"json: cannot unmarshal array into Go value of type map[string]interface {}","code":500
weirdly when I drop [ ] and just pass a {}
api_response = api_instance.patch_namespaced_custom_object(group, version, namespace, plural, name, json.loads('{ "spec": { "data": [ "3342, 43243.343, 434343" ] } } ') )
it works, but the effect is not what I want - it overwrites the "data" Array completely, whilst I want to append.
What am I missing?