pub async fn remove_finalizer<T>(
client: &Client,
resource: &T,
finalizer: &str,
) -> Result<()>where
T: Resource<DynamicType = (), Scope = NamespaceResourceScope> + ResourceExt + Clone + Debug + Serialize + for<'de> Deserialize<'de>,Expand description
Remove a finalizer from a resource.
This function removes the specified finalizer from the resource if present. The operation is idempotent - calling it multiple times has no effect if the finalizer is already absent.
Note: Typically you should use handle_deletion() instead of calling
this function directly, as it performs cleanup before removing the finalizer.
§Arguments
client- Kubernetes client for accessing the APIresource- The resource to remove the finalizer fromfinalizer- The finalizer string to remove
§Returns
Returns Ok(()) if the finalizer was removed or already absent.
§Concurrency
The patch is a JSON Patch that tests the exact array index before
removing it (mirroring kube-runtime’s finalizer helper), so a racing
writer’s finalizer edits are never clobbered. On a conflict the API call
fails and the returned error triggers a requeue; the next reconciliation
retries with fresh state.
§Errors
Returns an error if:
- The resource has no namespace (for namespaced resources)
- The API patch operation fails, including when a concurrent writer
modified
metadata.finalizersand the guarded patch was rejected