Change:
} } <ins> func TestRunAttach(t *testing.T) { tests := []struct { name                string rm                  bool quiet               bool deleteErrorMessage  string expectedDeleteCount int expectedOut         string expectedErrOut      string }{ { name:                "test attach", rm:                  false, quiet:               false, expectedDeleteCount: 0, expectedOut:         "", expectedErrOut:      "If you don't see a command prompt, try pressing enter.n", }, { name:                "test attach with quiet", rm:                  false, quiet:               true, expectedDeleteCount: 0, expectedOut:         "", expectedErrOut:      "", }, { name:                "test attach with rm", rm:                  true, quiet:               false, expectedDeleteCount: 1, expectedOut:         "pod "foo" deletedn", expectedErrOut:      "If you don't see a command prompt, try pressing enter.n", }, { name:                "test attach with rm should not print message if quiet is specified", rm:                  true, quiet:               true, expectedDeleteCount: 1, expectedOut:         "", expectedErrOut:      "", }, { name:                "error should be displayed if delete fails", rm:                  true, quiet:               false, deleteErrorMessage:  "delete error message", expectedDeleteCount: 1, expectedOut:         "", expectedErrOut:      "If you don't see a command prompt, try pressing enter.nDelete failed: delete error messagen", }, } fakePod := &corev1.Pod{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", Kind:       "Pod", }, ObjectMeta: metav1.ObjectMeta{ Name:      "foo", Namespace: "default", }, Spec: corev1.PodSpec{ Containers: []corev1.Container{ { Name: "bar", }, }, }, Status: corev1.PodStatus{ Phase: corev1.PodRunning, Conditions: []corev1.PodCondition{ { Type:   corev1.PodReady, Status: corev1.ConditionTrue, }, }, }, } for _, test := range tests { t.Run(test.name, func(tt *testing.T) { postCount := 0 attachCount := 0 deleteCount := 0 attachFunc = func(o *attach.AttachOptions, containerToAttach *corev1.Container, raw bool, sizeQueue remotecommand.TerminalSizeQueue) func() error { if containerToAttach.Name != "bar" { tt.Fatalf("expected attach to container name "bar", but got %q", containerToAttach.Name) } return func() error { attachCount++ return nil } } tf := cmdtesting.NewTestFactory().WithNamespace("test") defer tf.Cleanup() codec := scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...) ns := scheme.Codecs.WithoutConversion() tf.Client = &fake.RESTClient{ GroupVersion:         schema.GroupVersion{Version: ""}, NegotiatedSerializer: ns, Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) { switch p, m := req.URL.Path, req.Method; { case m == "POST" && p == "/namespaces/test/pods": postCount++ body := cmdtesting.ObjBody(codec, fakePod) return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: body}, nil case m == "GET" && p == "/api/v1/namespaces/default/pods": event := &metav1.WatchEvent{ Type:   "ADDED", Object: runtime.RawExtension{Object: fakePod}, } body := cmdtesting.ObjBody(codec, event) return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: body}, nil case m == "GET" && p == "/namespaces/default/pods/foo": body := cmdtesting.ObjBody(codec, fakePod) return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: body}, nil case m == "DELETE" && p == "/namespaces/default/pods/foo": deleteCount++ if test.deleteErrorMessage != "" { body := cmdtesting.ObjBody(codec, &metav1.Status{ Status:  metav1.StatusFailure, Message: test.deleteErrorMessage, }) return &http.Response{StatusCode: http.StatusInternalServerError, Header: cmdtesting.DefaultHeader(), Body: body}, nil } else { body := cmdtesting.ObjBody(codec, fakePod) return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: body}, nil } default: tt.Errorf("unexpected request: %s %#vn%#v", req.Method, req.URL, req) return nil, fmt.Errorf("unexpected request") } }), } tf.ClientConfigVal = &restclient.Config{ ContentConfig: restclient.ContentConfig{GroupVersion: &schema.GroupVersion{Version: ""}, NegotiatedSerializer: ns}, } streams, _, bufOut, bufErr := genericclioptions.NewTestIOStreams() cmdutil.BehaviorOnFatal(func(str string, code int) { bufErr.Write([]byte(str)) }) cmd := NewCmdRun(tf, streams) cmd.Flags().Set("image", "test-image") cmd.Flags().Set("attach", "true") if test.rm { cmd.Flags().Set("rm", "true") } if test.quiet { cmd.Flags().Set("quiet", "true") } parentCmd := cobra.Command{} parentCmd.AddCommand(cmd) cmd.Run(cmd, []string{"test-pod"}) if postCount != 1 { tt.Fatalf("expected 1 post request, but got %d", postCount) } if attachCount != 1 { tt.Fatalf("expected 1 attach call, but got %d", attachCount) } if deleteCount != test.expectedDeleteCount { tt.Fatalf("expected %d delete requests, but got %d", test.expectedDeleteCount, deleteCount) } if bufErr.String() != test.expectedErrOut { tt.Fatalf("unexpected error. got: %q, expected: %q", bufErr.String(), test.expectedErrOut) } if bufOut.String() != test.expectedOut { tt.Fatalf("unexpected output. got: %q, expected: %q", bufOut.String(), test.expectedOut) } }) } } </ins> func TestRunOverride(t *testing.T) { tests := []struct { name           string

Discussion:
The command provides a flag but this doesn't do anything. most likely the flag shouldn't exist. I have no idea how kustomize could be useful here to start a single pod. This creates a pod, and shows that is ignored: No response <details</details<detailsAzure, K3OS</details<detailsOSX 11.6.1 (Big Sur) </detailsNo response No response No response
/sig cli
This comes from the inclusion of DeleteFlags: brings in FilenameFlags: has Kustomize, resulting in the flag: I suspect there are many flags from DeleteFlags that don't really apply to . : Not sure what this would do : seems to be ignored and : doesn't seem to be used : doesn't seem to be used : also probably doesn't apply There might be others as well...
It seems to delete object which created by command.
I agree, As far as I can see, , and have this deleteFlags exposure.
/assign
/reopen
Reopened this issue. <detailsIn response to : /reopen Instructions for interacting with me using PR comments are available . If you have questions or suggestions related to my behavior, please file an issue against the repository. </details
/triage accepted