-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Description
Describe the bug
Kubectl.label() does not have a delete option as far as I have seen. Normally in k8s, a label can be deleted via CLI by putting "-" at the end of the label.
Ex:
kubectl label node <nodename> <labelname>=labelvalue adds the label, and
kubectl label node <nodename> <labelname>- deletes the label
But in Kubectl.label() function cannot have "-" at the end of the label name due to some restrictions. Can it be achieved?
By the way, I found a getaround with the jsonpatches and created a patch to the resource in order to achieve this functionality:
String patchString = "[{ \"op\": \"remove\", \"path\": \"/labelpath\" }]";
V1Patch patch = new V1Patch(patchString);
Kubectl.patch(V1Node.class).apiClient(apiClient).name(nodeName).patchContent(patch).execute();
Metadata
Metadata
Assignees
Labels
good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.