use json merge patches

Signed-off-by: Steve Kriss <steve@heptio.com>
This commit is contained in:
Steve Kriss
2018-05-14 14:34:24 -07:00
parent 014c0e2c4c
commit 6d6f734bc9
18 changed files with 19 additions and 4112 deletions

View File

@@ -21,14 +21,13 @@ import (
"fmt"
"strings"
jsonpatch "github.com/evanphx/json-patch"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"k8s.io/api/apps/v1beta1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"github.com/heptio/ark/pkg/client"
"github.com/heptio/ark/pkg/cmd"
@@ -124,10 +123,10 @@ func NewAddCommand(f client.Factory) *cobra.Command {
updated, err := json.Marshal(arkDeploy)
cmd.CheckError(err)
patchBytes, err := strategicpatch.CreateTwoWayMergePatch(original, updated, v1beta1.Deployment{})
patchBytes, err := jsonpatch.CreateMergePatch(original, updated)
cmd.CheckError(err)
_, err = kubeClient.AppsV1beta1().Deployments(arkDeploy.Namespace).Patch(arkDeploy.Name, types.StrategicMergePatchType, patchBytes)
_, err = kubeClient.AppsV1beta1().Deployments(arkDeploy.Namespace).Patch(arkDeploy.Name, types.MergePatchType, patchBytes)
cmd.CheckError(err)
},
}