support patch list of primitives

This commit is contained in:
ymqytw
2016-11-01 09:30:21 -07:00
parent 916f526811
commit 34891ad9f6
27 changed files with 2659 additions and 1661 deletions

View File

@@ -192,6 +192,14 @@ func (o *LabelOptions) RunLabel(f cmdutil.Factory, cmd *cobra.Command) error {
return err
}
smPatchVersion := strategicpatch.SMPatchVersionLatest
if !o.local {
smPatchVersion, err = cmdutil.GetServerSupportedSMPatchVersionFromFactory(f)
if err != nil {
return err
}
}
// only apply resource version locking on a single resource
if !one && len(o.resourceVersion) > 0 {
return fmt.Errorf("--resource-version may only be used with a single resource")
@@ -246,7 +254,7 @@ func (o *LabelOptions) RunLabel(f cmdutil.Factory, cmd *cobra.Command) error {
if !reflect.DeepEqual(oldData, newData) {
dataChangeMsg = "labeled"
}
patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, obj)
patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldData, newData, obj, smPatchVersion)
createdPatch := err == nil
if err != nil {
glog.V(2).Infof("couldn't compute patch: %v", err)