Document The `WaitForTermination` policy
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
		
							parent
							
								
									98adddbf2e
								
							
						
					
					
						commit
						413118e9a7
					
				| 
						 | 
				
			
			@ -181,8 +181,16 @@ Valid values:
 | 
			
		|||
  `true` and orphaned if `false`.
 | 
			
		||||
- `Delete` - Ensure the managed resources are deleted before the Kustomization
 | 
			
		||||
   is deleted.
 | 
			
		||||
- `WaitForTermination` - Ensure the managed resources are deleted and wait for
 | 
			
		||||
  termination before the Kustomization is deleted.
 | 
			
		||||
- `Orphan` - Leave the managed resources when the Kustomization is deleted.
 | 
			
		||||
 | 
			
		||||
The `WaitForTermination` deletion policy blocks and waits for the managed
 | 
			
		||||
resources to be removed from etcd by the Kubernetes garbage collector.
 | 
			
		||||
The wait time is determined by the `.spec.timeout` field. If a timeout occurs,
 | 
			
		||||
the controller will stop waiting for the deletion of the resources,
 | 
			
		||||
log an error and will allow the Kustomization to be deleted.
 | 
			
		||||
 | 
			
		||||
For special cases when the managed resources are removed by other means (e.g.
 | 
			
		||||
the deletion of the namespace specified with
 | 
			
		||||
[`.spec.targetNamespace`](#target-namespace)), you can set the deletion policy
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1020,14 +1020,14 @@ func (r *KustomizationReconciler) prune(ctx context.Context,
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
// finalizerShouldDeleteResources determines if resources should be deleted
 | 
			
		||||
// based on the object's status and deletion policy.
 | 
			
		||||
// based on the object's inventory and deletion policy.
 | 
			
		||||
// A suspended Kustomization or one without an inventory will not delete resources.
 | 
			
		||||
func finalizerShouldDeleteResources(obj *kustomizev1.Kustomization) bool {
 | 
			
		||||
	if obj.Spec.Suspend {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if obj.Status.Inventory == nil || obj.Status.Inventory.Entries == nil {
 | 
			
		||||
	if obj.Status.Inventory == nil || len(obj.Status.Inventory.Entries) == 0 {
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1109,7 +1109,7 @@ func (r *KustomizationReconciler) finalize(ctx context.Context,
 | 
			
		|||
				r.event(obj, obj.Status.LastAppliedRevision, obj.Status.LastAppliedOriginRevision, eventv1.EventSeverityInfo, changeSet.String(), nil)
 | 
			
		||||
 | 
			
		||||
				// Wait for the resources marked for deletion to be terminated.
 | 
			
		||||
				if obj.Spec.DeletionPolicy == kustomizev1.DeletionPolicyWaitForTermination {
 | 
			
		||||
				if obj.GetDeletionPolicy() == kustomizev1.DeletionPolicyWaitForTermination {
 | 
			
		||||
					if err := resourceManager.WaitForSetTermination(changeSet, ssa.WaitOptions{
 | 
			
		||||
						Interval: 2 * time.Second,
 | 
			
		||||
						Timeout:  obj.GetTimeout(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue