mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-12 18:18:51 +00:00
refactor builder in kubectl factory
This commit is contained in:
@@ -151,12 +151,7 @@ func (o *ResourcesOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args
|
||||
IncludeUninitialized(includeUninitialized).
|
||||
Flatten()
|
||||
|
||||
if !o.Local {
|
||||
builder = builder.
|
||||
LabelSelectorParam(o.Selector).
|
||||
ResourceTypeOrNameArgs(o.All, args...).
|
||||
Latest()
|
||||
} else {
|
||||
if o.Local {
|
||||
// if a --local flag was provided, and a resource was specified in the form
|
||||
// <resource>/<name>, fail immediately as --local cannot query the api server
|
||||
// for the specified resource.
|
||||
@@ -165,6 +160,11 @@ func (o *ResourcesOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args
|
||||
}
|
||||
|
||||
builder = builder.Local(f.ClientForMapping)
|
||||
} else {
|
||||
builder = builder.
|
||||
LabelSelectorParam(o.Selector).
|
||||
ResourceTypeOrNameArgs(o.All, args...).
|
||||
Latest()
|
||||
}
|
||||
|
||||
o.Infos, err = builder.Do().Infos()
|
||||
|
Reference in New Issue
Block a user