Commit 392a4d94 authored by deads2k's avatar deads2k

update client-go staging

parent 4f8f6006
......@@ -324,143 +324,147 @@
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/openapi",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/rand",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "fd5da6b9d070d172e9677941ced569deabdd05ea"
"Rev": "a6364387e6d54a910a0810543a14b6867eafaa99"
}
]
}
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// package openapi holds shared codes and types between open API code generator and spec generator.
package openapi
......@@ -19,11 +19,11 @@ package v1
import (
"fmt"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/fields"
)
// The EventExpansion interface allows manually adding extra methods to the EventInterface.
......
......@@ -17,10 +17,10 @@ limitations under the License.
package fake
import (
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/fields"
"k8s.io/client-go/testing"
)
......
......@@ -21,11 +21,11 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/client-go/pkg/api/resource"
"k8s.io/client-go/pkg/fields"
"k8s.io/client-go/pkg/util/intstr"
utillabels "k8s.io/client-go/pkg/util/labels"
)
......
......@@ -17,9 +17,9 @@ limitations under the License.
package api
import (
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/pkg/fields"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
......
......@@ -27,13 +27,13 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/pkg/api/resource"
"k8s.io/client-go/pkg/fields"
)
// Conversion error conveniently packages up errors in conversions.
......
......@@ -18,11 +18,11 @@ package api
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/pkg/api/resource"
"k8s.io/client-go/pkg/fields"
"k8s.io/client-go/pkg/util/intstr"
)
......@@ -1856,6 +1856,10 @@ type PodSpec struct {
// If specified, the pod's scheduling constraints
// +optional
Affinity *Affinity
// If specified, the pod will be dispatched by specified scheduler.
// If not specified, the pod will be dispatched by default scheduler.
// +optional
SchedulerName string
}
// Sysctl defines a kernel parameter to be set
......
......@@ -174,6 +174,9 @@ func SetDefaults_PodSpec(obj *PodSpec) {
period := int64(DefaultTerminationGracePeriodSeconds)
obj.TerminationGracePeriodSeconds = &period
}
if obj.SchedulerName == "" {
obj.SchedulerName = DefaultSchedulerName
}
}
func SetDefaults_Probe(obj *Probe) {
if obj.TimeoutSeconds == 0 {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2553,6 +2553,11 @@ message PodSpec {
// If specified, the pod's scheduling constraints
// +optional
optional Affinity affinity = 18;
// If specified, the pod will be dispatched by specified scheduler.
// If not specified, the pod will be dispatched by default scheduler.
// +optional
optional string schedulername = 19;
}
// PodStatus represents information about the status of a pod. Status may trail the actual
......
......@@ -22,12 +22,12 @@ import (
"strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/fields"
)
// IsOpaqueIntResourceName returns true if the resource name has the opaque
......
......@@ -2140,6 +2140,10 @@ type PodSpec struct {
// If specified, the pod's scheduling constraints
// +optional
Affinity *Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"`
// If specified, the pod will be dispatched by specified scheduler.
// If not specified, the pod will be dispatched by default scheduler.
// +optional
SchedulerName string `json:"schedulername,omitempty" protobuf:"bytes,19,opt,name=schedulername"`
}
// PodSecurityContext holds pod-level security attributes and common container settings.
......
......@@ -1294,6 +1294,7 @@ var map_PodSpec = map[string]string{
"hostname": "Specifies the hostname of the Pod If not specified, the pod's hostname will be set to a system-defined value.",
"subdomain": "If specified, the fully qualified Pod hostname will be \"<hostname>.<subdomain>.<pod namespace>.svc.<cluster domain>\". If not specified, the pod will not have a domainname at all.",
"affinity": "If specified, the pod's scheduling constraints",
"schedulername": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
}
func (PodSpec) SwaggerDoc() map[string]string {
......
......@@ -3069,6 +3069,7 @@ func autoConvert_v1_PodSpec_To_api_PodSpec(in *PodSpec, out *api.PodSpec, s conv
out.Hostname = in.Hostname
out.Subdomain = in.Subdomain
out.Affinity = (*api.Affinity)(unsafe.Pointer(in.Affinity))
out.SchedulerName = in.SchedulerName
return nil
}
......@@ -3106,6 +3107,7 @@ func autoConvert_api_PodSpec_To_v1_PodSpec(in *api.PodSpec, out *PodSpec, s conv
out.Hostname = in.Hostname
out.Subdomain = in.Subdomain
out.Affinity = (*Affinity)(unsafe.Pointer(in.Affinity))
out.SchedulerName = in.SchedulerName
return nil
}
......
......@@ -23,10 +23,10 @@ package api
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
fields "k8s.io/apimachinery/pkg/fields"
labels "k8s.io/apimachinery/pkg/labels"
runtime "k8s.io/apimachinery/pkg/runtime"
types "k8s.io/apimachinery/pkg/types"
fields "k8s.io/client-go/pkg/fields"
reflect "reflect"
)
......
......@@ -1679,7 +1679,7 @@ func (x codecSelfer1234) decSliceStatefulSet(v *[]StatefulSet, d *codec1978.Deco
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 808)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 824)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......
......@@ -2481,7 +2481,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 832)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 848)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......
......@@ -4534,7 +4534,7 @@ func (x codecSelfer1234) decSliceJob(v *[]Job, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 832)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 848)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......@@ -4772,7 +4772,7 @@ func (x codecSelfer1234) decSliceCronJob(v *[]CronJob, d *codec1978.Decoder) {
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1080)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 1096)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......
......@@ -21093,7 +21093,7 @@ func (x codecSelfer1234) decSliceDeployment(v *[]Deployment, d *codec1978.Decode
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 872)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 888)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......@@ -21212,7 +21212,7 @@ func (x codecSelfer1234) decSliceDaemonSet(v *[]DaemonSet, d *codec1978.Decoder)
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 768)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 784)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......@@ -21926,7 +21926,7 @@ func (x codecSelfer1234) decSliceReplicaSet(v *[]ReplicaSet, d *codec1978.Decode
yyrg1 := len(yyv1) > 0
yyv21 := yyv1
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 808)
yyrl1, yyrt1 = z.DecInferLen(yyl1, z.DecBasicHandle().MaxInitLen, 824)
if yyrt1 {
if yyrl1 <= cap(yyv1) {
yyv1 = yyv1[:yyrl1]
......
......@@ -39,6 +39,7 @@ type MasterConfiguration struct {
Networking Networking
KubernetesVersion string
CloudProvider string
AuthorizationMode string
}
type API struct {
......
......@@ -16,9 +16,7 @@ limitations under the License.
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"
)
import "k8s.io/apimachinery/pkg/runtime"
const (
DefaultServiceDNSDomain = "cluster.local"
......@@ -27,6 +25,7 @@ const (
DefaultKubernetesFallbackVersion = "v1.5.0"
DefaultAPIBindPort = 6443
DefaultDiscoveryBindPort = 9898
DefaultAuthorizationMode = "RBAC"
)
func addDefaultingFuncs(scheme *runtime.Scheme) error {
......@@ -56,4 +55,8 @@ func SetDefaults_MasterConfiguration(obj *MasterConfiguration) {
if obj.Discovery.Token == nil && obj.Discovery.File == nil && obj.Discovery.HTTPS == nil {
obj.Discovery.Token = &TokenDiscovery{}
}
if obj.AuthorizationMode == "" {
obj.AuthorizationMode = DefaultAuthorizationMode
}
}
......@@ -29,6 +29,7 @@ type MasterConfiguration struct {
Networking Networking `json:"networking"`
KubernetesVersion string `json:"kubernetesVersion"`
CloudProvider string `json:"cloudProvider"`
AuthorizationMode string `json:"authorizationMode"`
}
type API struct {
......
......@@ -90,7 +90,7 @@ func NewSignedCert(cfg Config, key *rsa.PrivateKey, caCert *x509.Certificate, ca
certTmpl := x509.Certificate{
Subject: pkix.Name{
CommonName: cfg.CommonName,
Organization: caCert.Subject.Organization,
Organization: cfg.Organization,
},
DNSNames: cfg.AltNames.DNSNames,
IPAddresses: cfg.AltNames.IPs,
......
......@@ -48,6 +48,13 @@ const (
deleteFromPrimitiveListDirectivePrefix = "$deleteFromPrimitiveList"
)
// JSONMap is a representations of JSON object encoded as map[string]interface{}
// where the children can be either map[string]interface{}, []interface{} or
// primitive type).
// Operating on JSONMap representation is much faster as it doesn't require any
// json marshaling and/or unmarshaling operations.
type JSONMap map[string]interface{}
// IsPreconditionFailed returns true if the provided error indicates
// a precondition failed.
func IsPreconditionFailed(err error) bool {
......@@ -136,11 +143,6 @@ func RequireMetadataKeyUnchanged(key string) PreconditionFunc {
}
}
// Deprecated: Use the synonym CreateTwoWayMergePatch, instead.
func CreateStrategicMergePatch(original, modified []byte, dataStruct interface{}) ([]byte, error) {
return CreateTwoWayMergePatch(original, modified, dataStruct)
}
// CreateTwoWayMergePatch creates a patch that can be passed to StrategicMergePatch from an original
// document and a modified document, which are passed to the method as json encoded content. It will
// return a patch that yields the modified document when applied to the original document, or an error
......@@ -160,12 +162,24 @@ func CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}, f
}
}
patchMap, err := CreateTwoWayMergeMapPatch(originalMap, modifiedMap, dataStruct, fns...)
if err != nil {
return nil, err
}
return json.Marshal(patchMap)
}
// CreateTwoWayMergeMapPatch creates a patch from an original and modified JSON objects,
// encoded JSONMap.
// The serialized version of the map can then be passed to StrategicMergeMapPatch.
func CreateTwoWayMergeMapPatch(original, modified JSONMap, dataStruct interface{}, fns ...PreconditionFunc) (JSONMap, error) {
t, err := getTagStructType(dataStruct)
if err != nil {
return nil, err
}
patchMap, err := diffMaps(originalMap, modifiedMap, t, false, false)
patchMap, err := diffMaps(original, modified, t, false, false)
if err != nil {
return nil, err
}
......@@ -177,7 +191,7 @@ func CreateTwoWayMergePatch(original, modified []byte, dataStruct interface{}, f
}
}
return json.Marshal(patchMap)
return patchMap, nil
}
// Returns a (recursive) strategic merge patch that yields modified when applied to original.
......@@ -494,12 +508,6 @@ loopB:
return patch, nil
}
// Deprecated: StrategicMergePatchData is deprecated. Use the synonym StrategicMergePatch,
// instead, which follows the naming convention of evanphx/json-patch.
func StrategicMergePatchData(original, patch []byte, dataStruct interface{}) ([]byte, error) {
return StrategicMergePatch(original, patch, dataStruct)
}
// StrategicMergePatch applies a strategic merge patch. The patch and the original document
// must be json encoded content. A patch can be created from an original and a modified document
// by calling CreateStrategicMergePatch.
......@@ -524,17 +532,23 @@ func StrategicMergePatch(original, patch []byte, dataStruct interface{}) ([]byte
return nil, errBadJSONDoc
}
t, err := getTagStructType(dataStruct)
result, err := StrategicMergeMapPatch(originalMap, patchMap, dataStruct)
if err != nil {
return nil, err
}
result, err := mergeMap(originalMap, patchMap, t, true)
return json.Marshal(result)
}
// StrategicMergePatch applies a strategic merge patch. The original and patch documents
// must be JSONMap. A patch can be created from an original and modified document by
// calling CreateTwoWayMergeMapPatch.
func StrategicMergeMapPatch(original, patch JSONMap, dataStruct interface{}) (JSONMap, error) {
t, err := getTagStructType(dataStruct)
if err != nil {
return nil, err
}
return json.Marshal(result)
return mergeMap(original, patch, t, true)
}
func getTagStructType(dataStruct interface{}) (reflect.Type, error) {
......
......@@ -35,6 +35,7 @@ import (
"github.com/golang/glog"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
......@@ -44,7 +45,6 @@ import (
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/pkg/api/v1"
pathvalidation "k8s.io/client-go/pkg/api/validation/path"
"k8s.io/client-go/pkg/fields"
"k8s.io/client-go/pkg/util/flowcontrol"
restclientwatch "k8s.io/client-go/rest/watch"
"k8s.io/client-go/tools/metrics"
......
......@@ -21,12 +21,12 @@ import (
"path"
"strings"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/fields"
)
func NewRootGetAction(resource schema.GroupVersionResource, name string) GetActionImpl {
......
......@@ -20,11 +20,11 @@ import (
"time"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/fields"
"k8s.io/client-go/rest"
)
......
......@@ -244,7 +244,7 @@ func (e *eventLogger) eventObserve(newEvent *v1.Event) (*v1.Event, []byte, error
newData, _ := json.Marshal(event)
oldData, _ := json.Marshal(eventCopy2)
patch, err = strategicpatch.CreateStrategicMergePatch(oldData, newData, event)
patch, err = strategicpatch.CreateTwoWayMergePatch(oldData, newData, event)
}
// record our new observation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment