python icon indicating copy to clipboard operation
python copied to clipboard

not able to update/patch the configmap

Open akshaysharama opened this issue 2 years ago • 3 comments

What happened (please include outputs or screenshots): I have a configmap as show below

Name:         test-configmap
Namespace:    default
Labels:       <none>
Annotations:  <none>
Data
====
test.json:
----
[
   {
      "targets": [
         "127.0.0.1:12321"
      ],
      "labels": {
          "job": "test",
          "element_name": "new-service-a",
          "__test_path__": "/path/x/test"
      }
   }
]

I want to replace above information completely (context in test.json) so I'm using python kubernetes client as show below

config.load_kube_config()
kube_client = client.CoreV1Api()

data = json.dumps(testsinfo,indent=4) // testsinfo is a list , which as multiple entry(dict) as show in configmap
data1 = {'test.json': data} //NOTE: here data.. (is a json string (with mutiple entry))

resp = kube_client.patch_namespaced_config_map("test-configmap", namespace, data1, pretty='true')

it is not updating the configmaps.

What you expected to happen: the data should be replaced with new data.

How to reproduce it (as minimally and precisely as possible): mentioned in above steps

Anything else we need to know?:

Environment:

  • Kubernetes version (kubectl version): -Client Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.4", GitCommit:"fa3d7990104d7c1f16943a67f11b154b71f6a132", GitTreeState:"clean", BuildDate:"2023-07-19T12:20:54Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"linux/amd64"} Kustomize Version: v5.0.1 Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.4", GitCommit:"fa3d7990104d7c1f16943a67f11b154b71f6a132", GitTreeState:"clean", BuildDate:"2023-07-19T12:14:49Z", GoVersion:"go1.20.6", Compiler:"gc", Platform:"linux/amd64"}
  • OS (e.g., MacOS 10.13.6): ubuntu 18.04.5
  • Python version (python --version) Python 3.6.9
  • Python client version (pip list | grep kubernetes) kubernetes (26.1.0)

akshaysharama avatar Dec 21 '23 09:12 akshaysharama

Could you check the our examples and look for patch and update examples?

roycaihw avatar Feb 12 '24 17:02 roycaihw

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar May 12 '24 18:05 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Jun 11 '24 18:06 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

k8s-triage-robot avatar Jul 11 '24 18:07 k8s-triage-robot

@k8s-triage-robot: Closing this issue, marking it as "Not Planned".

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue with /reopen
  • Mark this issue as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close not-planned

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

k8s-ci-robot avatar Jul 11 '24 18:07 k8s-ci-robot