MCPcopy
hub / github.com/kubernetes/kubectl / AddFlags

Method AddFlags

pkg/cmd/delete/delete_flags.go:117–166  ·  view source on GitHub ↗
(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

115}
116
117func (f *DeleteFlags) AddFlags(cmd *cobra.Command) {
118 f.FileNameFlags.AddFlags(cmd.Flags())
119 if f.LabelSelector != nil {
120 cmdutil.AddLabelSelectorFlagVar(cmd, f.LabelSelector)
121 }
122 if f.FieldSelector != nil {
123 cmd.Flags().StringVarP(f.FieldSelector, "field-selector", "", *f.FieldSelector, "Selector (field query) to filter on, supports '=', '==', and '!='.(e.g. --field-selector key1=value1,key2=value2). The server only supports a limited number of field queries per type.")
124 }
125 if f.All != nil {
126 cmd.Flags().BoolVar(f.All, "all", *f.All, "Delete all resources, in the namespace of the specified resource types.")
127 }
128 if f.AllNamespaces != nil {
129 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.")
130 }
131 if f.Force != nil {
132 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.")
133 }
134 if f.CascadingStrategy != nil {
135 cmd.Flags().StringVar(
136 f.CascadingStrategy,
137 "cascade",
138 *f.CascadingStrategy,
139 `Must be "background", "orphan", or "foreground". Selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). Defaults to background.`)
140 cmd.Flags().Lookup("cascade").NoOptDefVal = "background"
141 }
142 if f.Now != nil {
143 cmd.Flags().BoolVar(f.Now, "now", *f.Now, "If true, resources are signaled for immediate shutdown (same as --grace-period=1).")
144 }
145 if f.GracePeriod != nil {
146 cmd.Flags().IntVar(f.GracePeriod, "grace-period", *f.GracePeriod, "Period of time in seconds given to the resource to terminate gracefully. Ignored if negative. Set to 1 for immediate shutdown. Can only be set to 0 when --force is true (force deletion).")
147 }
148 if f.Timeout != nil {
149 cmd.Flags().DurationVar(f.Timeout, "timeout", *f.Timeout, "The length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object")
150 }
151 if f.IgnoreNotFound != nil {
152 cmd.Flags().BoolVar(f.IgnoreNotFound, "ignore-not-found", *f.IgnoreNotFound, "Treat \"resource not found\" as a successful delete. Defaults to \"true\" when --all is specified.")
153 }
154 if f.Wait != nil {
155 cmd.Flags().BoolVar(f.Wait, "wait", *f.Wait, "If true, wait for resources to be gone before returning. This waits for finalizers.")
156 }
157 if f.Output != nil {
158 cmd.Flags().StringVarP(f.Output, "output", "o", *f.Output, "Output mode. Use \"-o name\" for shorter output (resource/name).")
159 }
160 if f.Raw != nil {
161 cmd.Flags().StringVar(f.Raw, "raw", *f.Raw, "Raw URI to DELETE to the server. Uses the transport specified by the kubeconfig file.")
162 }
163 if f.Interactive != nil {
164 cmd.Flags().BoolVarP(f.Interactive, "interactive", "i", *f.Interactive, "If true, delete resource only when user confirms.")
165 }
166}
167
168// NewDeleteCommandFlags provides default flags and values for use with the "delete" command
169func NewDeleteCommandFlags(usage string) *DeleteFlags {

Callers

nothing calls this directly

Calls 2

AddFlagsMethod · 0.65
LookupMethod · 0.65

Tested by

no test coverage detected