upgrade kubefed client to v0.6.1

Signed-off-by: yuswift <yuswiftli@yunify.com>
This commit is contained in:
yuswift
2021-04-06 17:52:54 +08:00
parent 828d2c6d37
commit 82cd5c454e
12 changed files with 66 additions and 70 deletions

View File

@@ -19,7 +19,7 @@ package util
import (
"encoding/json"
"github.com/evanphx/json-patch"
jsonpatch "github.com/evanphx/json-patch"
"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -159,8 +159,8 @@ func UnstructuredToInterface(rawObj *unstructured.Unstructured, obj interface{})
return json.Unmarshal(content, obj)
}
// ApplyJsonPatch applies the override on to the given unstructured object.
func ApplyJsonPatch(obj *unstructured.Unstructured, overrides ClusterOverrides) error {
// ApplyJSONPatch applies the override on to the given unstructured object.
func ApplyJSONPatch(obj *unstructured.Unstructured, overrides ClusterOverrides) error {
// TODO: Do the defaulting of "op" field to "replace" in API defaulting
for i, overrideItem := range overrides {
if overrideItem.Op == "" {
@@ -177,12 +177,12 @@ func ApplyJsonPatch(obj *unstructured.Unstructured, overrides ClusterOverrides)
return err
}
ObjectJSONBytes, err := obj.MarshalJSON()
objectJSONBytes, err := obj.MarshalJSON()
if err != nil {
return err
}
patchedObjectJSONBytes, err := patch.Apply(ObjectJSONBytes)
patchedObjectJSONBytes, err := patch.Apply(objectJSONBytes)
if err != nil {
return err
}