0

I have the following deployment spec:

spec:
  template:
    spec:
      volumes:
        - name: config-web
          configMap:
            name: config-web-2-5

I want to use the kubernetes python client to change the name of ConfigMap from config-web-2-5 to config-web-3-0

def kubernetes_update_cm():
    v1 = client.AppsV1beta1Api()
    body = [{"op":"replace","path":"/spec/template/spec/volumes/0/config_map/name", "value": "config-web-3-0"}]
    ret = v1.patch_namespaced_deployment(name="my-app", namespace="default", body=body)
    return ret

However, the client returns the following error:

"message":"jsonpatch replace operation does not apply: doc is missing path: /spec/template/spec/volumes/0/config_map/name"

From the client src, I can see that this error occurs when the path isn't found in the deployment object.

Is this the correct path to use? There is only 1 volume in the deployment.

1 Answer 1

0

The path is not correct.

Correct path is:

/spec/template/spec/volumes/0/configMap/name

not

/spec/template/spec/volumes/0/config_map/name
2
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review Feb 24, 2018 at 11:13
  • The question was "Is this the correct path to use?". I provided the correct path as the answer. Feb 24, 2018 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .