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.

Garreth McDaid
  • 3,399
  • 26
  • 41

1 Answers1

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
Garreth McDaid
  • 3,399
  • 26
  • 41
  • 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](/review/low-quality-posts/358415) – Andrew Schulman Feb 24 '18 at 11:13
  • The question was "Is this the correct path to use?". I provided the correct path as the answer. – Garreth McDaid Feb 24 '18 at 16:07