I need to patch or change the node condition status, any idea how to do that using go lang "k8s client"?
Edit: I can see that inside the Node interface there is patch, not sure about the usage, documentation lacks info about data should be sent, how to know what kind of data
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *v1.Node, err error)
Link: Nodes Interface Nodes Interface
Edit2 : I am running below and am not getting any errors but yet it's not adding or patching the node condition.
Payload := `{ "op": "replace", "path": "/status/conditions/12","value": { "type": "QuayStateSmelik", "status": "False" }}`
bytePayload := []byte(Payload)
Then run:
node, err := clientset.CoreV1().Nodes().Patch(context.TODO(), "NodeName", types.StrategicMergePatchType, bytePayload, metav1.PatchOptions{})
As per this Kube.netes Client issue on GitHub you need to add "status" as a subresource parameter, for example:
node, err := clientset.CoreV1().Nodes().Patch(context.TODO(), "<Node-Name>", types.JSONPatchType, bytesPayloadTT, metav1.PatchOptions{}, "status")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.