You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -239,8 +241,8 @@ func (o *DeleteOptions) Validate() error {
239
241
switch {
240
242
caseo.GracePeriod==0&&o.ForceDeletion:
241
243
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")
242
-
caseo.ForceDeletion:
243
-
fmt.Fprintf(o.ErrOut, "warning: --force is ignored because --grace-period is not 0.\n")
244
+
caseo.GracePeriod>0&&o.ForceDeletion:
245
+
returnfmt.Errorf("--force and --grace-period greater than 0 cannot be specified together")
cmd.Flags().BoolVarP(f.AllNamespaces, "all-namespaces", "A", *f.AllNamespaces, "If present, list the requested object(s) across all namespaces. Namespace in current context is ignored even if specified with --namespace.")
117
117
}
118
118
iff.Force!=nil {
119
-
cmd.Flags().BoolVar(f.Force, "force", *f.Force, "Only used when grace-period=0. If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.")
119
+
cmd.Flags().BoolVar(f.Force, "force", *f.Force, "If true, immediately remove resources from API and bypass graceful deletion. Note that immediate deletion of some resources may result in inconsistency or data loss and requires confirmation.")
120
120
}
121
121
iff.Cascade!=nil {
122
122
cmd.Flags().BoolVar(f.Cascade, "cascade", *f.Cascade, "If true, cascade the deletion of the resources managed by this resource (e.g. Pods created by a ReplicationController). Default true.")
name: "Deleting an object with --force should use grace period = 0",
276
+
cmdArgs: []string{"pods/foo"},
277
+
forceFlag: true,
278
+
expectedGracePeriod: "0",
279
+
expectedOut: "pod/foo\n",
280
+
expectedErrOut: "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",
name: "Deleting an object with --force and --grace-period 0 should use grade period = 0",
285
+
cmdArgs: []string{"pods/foo"},
286
+
forceFlag: true,
287
+
gracePeriodFlag: "0",
288
+
expectedGracePeriod: "0",
289
+
expectedOut: "pod/foo\n",
290
+
expectedErrOut: "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",
0 commit comments