type CordonHelper … // NewCordonHelper returns a new CordonHelper func NewCordonHelper(node *corev1.Node) *CordonHelper { … } // NewCordonHelperFromRuntimeObject returns a new CordonHelper, or an error if given object is not a // node or cannot be encoded as JSON func NewCordonHelperFromRuntimeObject(nodeObject runtime.Object, scheme *runtime.Scheme, gvk schema.GroupVersionKind) (*CordonHelper, error) { … } // UpdateIfRequired returns true if c.node.Spec.Unschedulable isn't already set, // or false when no change is needed func (c *CordonHelper) UpdateIfRequired(desired bool) bool { … } // PatchOrReplace uses given clientset to update the node status, either by patching or // updating the given node object; it may return error if the object cannot be encoded as // JSON, or if either patch or update calls fail; it will also return a second error // whenever creating a patch has failed func (c *CordonHelper) PatchOrReplace(clientset kubernetes.Interface, serverDryRun bool) (error, error) { … } // PatchOrReplaceWithContext provides the option to pass a custom context while updating // the node status func (c *CordonHelper) PatchOrReplaceWithContext(clientCtx context.Context, clientset kubernetes.Interface, serverDryRun bool) (error, error) { … }