remove unneeded factory codec methods

This commit is contained in:
David Eads
2018-02-21 12:10:38 -05:00
parent be04e7c1b1
commit d8a5420b7c
76 changed files with 543 additions and 362 deletions

View File

@@ -36,6 +36,7 @@ import (
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/cmd/util/editor"
"k8s.io/kubernetes/pkg/kubectl/resource"
"k8s.io/kubernetes/pkg/kubectl/scheme"
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
)
@@ -51,7 +52,6 @@ type SetLastAppliedOptions struct {
ShortOutput bool
CreateAnnotation bool
Output string
Codec runtime.Encoder
PatchBufferList []PatchBuffer
Factory cmdutil.Factory
Out io.Writer
@@ -110,7 +110,6 @@ func (o *SetLastAppliedOptions) Complete(f cmdutil.Factory, cmd *cobra.Command)
o.DryRun = cmdutil.GetDryRunFlag(cmd)
o.Output = cmdutil.GetFlagString(cmd, "output")
o.ShortOutput = o.Output == "name"
o.Codec = f.JSONEncoder()
var err error
o.Mapper, o.Typer = f.Object()
@@ -134,7 +133,7 @@ func (o *SetLastAppliedOptions) Validate(f cmdutil.Factory, cmd *cobra.Command)
if err != nil {
return err
}
patchBuf, diffBuf, patchType, err := editor.GetApplyPatch(info.Object, o.Codec)
patchBuf, diffBuf, patchType, err := editor.GetApplyPatch(info.Object, scheme.DefaultJSONEncoder())
if err != nil {
return err
}
@@ -224,7 +223,7 @@ func (o *SetLastAppliedOptions) getPatch(info *resource.Info) ([]byte, []byte, e
objMap := map[string]map[string]map[string]string{}
metadataMap := map[string]map[string]string{}
annotationsMap := map[string]string{}
localFile, err := runtime.Encode(o.Codec, info.Object)
localFile, err := runtime.Encode(scheme.DefaultJSONEncoder(), info.Object)
if err != nil {
return nil, localFile, err
}