Merge pull request #64111 from juanvallejo/jvallejo/move-more-helpers

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move CanBeExposed helper from factory_client_access

**Release note**:
```release-note
NONE
```

Moves additional helpers from the "factory_client_access". Continues work from https://github.com/kubernetes/kubernetes/pull/63984 and https://github.com/kubernetes/kubernetes/pull/63884

Moves CanBeExposed from factory_client_access.

cc @soltysh
This commit is contained in:
Kubernetes Submit Queue
2018-05-23 13:50:02 -07:00
committed by GitHub
23 changed files with 327 additions and 129 deletions

View File

@@ -222,9 +222,9 @@ func (o *SetResourcesOptions) Validate() error {
func (o *SetResourcesOptions) Run() error {
allErrs := []error{}
patches := CalculatePatches(o.Infos, scheme.DefaultJSONEncoder(), func(info *resource.Info) ([]byte, error) {
patches := CalculatePatches(o.Infos, scheme.DefaultJSONEncoder(), func(obj runtime.Object) ([]byte, error) {
transformed := false
_, err := o.UpdatePodSpecForObject(info.Object, func(spec *v1.PodSpec) error {
_, err := o.UpdatePodSpecForObject(obj, func(spec *v1.PodSpec) error {
containers, _ := selectContainers(spec.Containers, o.ContainerSelector)
if len(containers) != 0 {
for i := range containers {
@@ -255,11 +255,11 @@ func (o *SetResourcesOptions) Run() error {
return nil, nil
}
// record this change (for rollout history)
if err := o.Recorder.Record(info.Object); err != nil {
if err := o.Recorder.Record(obj); err != nil {
glog.V(4).Infof("error recording current command: %v", err)
}
return runtime.Encode(scheme.DefaultJSONEncoder(), info.Object)
return runtime.Encode(scheme.DefaultJSONEncoder(), obj)
})
for _, patch := range patches {