Skip to content

Commit

Permalink
Merge pull request #1410 from cbandy/client-patch
Browse files Browse the repository at this point in the history
馃悰 Fix client.Apply and client.Merge to satisfy Patch
  • Loading branch information
k8s-ci-robot committed Mar 4, 2021
2 parents 08efa13 + c491478 commit 5a8400a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/client/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,18 @@ import (
"fmt"

jsonpatch "github.com/evanphx/json-patch"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/apimachinery/pkg/util/strategicpatch"
)

var (
// Apply uses server-side apply to patch the given object.
Apply = applyPatch{}
Apply Patch = applyPatch{}

// Merge uses the raw object as a merge patch, without modifications.
// Use MergeFrom if you wish to compute a diff instead.
Merge = mergePatch{}
Merge Patch = mergePatch{}
)

type patch struct {
Expand Down Expand Up @@ -92,7 +91,7 @@ type mergeFromPatch struct {
opts MergeFromOptions
}

// Type implements patch.
// Type implements Patch.
func (s *mergeFromPatch) Type() types.PatchType {
return s.patchType
}
Expand Down Expand Up @@ -188,7 +187,7 @@ func (p mergePatch) Type() types.PatchType {
}

// Data implements Patch.
func (p mergePatch) Data(obj runtime.Object) ([]byte, error) {
func (p mergePatch) Data(obj Object) ([]byte, error) {
// NB(directxman12): we might technically want to be using an actual encoder
// here (in case some more performant encoder is introduced) but this is
// correct and sufficient for our uses (it's what the JSON serializer in
Expand All @@ -205,7 +204,7 @@ func (p applyPatch) Type() types.PatchType {
}

// Data implements Patch.
func (p applyPatch) Data(obj runtime.Object) ([]byte, error) {
func (p applyPatch) Data(obj Object) ([]byte, error) {
// NB(directxman12): we might technically want to be using an actual encoder
// here (in case some more performant encoder is introduced) but this is
// correct and sufficient for our uses (it's what the JSON serializer in
Expand Down

0 comments on commit 5a8400a

Please sign in to comment.