Deleting a NodeWright, or relabelling a node out of its selector, leaves the host as the packages left it, unless the package has opted in to uninstall (below), in which case deleting the NodeWright runs the uninstall first. Reversing a change is otherwise a separate, deliberate step: uninstall.
A package opts in with uninstall.enabled: true, which declares that it ships
uninstall and uninstall_check steps. Setting uninstall.apply: true then runs
them on every target node.
This example's package writes a marker file on the host and removes it again.
NODE=<node-name>
kubectl label node "$NODE" nodewright.nvidia.com/example=uninstall
kubectl apply -f examples/uninstall/nodewright.yaml
kubectl get nodewright uninstall-demo -wOnce it is complete, the node's record of the package shows it installed:
kubectl get node "$NODE" \
-o jsonpath='{.metadata.annotations.nodewright\.nvidia\.com/nodeState_uninstall-demo}'The file is on the host. Check from a debug pod:
chroot /host cat /etc/nodewright-example/uninstall/marker.
Flip apply to true:
kubectl patch nodewright uninstall-demo --type=merge \
-p '{"spec":{"packages":{"marker":{"uninstall":{"apply":true}}}}}'The operator runs uninstall.sh, then uninstall_check.sh, which fails unless the
file is gone. When the check passes, the package disappears from the node's
nodeState_uninstall-demo annotation. Absent means uninstalled: there is no
"uninstalled" state to look for.
kubectl nodewright package status marker --nodewright uninstall-demoNow it is safe to remove the package from the spec. The webhook would have rejected that before the uninstall finished, which is what stops you from orphaning files on a host.
- Cancel. Patch
applyback tofalsewhile the uninstall is running. The package installs again. (A package that declares aninterruptcan no longer be cancelled once its uninstall interrupt has fired.) - Uninstall on delete. Reinstall, then
kubectl deletethe NodeWright. A finalizer runs the uninstall on every node before the resource goes away. - Downgrade. Lower
versionwhileapplyisfalse. The webhook rejects it: to downgrade a package withuninstall.enabled, uninstall it first.
kubectl delete -f examples/uninstall/nodewright.yaml
kubectl label node "$NODE" nodewright.nvidia.com/example-- Explicit Uninstall: every workflow, the
deletion edge cases, and how uninstall interacts with
dependsOn - Lifecycle of a NodeWright: the uninstall lane