// If the user didn't explicitly set the option, default to ignoring NotFound errors when used with --all
if!f.Changed{
o.IgnoreNotFound=true
}
}
ifo.DeleteNow{
ifo.GracePeriod!=-1{
returnfmt.Errorf("--now and --grace-period cannot be specified together")
}
o.GracePeriod=1
}
ifo.GracePeriod==0{
ifo.ForceDeletion{
fmt.Fprintf(o.ErrOut,"warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.\n")
}else{
// To preserve backwards compatibility, but prevent accidental data loss, we convert --grace-period=0
// into --grace-period=1 and wait until the object is successfully deleted. Users may provide --force
// to bypass this wait.
o.WaitForDeletion=true
o.GracePeriod=1
}
}elseifo.ForceDeletion{
switch{
caseo.GracePeriod==0&&o.ForceDeletion:
fmt.Fprintf(o.ErrOut,"warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely.\n")
caseo.ForceDeletion:
fmt.Fprintf(o.ErrOut,"warning: --force is ignored because --grace-period is not 0.\n")