Commit 26675562 authored by deads2k's avatar deads2k

update client-go

parent 2cb17cc6
......@@ -324,151 +324,163 @@
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/announced",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apimachinery/registered",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/openapi",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/rand",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/netutil",
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "02fccf9462f0fb0287e82cb8a0f1d03b05f8d704"
"Rev": "e0f5fdb097647ab1d282af70228f0a742cf61c65"
}
]
}
......@@ -74,6 +74,9 @@ message APIResource {
// verbs is a list of supported kube verbs (this includes get, list, watch, create,
// update, patch, delete, deletecollection, and proxy)
optional Verbs verbs = 4;
// shortNames is a list of suggested short names of the resource.
repeated string shortNames = 5;
}
// APIResourceList is a list of APIResource, it is used to expose the name of the
......
......@@ -42,6 +42,7 @@ func AddToGroupVersion(scheme *runtime.Scheme, groupVersion schema.GroupVersion)
schema.GroupVersion{Group: groupVersion.Group, Version: runtime.APIVersionInternal}.WithKind(WatchEventKind),
&InternalEvent{},
)
// Supports legacy code paths, most callers should use metav1.ParameterCodec for now
scheme.AddKnownTypes(groupVersion,
&ListOptions{},
&ExportOptions{},
......@@ -65,5 +66,8 @@ var ParameterCodec = runtime.NewParameterCodec(scheme)
func init() {
scheme.AddUnversionedTypes(SchemeGroupVersion,
&ListOptions{},
&ExportOptions{},
&GetOptions{},
&DeleteOptions{},
)
}
......@@ -648,6 +648,8 @@ type APIResource struct {
// verbs is a list of supported kube verbs (this includes get, list, watch, create,
// update, patch, delete, deletecollection, and proxy)
Verbs Verbs `json:"verbs" protobuf:"bytes,4,opt,name=verbs"`
// shortNames is a list of suggested short names of the resource.
ShortNames []string `json:"shortNames,omitempty" protobuf:"bytes,5,rep,name=shortNames"`
}
// Verbs masks the value so protobuf can generate
......
......@@ -54,6 +54,7 @@ var map_APIResource = map[string]string{
"namespaced": "namespaced indicates if a resource is namespaced or not.",
"kind": "kind is the kind for the resource (e.g. 'Foo' is the kind for a resource 'foo')",
"verbs": "verbs is a list of supported kube verbs (this includes get, list, watch, create, update, patch, delete, deletecollection, and proxy)",
"shortNames": "shortNames is a list of suggested short names of the resource.",
}
func (APIResource) SwaggerDoc() map[string]string {
......
......@@ -115,6 +115,11 @@ func DeepCopy_v1_APIResource(in interface{}, out interface{}, c *conversion.Clon
*out = make(Verbs, len(*in))
copy(*out, *in)
}
if in.ShortNames != nil {
in, out := &in.ShortNames, &out.ShortNames
*out = make([]string, len(*in))
copy(*out, *in)
}
return nil
}
}
......
......@@ -23,7 +23,7 @@ import (
"strings"
"k8s.io/apimachinery/pkg/util/json"
forkedjson "k8s.io/client-go/third_party/forked/golang/json"
forkedjson "k8s.io/apimachinery/third_party/forked/golang/json"
"github.com/davecgh/go-spew/spew"
"github.com/ghodss/yaml"
......
......@@ -69,11 +69,10 @@ func (d *YAMLToJSONDecoder) Decode(into interface{}) error {
}
if len(bytes) != 0 {
data, err := yaml.YAMLToJSON(bytes)
err := yaml.Unmarshal(bytes, into)
if err != nil {
return err
return YAMLSyntaxError{err}
}
return json.Unmarshal(data, into)
}
return err
}
......@@ -184,6 +183,23 @@ type YAMLOrJSONDecoder struct {
rawData []byte
}
type JSONSyntaxError struct {
Line int
Err error
}
func (e JSONSyntaxError) Error() string {
return fmt.Sprintf("json: line %d: %s", e.Line, e.Err.Error())
}
type YAMLSyntaxError struct {
err error
}
func (e YAMLSyntaxError) Error() string {
return e.err.Error()
}
// NewYAMLOrJSONDecoder returns a decoder that will process YAML documents
// or JSON documents from the given reader as a stream. bufferSize determines
// how far into the stream the decoder will look to figure out whether this
......@@ -226,7 +242,10 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
start := strings.LastIndex(js[:syntax.Offset], "\n") + 1
line := strings.Count(js[:start], "\n")
return fmt.Errorf("json: line %d: %s", line, syntax.Error())
return JSONSyntaxError{
Line: line,
Err: fmt.Errorf(syntax.Error()),
}
}
}
return err
......
......@@ -30,9 +30,9 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/third_party/forked/golang/netutil"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/util/httpstream"
"k8s.io/client-go/third_party/forked/golang/netutil"
)
// SpdyRoundTripper knows how to upgrade an HTTP request to one that supports
......
/*
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 util
// A simple trie implementation with Add an HasPrefix methods only.
type Trie struct {
children map[byte]*Trie
wordTail bool
word string
}
// CreateTrie creates a Trie and add all strings in the provided list to it.
func CreateTrie(list []string) Trie {
ret := Trie{
children: make(map[byte]*Trie),
wordTail: false,
}
for _, v := range list {
ret.Add(v)
}
return ret
}
// Add adds a word to this trie
func (t *Trie) Add(v string) {
root := t
for _, b := range []byte(v) {
child, exists := root.children[b]
if !exists {
child = &Trie{
children: make(map[byte]*Trie),
wordTail: false,
}
root.children[b] = child
}
root = child
}
root.wordTail = true
root.word = v
}
// HasPrefix returns true of v has any of the prefixes stored in this trie.
func (t *Trie) HasPrefix(v string) bool {
_, has := t.GetPrefix(v)
return has
}
// GetPrefix is like HasPrefix but return the prefix in case of match or empty string otherwise.
func (t *Trie) GetPrefix(v string) (string, bool) {
root := t
if root.wordTail {
return root.word, true
}
for _, b := range []byte(v) {
child, exists := root.children[b]
if !exists {
return "", false
}
if child.wordTail {
return child.word, true
}
root = child
}
return "", false
}
......@@ -28,9 +28,9 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/strategicpatch"
_ "k8s.io/client-go/pkg/api/install" // To register api.Pod used in tests below
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/util/strategicpatch"
restclient "k8s.io/client-go/rest"
"k8s.io/client-go/util/clock"
)
......
......@@ -27,8 +27,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/strategicpatch"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/util/strategicpatch"
"k8s.io/client-go/util/clock"
)
......
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