Skip to content

Commit

Permalink
馃悰 Fix client.Apply and client.Merge to satisfy Patch
Browse files Browse the repository at this point in the history
a79f6f1 changed the Patch interface but missed these two
implementations. Their exported variable declarations will catch this
next time.
  • Loading branch information
cbandy committed Mar 4, 2021
1 parent a79f6f1 commit 2fa8b83
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions pkg/client/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,17 @@ import (
"fmt"

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

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 @@ -153,7 +152,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 @@ -170,7 +169,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 2fa8b83

Please sign in to comment.