You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened (please include outputs or screenshots):
Impossible to remove finalizers from list by using kubernetes.client.CoreV1Api().patch_node
The node gke-attack-node-default-node-pool-92ee7023-wh9m has a finalizer :
$ k get node gke-attack-node-default-node-pool-92ee7023-wh9m -o jsonpath='{.metadata.finalizers}'
["test/test"]
Which can't be deleted using the patch_node method :
from kubernetes import client, config, watch
config.load_kube_config()
v1 = client.CoreV1Api()
node_name = "gke-attack-node-default-node-pool-92ee7023-wh9m"
body = {
"metadata": {
"finalizers": [] # Not working, can only add finalzer, not remove them
}
}
v1.patch_node(name=node_name, body=body)
$ k get node gke-attack-node-default-node-pool-92ee7023-wh9m -o jsonpath='{.metadata.finalizers}'
["test/test"]
It seems that using patch_node on this list only allow to add elements to the list but not remove it
The difference seems to come from the header Content-Type which is not the same in the requests
What you expected to happen:
Add an option to choose how to patch the ressource, the default should keep the current behavior but when activated, it should have the same behavior than kubectl patch --type='merge'
How to reproduce it (as minimally and precisely as possible):
What happened (please include outputs or screenshots):
Impossible to remove finalizers from list by using
kubernetes.client.CoreV1Api().patch_node
The node
gke-attack-node-default-node-pool-92ee7023-wh9m
has a finalizer :Which can't be deleted using the
patch_node
method :It seems that using
patch_node
on this list only allow to add elements to the list but not remove itDebug output of the python script :
Debug output of this kubectl command (which should have the same behavior than patch_node function)
The difference seems to come from the header
Content-Type
which is not the same in the requestsWhat you expected to happen:
Add an option to choose how to patch the ressource, the default should keep the current behavior but when activated, it should have the same behavior than
kubectl patch --type='merge'
How to reproduce it (as minimally and precisely as possible):
Add a finalizer on a node :
Try to remove it with this script :
Anything else we need to know?:
Environment:
Kubernetes version (
kubectl version
):Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.30.5-gke.1443001
OS (e.g., MacOS 10.13.6):
Linux 6.8.0-48-generic 48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Python version (
python --version
)Python 3.12.6
Python client version (
pip list | grep kubernetes
)kubernetes 31.0.0
The text was updated successfully, but these errors were encountered: