@@ -29,7 +29,6 @@ import (
29
29
kapi "k8s.io/kubernetes/pkg/api"
30
30
kclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
31
31
"k8s.io/kubernetes/pkg/kubectl"
32
- "k8s.io/kubernetes/pkg/kubectl/cmd/set"
33
32
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
34
33
"k8s.io/kubernetes/pkg/kubectl/resource"
35
34
kprinters "k8s.io/kubernetes/pkg/printers"
@@ -161,6 +160,10 @@ func (f *ring0Factory) ClientConfig() (*restclient.Config, error) {
161
160
return f .kubeClientAccessFactory .ClientConfig ()
162
161
}
163
162
163
+ func (f * ring0Factory ) BareClientConfig () (* restclient.Config , error ) {
164
+ return f .clientConfig .ClientConfig ()
165
+ }
166
+
164
167
func (f * ring0Factory ) ClientConfigForVersion (requiredVersion * schema.GroupVersion ) (* restclient.Config , error ) {
165
168
return f .kubeClientAccessFactory .ClientConfigForVersion (nil )
166
169
}
@@ -234,8 +237,8 @@ func (f *ring0Factory) FlagSet() *pflag.FlagSet {
234
237
return f .kubeClientAccessFactory .FlagSet ()
235
238
}
236
239
237
- func (f * ring0Factory ) Command () string {
238
- return f .kubeClientAccessFactory .Command ()
240
+ func (f * ring0Factory ) Command (cmd * cobra. Command , showSecrets bool ) string {
241
+ return f .kubeClientAccessFactory .Command (cmd , showSecrets )
239
242
}
240
243
241
244
func (f * ring0Factory ) BindFlags (flags * pflag.FlagSet ) {
@@ -267,25 +270,19 @@ func (f *ring0Factory) Printer(mapping *meta.RESTMapping, options kprinters.Prin
267
270
options .Kind = alias
268
271
}
269
272
}
270
- return describe .NewHumanReadablePrinter (options ), nil
273
+ return describe .NewHumanReadablePrinter (f . JSONEncoder (), f . Decoder ( true ), options ), nil
271
274
}
272
275
273
- func (f * ring0Factory ) Pauser (info * resource.Info ) (bool , error ) {
276
+ func (f * ring0Factory ) Pauser (info * resource.Info ) ([]byte , error ) {
277
+ // TODO(rebase): compare with origin master, the logic changed completely
274
278
switch t := info .Object .(type ) {
275
279
case * deployapi.DeploymentConfig :
276
- patches := set .CalculatePatches ([]* resource.Info {info }, f .JSONEncoder (), func (* resource.Info ) (bool , error ) {
277
- if t .Spec .Paused {
278
- return false , nil
279
- }
280
- t .Spec .Paused = true
281
- return true , nil
282
- })
283
- if len (patches ) == 0 {
284
- return true , nil
280
+ if t .Spec .Paused {
281
+ return nil , errors .New ("is already paused" )
285
282
}
286
- _ , err := resource . NewHelper ( info . Client , info . Mapping ). Patch ( info . Namespace , info . Name , kapi . StrategicMergePatchType , patches [ 0 ]. Patch )
283
+ t . Spec . Paused = true
287
284
// TODO: Pause the deployer containers.
288
- return false , err
285
+ return runtime . Encode ( f . JSONEncoder (), info . Object )
289
286
default :
290
287
return f .kubeClientAccessFactory .Pauser (info )
291
288
}
@@ -331,22 +328,16 @@ func (f *ring0Factory) ResolveImage(image string) (string, error) {
331
328
return imageutil .ResolveImagePullSpec (oc , oc , options .Source , image , namespace )
332
329
}
333
330
334
- func (f * ring0Factory ) Resumer (info * resource.Info ) (bool , error ) {
331
+ func (f * ring0Factory ) Resumer (info * resource.Info ) ([]byte , error ) {
332
+ // TODO(rebase): compare with origin master, the logic changed completely
335
333
switch t := info .Object .(type ) {
336
334
case * deployapi.DeploymentConfig :
337
- patches := set .CalculatePatches ([]* resource.Info {info }, f .JSONEncoder (), func (* resource.Info ) (bool , error ) {
338
- if ! t .Spec .Paused {
339
- return false , nil
340
- }
341
- t .Spec .Paused = false
342
- return true , nil
343
- })
344
- if len (patches ) == 0 {
345
- return true , nil
335
+ if ! t .Spec .Paused {
336
+ return nil , errors .New ("is not paused" )
346
337
}
347
- _ , err := resource . NewHelper ( info . Client , info . Mapping ). Patch ( info . Namespace , info . Name , kapi . StrategicMergePatchType , patches [ 0 ]. Patch )
338
+ t . Spec . Paused = false
348
339
// TODO: Resume the deployer containers.
349
- return false , err
340
+ return runtime . Encode ( f . JSONEncoder (), info . Object )
350
341
default :
351
342
return f .kubeClientAccessFactory .Resumer (info )
352
343
}
0 commit comments