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

Method Complete

pkg/cmd/scale/scale.go:141–179  ·  view source on GitHub ↗
(f cmdutil.Factory, cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

139}
140
141func (o *ScaleOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {
142 var err error
143 o.RecordFlags.Complete(cmd)
144 o.Recorder, err = o.RecordFlags.ToRecorder()
145 if err != nil {
146 return err
147 }
148
149 o.dryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)
150 if err != nil {
151 return err
152 }
153 cmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.dryRunStrategy)
154 printer, err := o.PrintFlags.ToPrinter()
155 if err != nil {
156 return err
157 }
158 o.PrintObj = printer.PrintObj
159
160 o.namespace, o.enforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()
161 if err != nil {
162 return err
163 }
164 o.builder = f.NewBuilder()
165 o.args = args
166 o.shortOutput = cmdutil.GetFlagString(cmd, "output") == "name"
167 o.clientSet, err = f.KubernetesClientSet()
168 if err != nil {
169 return err
170 }
171 o.scaler, err = scaler(f)
172 if err != nil {
173 return err
174 }
175 o.unstructuredClientForMapping = f.UnstructuredClientForMapping
176 o.parent = cmd.Parent().Name()
177
178 return nil
179}
180
181func (o *ScaleOptions) Validate() error {
182 if o.Replicas < 0 {

Callers 1

NewCmdScaleFunction · 0.95

Calls 6

scalerFunction · 0.85
NewBuilderMethod · 0.65
KubernetesClientSetMethod · 0.65
NameMethod · 0.65
ToPrinterMethod · 0.45
ToRawKubeConfigLoaderMethod · 0.45

Tested by

no test coverage detected