published by bot

(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 124fb610dcbd445fa710da67508ac6d5b822f61d
This commit is contained in:
Kubernetes Publisher 2016-11-24 08:15:51 +00:00
parent ecd05810bd
commit 5d8c36c93c
241 changed files with 5806 additions and 3601 deletions

2
Godeps/Godeps.json generated
View File

@ -1,7 +1,7 @@
{ {
"ImportPath": "k8s.io/client-go", "ImportPath": "k8s.io/client-go",
"GoVersion": "go1.7", "GoVersion": "go1.7",
"GodepVersion": "v75", "GodepVersion": "v74",
"Packages": [ "Packages": [
"./..." "./..."
], ],

View File

@ -30,6 +30,7 @@ import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/runtime/serializer" "k8s.io/client-go/pkg/runtime/serializer"
"k8s.io/client-go/pkg/version" "k8s.io/client-go/pkg/version"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
@ -69,10 +70,10 @@ type ServerResourcesInterface interface {
ServerResources() (map[string]*unversioned.APIResourceList, error) ServerResources() (map[string]*unversioned.APIResourceList, error)
// ServerPreferredResources returns the supported resources with the version preferred by the // ServerPreferredResources returns the supported resources with the version preferred by the
// server. // server.
ServerPreferredResources() ([]unversioned.GroupVersionResource, error) ServerPreferredResources() ([]schema.GroupVersionResource, error)
// ServerPreferredNamespacedResources returns the supported namespaced resources with the // ServerPreferredNamespacedResources returns the supported namespaced resources with the
// version preferred by the server. // version preferred by the server.
ServerPreferredNamespacedResources() ([]unversioned.GroupVersionResource, error) ServerPreferredNamespacedResources() ([]schema.GroupVersionResource, error)
} }
// ServerVersionInterface has a method for retrieving the server's version. // ServerVersionInterface has a method for retrieving the server's version.
@ -84,7 +85,7 @@ type ServerVersionInterface interface {
// SwaggerSchemaInterface has a method to retrieve the swagger schema. // SwaggerSchemaInterface has a method to retrieve the swagger schema.
type SwaggerSchemaInterface interface { type SwaggerSchemaInterface interface {
// SwaggerSchema retrieves and parses the swagger API schema the server supports. // SwaggerSchema retrieves and parses the swagger API schema the server supports.
SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error)
} }
// DiscoveryClient implements the functions that discover server-supported API groups, // DiscoveryClient implements the functions that discover server-supported API groups,
@ -186,7 +187,7 @@ func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResource
// ErrGroupDiscoveryFailed is returned if one or more API groups fail to load. // ErrGroupDiscoveryFailed is returned if one or more API groups fail to load.
type ErrGroupDiscoveryFailed struct { type ErrGroupDiscoveryFailed struct {
// Groups is a list of the groups that failed to load and the error cause // Groups is a list of the groups that failed to load and the error cause
Groups map[unversioned.GroupVersion]error Groups map[schema.GroupVersion]error
} }
// Error implements the error interface // Error implements the error interface
@ -208,40 +209,57 @@ func IsGroupDiscoveryFailedError(err error) bool {
// serverPreferredResources returns the supported resources with the version preferred by the // serverPreferredResources returns the supported resources with the version preferred by the
// server. If namespaced is true, only namespaced resources will be returned. // server. If namespaced is true, only namespaced resources will be returned.
func (d *DiscoveryClient) serverPreferredResources(namespaced bool) ([]unversioned.GroupVersionResource, error) { func (d *DiscoveryClient) serverPreferredResources(namespaced bool) ([]schema.GroupVersionResource, error) {
// retry in case the groups supported by the server change after ServerGroup() returns. // retry in case the groups supported by the server change after ServerGroup() returns.
const maxRetries = 2 const maxRetries = 2
var failedGroups map[unversioned.GroupVersion]error var failedGroups map[schema.GroupVersion]error
var results []unversioned.GroupVersionResource var results []schema.GroupVersionResource
var resources map[schema.GroupResource]string
RetrieveGroups: RetrieveGroups:
for i := 0; i < maxRetries; i++ { for i := 0; i < maxRetries; i++ {
results = []unversioned.GroupVersionResource{} results = []schema.GroupVersionResource{}
failedGroups = make(map[unversioned.GroupVersion]error) resources = map[schema.GroupResource]string{}
failedGroups = make(map[schema.GroupVersion]error)
serverGroupList, err := d.ServerGroups() serverGroupList, err := d.ServerGroups()
if err != nil { if err != nil {
return results, err return results, err
} }
for _, apiGroup := range serverGroupList.Groups { for _, apiGroup := range serverGroupList.Groups {
preferredVersion := apiGroup.PreferredVersion versions := apiGroup.Versions
groupVersion := unversioned.GroupVersion{Group: apiGroup.Name, Version: preferredVersion.Version} for _, version := range versions {
apiResourceList, err := d.ServerResourcesForGroupVersion(preferredVersion.GroupVersion) groupVersion := schema.GroupVersion{Group: apiGroup.Name, Version: version.Version}
if err != nil { apiResourceList, err := d.ServerResourcesForGroupVersion(version.GroupVersion)
if i < maxRetries-1 { if err != nil {
continue RetrieveGroups if i < maxRetries-1 {
} continue RetrieveGroups
failedGroups[groupVersion] = err }
continue failedGroups[groupVersion] = err
}
for _, apiResource := range apiResourceList.APIResources {
// ignore the root scoped resources if "namespaced" is true.
if namespaced && !apiResource.Namespaced {
continue continue
} }
if strings.Contains(apiResource.Name, "/") { for _, apiResource := range apiResourceList.APIResources {
continue // ignore the root scoped resources if "namespaced" is true.
if namespaced && !apiResource.Namespaced {
continue
}
if strings.Contains(apiResource.Name, "/") {
continue
}
gvr := groupVersion.WithResource(apiResource.Name)
if _, ok := resources[gvr.GroupResource()]; ok {
if gvr.Version != apiGroup.PreferredVersion.Version {
continue
}
// remove previous entry, because it will be replaced with a preferred one
for i := range results {
if results[i].GroupResource() == gvr.GroupResource() {
results = append(results[:i], results[i+1:]...)
}
}
}
resources[gvr.GroupResource()] = gvr.Version
results = append(results, gvr)
} }
results = append(results, groupVersion.WithResource(apiResource.Name))
} }
} }
if len(failedGroups) == 0 { if len(failedGroups) == 0 {
@ -253,13 +271,13 @@ RetrieveGroups:
// ServerPreferredResources returns the supported resources with the version preferred by the // ServerPreferredResources returns the supported resources with the version preferred by the
// server. // server.
func (d *DiscoveryClient) ServerPreferredResources() ([]unversioned.GroupVersionResource, error) { func (d *DiscoveryClient) ServerPreferredResources() ([]schema.GroupVersionResource, error) {
return d.serverPreferredResources(false) return d.serverPreferredResources(false)
} }
// ServerPreferredNamespacedResources returns the supported namespaced resources with the // ServerPreferredNamespacedResources returns the supported namespaced resources with the
// version preferred by the server. // version preferred by the server.
func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]unversioned.GroupVersionResource, error) { func (d *DiscoveryClient) ServerPreferredNamespacedResources() ([]schema.GroupVersionResource, error) {
return d.serverPreferredResources(true) return d.serverPreferredResources(true)
} }
@ -278,7 +296,7 @@ func (d *DiscoveryClient) ServerVersion() (*version.Info, error) {
} }
// SwaggerSchema retrieves and parses the swagger API schema the server supports. // SwaggerSchema retrieves and parses the swagger API schema the server supports.
func (d *DiscoveryClient) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) { func (d *DiscoveryClient) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) {
if version.Empty() { if version.Empty() {
return nil, fmt.Errorf("groupVersion cannot be empty") return nil, fmt.Errorf("groupVersion cannot be empty")
} }

View File

@ -27,6 +27,7 @@ import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/version" "k8s.io/client-go/pkg/version"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
) )
@ -312,7 +313,7 @@ func TestGetSwaggerSchemaFail(t *testing.T) {
defer server.Close() defer server.Close()
client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL}) client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL})
got, err := client.SwaggerSchema(unversioned.GroupVersion{Group: "api.group", Version: "v4"}) got, err := client.SwaggerSchema(schema.GroupVersion{Group: "api.group", Version: "v4"})
if got != nil { if got != nil {
t.Fatalf("unexpected response: %v", got) t.Fatalf("unexpected response: %v", got)
} }
@ -321,7 +322,7 @@ func TestGetSwaggerSchemaFail(t *testing.T) {
} }
} }
func TestGetServerPreferredResources(t *testing.T) { func TestServerPreferredResources(t *testing.T) {
stable := unversioned.APIResourceList{ stable := unversioned.APIResourceList{
GroupVersion: "v1", GroupVersion: "v1",
APIResources: []unversioned.APIResource{ APIResources: []unversioned.APIResource{
@ -330,14 +331,6 @@ func TestGetServerPreferredResources(t *testing.T) {
{Name: "namespaces", Namespaced: false, Kind: "Namespace"}, {Name: "namespaces", Namespaced: false, Kind: "Namespace"},
}, },
} }
/*beta := unversioned.APIResourceList{
GroupVersion: "extensions/v1",
APIResources: []unversioned.APIResource{
{Name: "deployments", Namespaced: true, Kind: "Deployment"},
{Name: "ingresses", Namespaced: true, Kind: "Ingress"},
{Name: "jobs", Namespaced: true, Kind: "Job"},
},
}*/
tests := []struct { tests := []struct {
resourcesList *unversioned.APIResourceList resourcesList *unversioned.APIResourceList
response func(w http.ResponseWriter, req *http.Request) response func(w http.ResponseWriter, req *http.Request)
@ -427,9 +420,6 @@ func TestGetServerPreferredResources(t *testing.T) {
w.Write(output) w.Write(output)
}, },
}, },
/*{
resourcesList: &stable,
},*/
} }
for _, test := range tests { for _, test := range tests {
server := httptest.NewServer(http.HandlerFunc(test.response)) server := httptest.NewServer(http.HandlerFunc(test.response))
@ -455,7 +445,7 @@ func TestGetServerPreferredResources(t *testing.T) {
} }
} }
func TestGetServerPreferredResourcesRetries(t *testing.T) { func TestServerPreferredResourcesRetries(t *testing.T) {
stable := unversioned.APIResourceList{ stable := unversioned.APIResourceList{
GroupVersion: "v1", GroupVersion: "v1",
APIResources: []unversioned.APIResource{ APIResources: []unversioned.APIResource{
@ -553,3 +543,173 @@ func TestGetServerPreferredResourcesRetries(t *testing.T) {
server.Close() server.Close()
} }
} }
func TestServerPreferredNamespacedResources(t *testing.T) {
stable := unversioned.APIResourceList{
GroupVersion: "v1",
APIResources: []unversioned.APIResource{
{Name: "pods", Namespaced: true, Kind: "Pod"},
{Name: "services", Namespaced: true, Kind: "Service"},
{Name: "namespaces", Namespaced: false, Kind: "Namespace"},
},
}
batchv1 := unversioned.APIResourceList{
GroupVersion: "batch/v1",
APIResources: []unversioned.APIResource{
{Name: "jobs", Namespaced: true, Kind: "Job"},
},
}
batchv2alpha1 := unversioned.APIResourceList{
GroupVersion: "batch/v2alpha1",
APIResources: []unversioned.APIResource{
{Name: "jobs", Namespaced: true, Kind: "Job"},
{Name: "cronjobs", Namespaced: true, Kind: "CronJob"},
},
}
batchv3alpha1 := unversioned.APIResourceList{
GroupVersion: "batch/v3alpha1",
APIResources: []unversioned.APIResource{
{Name: "jobs", Namespaced: true, Kind: "Job"},
{Name: "cronjobs", Namespaced: true, Kind: "CronJob"},
},
}
tests := []struct {
response func(w http.ResponseWriter, req *http.Request)
expected []schema.GroupVersionResource
}{
{
response: func(w http.ResponseWriter, req *http.Request) {
var list interface{}
switch req.URL.Path {
case "/api/v1":
list = &stable
case "/api":
list = &unversioned.APIVersions{
Versions: []string{
"v1",
},
}
default:
t.Logf("unexpected request: %s", req.URL.Path)
w.WriteHeader(http.StatusNotFound)
return
}
output, err := json.Marshal(list)
if err != nil {
t.Errorf("unexpected encoding error: %v", err)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(output)
},
expected: []schema.GroupVersionResource{
{Group: "", Version: "v1", Resource: "pods"},
{Group: "", Version: "v1", Resource: "services"},
},
},
{
response: func(w http.ResponseWriter, req *http.Request) {
var list interface{}
switch req.URL.Path {
case "/apis":
list = &unversioned.APIGroupList{
Groups: []unversioned.APIGroup{
{
Name: "batch",
Versions: []unversioned.GroupVersionForDiscovery{
{GroupVersion: "batch/v1", Version: "v1"},
{GroupVersion: "batch/v2alpha1", Version: "v2alpha1"},
{GroupVersion: "batch/v3alpha1", Version: "v3alpha1"},
},
PreferredVersion: unversioned.GroupVersionForDiscovery{GroupVersion: "batch/v1", Version: "v1"},
},
},
}
case "/apis/batch/v1":
list = &batchv1
case "/apis/batch/v2alpha1":
list = &batchv2alpha1
case "/apis/batch/v3alpha1":
list = &batchv3alpha1
default:
t.Logf("unexpected request: %s", req.URL.Path)
w.WriteHeader(http.StatusNotFound)
return
}
output, err := json.Marshal(list)
if err != nil {
t.Errorf("unexpected encoding error: %v", err)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(output)
},
expected: []schema.GroupVersionResource{
{Group: "batch", Version: "v1", Resource: "jobs"},
{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"},
},
},
{
response: func(w http.ResponseWriter, req *http.Request) {
var list interface{}
switch req.URL.Path {
case "/apis":
list = &unversioned.APIGroupList{
Groups: []unversioned.APIGroup{
{
Name: "batch",
Versions: []unversioned.GroupVersionForDiscovery{
{GroupVersion: "batch/v1", Version: "v1"},
{GroupVersion: "batch/v2alpha1", Version: "v2alpha1"},
{GroupVersion: "batch/v3alpha1", Version: "v3alpha1"},
},
PreferredVersion: unversioned.GroupVersionForDiscovery{GroupVersion: "batch/v2alpha", Version: "v2alpha1"},
},
},
}
case "/apis/batch/v1":
list = &batchv1
case "/apis/batch/v2alpha1":
list = &batchv2alpha1
case "/apis/batch/v3alpha1":
list = &batchv3alpha1
default:
t.Logf("unexpected request: %s", req.URL.Path)
w.WriteHeader(http.StatusNotFound)
return
}
output, err := json.Marshal(list)
if err != nil {
t.Errorf("unexpected encoding error: %v", err)
return
}
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
w.Write(output)
},
expected: []schema.GroupVersionResource{
{Group: "batch", Version: "v2alpha1", Resource: "jobs"},
{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"},
},
},
}
for _, test := range tests {
server := httptest.NewServer(http.HandlerFunc(test.response))
defer server.Close()
client := NewDiscoveryClientForConfigOrDie(&rest.Config{Host: server.URL})
got, err := client.ServerPreferredNamespacedResources()
if err != nil {
t.Errorf("unexpected error: %v", err)
continue
}
// we need deterministic order and since during processing in ServerPreferredNamespacedResources
// a map comes into play the result needs sorting
if !reflect.DeepEqual(got, test.expected) {
t.Errorf("expected:\n%v\ngot:\n%v\n", test.expected, got)
}
server.Close()
}
}

View File

@ -20,6 +20,7 @@ import (
"github.com/emicklei/go-restful/swagger" "github.com/emicklei/go-restful/swagger"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/version" "k8s.io/client-go/pkg/version"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"k8s.io/client-go/testing" "k8s.io/client-go/testing"
@ -32,7 +33,7 @@ type FakeDiscovery struct {
func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*unversioned.APIResourceList, error) { func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*unversioned.APIResourceList, error) {
action := testing.ActionImpl{ action := testing.ActionImpl{
Verb: "get", Verb: "get",
Resource: unversioned.GroupVersionResource{Resource: "resource"}, Resource: schema.GroupVersionResource{Resource: "resource"},
} }
c.Invokes(action, nil) c.Invokes(action, nil)
return c.Resources[groupVersion], nil return c.Resources[groupVersion], nil
@ -41,17 +42,17 @@ func (c *FakeDiscovery) ServerResourcesForGroupVersion(groupVersion string) (*un
func (c *FakeDiscovery) ServerResources() (map[string]*unversioned.APIResourceList, error) { func (c *FakeDiscovery) ServerResources() (map[string]*unversioned.APIResourceList, error) {
action := testing.ActionImpl{ action := testing.ActionImpl{
Verb: "get", Verb: "get",
Resource: unversioned.GroupVersionResource{Resource: "resource"}, Resource: schema.GroupVersionResource{Resource: "resource"},
} }
c.Invokes(action, nil) c.Invokes(action, nil)
return c.Resources, nil return c.Resources, nil
} }
func (c *FakeDiscovery) ServerPreferredResources() ([]unversioned.GroupVersionResource, error) { func (c *FakeDiscovery) ServerPreferredResources() ([]schema.GroupVersionResource, error) {
return nil, nil return nil, nil
} }
func (c *FakeDiscovery) ServerPreferredNamespacedResources() ([]unversioned.GroupVersionResource, error) { func (c *FakeDiscovery) ServerPreferredNamespacedResources() ([]schema.GroupVersionResource, error) {
return nil, nil return nil, nil
} }
@ -62,20 +63,20 @@ func (c *FakeDiscovery) ServerGroups() (*unversioned.APIGroupList, error) {
func (c *FakeDiscovery) ServerVersion() (*version.Info, error) { func (c *FakeDiscovery) ServerVersion() (*version.Info, error) {
action := testing.ActionImpl{} action := testing.ActionImpl{}
action.Verb = "get" action.Verb = "get"
action.Resource = unversioned.GroupVersionResource{Resource: "version"} action.Resource = schema.GroupVersionResource{Resource: "version"}
c.Invokes(action, nil) c.Invokes(action, nil)
versionInfo := version.Get() versionInfo := version.Get()
return &versionInfo, nil return &versionInfo, nil
} }
func (c *FakeDiscovery) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) { func (c *FakeDiscovery) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) {
action := testing.ActionImpl{} action := testing.ActionImpl{}
action.Verb = "get" action.Verb = "get"
if version == v1.SchemeGroupVersion { if version == v1.SchemeGroupVersion {
action.Resource = unversioned.GroupVersionResource{Resource: "/swaggerapi/api/" + version.Version} action.Resource = schema.GroupVersionResource{Resource: "/swaggerapi/api/" + version.Version}
} else { } else {
action.Resource = unversioned.GroupVersionResource{Resource: "/swaggerapi/apis/" + version.Group + "/" + version.Version} action.Resource = schema.GroupVersionResource{Resource: "/swaggerapi/apis/" + version.Group + "/" + version.Version}
} }
c.Invokes(action, nil) c.Invokes(action, nil)

View File

@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/util/sets" "k8s.io/client-go/pkg/util/sets"
"k8s.io/client-go/pkg/version" "k8s.io/client-go/pkg/version"
// Import solely to initialize client auth plugins. // Import solely to initialize client auth plugins.
@ -49,7 +50,7 @@ func MatchesServerVersion(client DiscoveryInterface) error {
// preference. // preference.
// - If version is provided and the server does not support it, // - If version is provided and the server does not support it,
// return an error. // return an error.
func NegotiateVersion(client DiscoveryInterface, requiredGV *unversioned.GroupVersion, clientRegisteredGVs []unversioned.GroupVersion) (*unversioned.GroupVersion, error) { func NegotiateVersion(client DiscoveryInterface, requiredGV *schema.GroupVersion, clientRegisteredGVs []schema.GroupVersion) (*schema.GroupVersion, error) {
clientVersions := sets.String{} clientVersions := sets.String{}
for _, gv := range clientRegisteredGVs { for _, gv := range clientRegisteredGVs {
clientVersions.Insert(gv.String()) clientVersions.Insert(gv.String())

View File

@ -32,6 +32,7 @@ import (
uapi "k8s.io/client-go/pkg/api/unversioned" uapi "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apimachinery/registered" "k8s.io/client-go/pkg/apimachinery/registered"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"k8s.io/client-go/rest/fake" "k8s.io/client-go/rest/fake"
) )
@ -47,10 +48,10 @@ func objBody(object interface{}) io.ReadCloser {
func TestNegotiateVersion(t *testing.T) { func TestNegotiateVersion(t *testing.T) {
tests := []struct { tests := []struct {
name string name string
requiredVersion *uapi.GroupVersion requiredVersion *schema.GroupVersion
expectedVersion *uapi.GroupVersion expectedVersion *schema.GroupVersion
serverVersions []string serverVersions []string
clientVersions []uapi.GroupVersion clientVersions []schema.GroupVersion
expectErr func(err error) bool expectErr func(err error) bool
sendErr error sendErr error
statusCode int statusCode int
@ -58,60 +59,60 @@ func TestNegotiateVersion(t *testing.T) {
{ {
name: "server supports client default", name: "server supports client default",
serverVersions: []string{"version1", registered.GroupOrDie(api.GroupName).GroupVersion.String()}, serverVersions: []string{"version1", registered.GroupOrDie(api.GroupName).GroupVersion.String()},
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &uapi.GroupVersion{Version: "version1"}, expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusOK, statusCode: http.StatusOK,
}, },
{ {
name: "server falls back to client supported", name: "server falls back to client supported",
serverVersions: []string{"version1"}, serverVersions: []string{"version1"},
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &uapi.GroupVersion{Version: "version1"}, expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusOK, statusCode: http.StatusOK,
}, },
{ {
name: "explicit version supported", name: "explicit version supported",
requiredVersion: &uapi.GroupVersion{Version: "v1"}, requiredVersion: &schema.GroupVersion{Version: "v1"},
serverVersions: []string{"/version1", registered.GroupOrDie(api.GroupName).GroupVersion.String()}, serverVersions: []string{"/version1", registered.GroupOrDie(api.GroupName).GroupVersion.String()},
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &uapi.GroupVersion{Version: "v1"}, expectedVersion: &schema.GroupVersion{Version: "v1"},
statusCode: http.StatusOK, statusCode: http.StatusOK,
}, },
{ {
name: "explicit version not supported on server", name: "explicit version not supported on server",
requiredVersion: &uapi.GroupVersion{Version: "v1"}, requiredVersion: &schema.GroupVersion{Version: "v1"},
serverVersions: []string{"version1"}, serverVersions: []string{"version1"},
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
expectErr: func(err error) bool { return strings.Contains(err.Error(), `server does not support API version "v1"`) }, expectErr: func(err error) bool { return strings.Contains(err.Error(), `server does not support API version "v1"`) },
statusCode: http.StatusOK, statusCode: http.StatusOK,
}, },
{ {
name: "explicit version not supported on client", name: "explicit version not supported on client",
requiredVersion: &uapi.GroupVersion{Version: "v1"}, requiredVersion: &schema.GroupVersion{Version: "v1"},
serverVersions: []string{"v1"}, serverVersions: []string{"v1"},
clientVersions: []uapi.GroupVersion{{Version: "version1"}}, clientVersions: []schema.GroupVersion{{Version: "version1"}},
expectErr: func(err error) bool { return strings.Contains(err.Error(), `client does not support API version "v1"`) }, expectErr: func(err error) bool { return strings.Contains(err.Error(), `client does not support API version "v1"`) },
statusCode: http.StatusOK, statusCode: http.StatusOK,
}, },
{ {
name: "connection refused error", name: "connection refused error",
serverVersions: []string{"version1"}, serverVersions: []string{"version1"},
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
sendErr: errors.New("connection refused"), sendErr: errors.New("connection refused"),
expectErr: func(err error) bool { return strings.Contains(err.Error(), "connection refused") }, expectErr: func(err error) bool { return strings.Contains(err.Error(), "connection refused") },
statusCode: http.StatusOK, statusCode: http.StatusOK,
}, },
{ {
name: "discovery fails due to 403 Forbidden errors and thus serverVersions is empty, use default GroupVersion", name: "discovery fails due to 403 Forbidden errors and thus serverVersions is empty, use default GroupVersion",
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &uapi.GroupVersion{Version: "version1"}, expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusForbidden, statusCode: http.StatusForbidden,
}, },
{ {
name: "discovery fails due to 404 Not Found errors and thus serverVersions is empty, use requested GroupVersion", name: "discovery fails due to 404 Not Found errors and thus serverVersions is empty, use requested GroupVersion",
requiredVersion: &uapi.GroupVersion{Version: "version1"}, requiredVersion: &schema.GroupVersion{Version: "version1"},
clientVersions: []uapi.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion}, clientVersions: []schema.GroupVersion{{Version: "version1"}, registered.GroupOrDie(api.GroupName).GroupVersion},
expectedVersion: &uapi.GroupVersion{Version: "version1"}, expectedVersion: &schema.GroupVersion{Version: "version1"},
statusCode: http.StatusNotFound, statusCode: http.StatusNotFound,
}, },
{ {

View File

@ -23,6 +23,7 @@ import (
"k8s.io/client-go/pkg/api/errors" "k8s.io/client-go/pkg/api/errors"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime/schema"
"github.com/golang/glog" "github.com/golang/glog"
) )
@ -42,8 +43,8 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
unionMapper := meta.MultiRESTMapper{} unionMapper := meta.MultiRESTMapper{}
var groupPriority []string var groupPriority []string
var resourcePriority []unversioned.GroupVersionResource var resourcePriority []schema.GroupVersionResource
var kindPriority []unversioned.GroupVersionKind var kindPriority []schema.GroupVersionKind
for _, group := range groupResources { for _, group := range groupResources {
groupPriority = append(groupPriority, group.Group.Name) groupPriority = append(groupPriority, group.Group.Name)
@ -51,13 +52,13 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
if len(group.Group.PreferredVersion.Version) != 0 { if len(group.Group.PreferredVersion.Version) != 0 {
preferred := group.Group.PreferredVersion.Version preferred := group.Group.PreferredVersion.Version
if _, ok := group.VersionedResources[preferred]; ok { if _, ok := group.VersionedResources[preferred]; ok {
resourcePriority = append(resourcePriority, unversioned.GroupVersionResource{ resourcePriority = append(resourcePriority, schema.GroupVersionResource{
Group: group.Group.Name, Group: group.Group.Name,
Version: group.Group.PreferredVersion.Version, Version: group.Group.PreferredVersion.Version,
Resource: meta.AnyResource, Resource: meta.AnyResource,
}) })
kindPriority = append(kindPriority, unversioned.GroupVersionKind{ kindPriority = append(kindPriority, schema.GroupVersionKind{
Group: group.Group.Name, Group: group.Group.Name,
Version: group.Group.PreferredVersion.Version, Version: group.Group.PreferredVersion.Version,
Kind: meta.AnyKind, Kind: meta.AnyKind,
@ -71,8 +72,8 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
continue continue
} }
gv := unversioned.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version} gv := schema.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
versionMapper := meta.NewDefaultRESTMapper([]unversioned.GroupVersion{gv}, versionInterfaces) versionMapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{gv}, versionInterfaces)
for _, resource := range resources { for _, resource := range resources {
scope := meta.RESTScopeNamespace scope := meta.RESTScopeNamespace
@ -90,12 +91,12 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
} }
for _, group := range groupPriority { for _, group := range groupPriority {
resourcePriority = append(resourcePriority, unversioned.GroupVersionResource{ resourcePriority = append(resourcePriority, schema.GroupVersionResource{
Group: group, Group: group,
Version: meta.AnyVersion, Version: meta.AnyVersion,
Resource: meta.AnyResource, Resource: meta.AnyResource,
}) })
kindPriority = append(kindPriority, unversioned.GroupVersionKind{ kindPriority = append(kindPriority, schema.GroupVersionKind{
Group: group, Group: group,
Version: meta.AnyVersion, Version: meta.AnyVersion,
Kind: meta.AnyKind, Kind: meta.AnyKind,
@ -188,10 +189,10 @@ func (d *DeferredDiscoveryRESTMapper) Reset() {
// KindFor takes a partial resource and returns back the single match. // KindFor takes a partial resource and returns back the single match.
// It returns an error if there are multiple matches. // It returns an error if there are multiple matches.
func (d *DeferredDiscoveryRESTMapper) KindFor(resource unversioned.GroupVersionResource) (gvk unversioned.GroupVersionKind, err error) { func (d *DeferredDiscoveryRESTMapper) KindFor(resource schema.GroupVersionResource) (gvk schema.GroupVersionKind, err error) {
del, err := d.getDelegate() del, err := d.getDelegate()
if err != nil { if err != nil {
return unversioned.GroupVersionKind{}, err return schema.GroupVersionKind{}, err
} }
gvk, err = del.KindFor(resource) gvk, err = del.KindFor(resource)
if err != nil && !d.cl.Fresh() { if err != nil && !d.cl.Fresh() {
@ -203,7 +204,7 @@ func (d *DeferredDiscoveryRESTMapper) KindFor(resource unversioned.GroupVersionR
// KindsFor takes a partial resource and returns back the list of // KindsFor takes a partial resource and returns back the list of
// potential kinds in priority order. // potential kinds in priority order.
func (d *DeferredDiscoveryRESTMapper) KindsFor(resource unversioned.GroupVersionResource) (gvks []unversioned.GroupVersionKind, err error) { func (d *DeferredDiscoveryRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvks []schema.GroupVersionKind, err error) {
del, err := d.getDelegate() del, err := d.getDelegate()
if err != nil { if err != nil {
return nil, err return nil, err
@ -218,10 +219,10 @@ func (d *DeferredDiscoveryRESTMapper) KindsFor(resource unversioned.GroupVersion
// ResourceFor takes a partial resource and returns back the single // ResourceFor takes a partial resource and returns back the single
// match. It returns an error if there are multiple matches. // match. It returns an error if there are multiple matches.
func (d *DeferredDiscoveryRESTMapper) ResourceFor(input unversioned.GroupVersionResource) (gvr unversioned.GroupVersionResource, err error) { func (d *DeferredDiscoveryRESTMapper) ResourceFor(input schema.GroupVersionResource) (gvr schema.GroupVersionResource, err error) {
del, err := d.getDelegate() del, err := d.getDelegate()
if err != nil { if err != nil {
return unversioned.GroupVersionResource{}, err return schema.GroupVersionResource{}, err
} }
gvr, err = del.ResourceFor(input) gvr, err = del.ResourceFor(input)
if err != nil && !d.cl.Fresh() { if err != nil && !d.cl.Fresh() {
@ -233,7 +234,7 @@ func (d *DeferredDiscoveryRESTMapper) ResourceFor(input unversioned.GroupVersion
// ResourcesFor takes a partial resource and returns back the list of // ResourcesFor takes a partial resource and returns back the list of
// potential resource in priority order. // potential resource in priority order.
func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input unversioned.GroupVersionResource) (gvrs []unversioned.GroupVersionResource, err error) { func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input schema.GroupVersionResource) (gvrs []schema.GroupVersionResource, err error) {
del, err := d.getDelegate() del, err := d.getDelegate()
if err != nil { if err != nil {
return nil, err return nil, err
@ -248,7 +249,7 @@ func (d *DeferredDiscoveryRESTMapper) ResourcesFor(input unversioned.GroupVersio
// RESTMapping identifies a preferred resource mapping for the // RESTMapping identifies a preferred resource mapping for the
// provided group kind. // provided group kind.
func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (m *meta.RESTMapping, err error) { func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (m *meta.RESTMapping, err error) {
del, err := d.getDelegate() del, err := d.getDelegate()
if err != nil { if err != nil {
return nil, err return nil, err
@ -264,7 +265,7 @@ func (d *DeferredDiscoveryRESTMapper) RESTMapping(gk unversioned.GroupKind, vers
// RESTMappings returns the RESTMappings for the provided group kind // RESTMappings returns the RESTMappings for the provided group kind
// in a rough internal preferred order. If no kind is found, it will // in a rough internal preferred order. If no kind is found, it will
// return a NoResourceMatchError. // return a NoResourceMatchError.
func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk unversioned.GroupKind) (ms []*meta.RESTMapping, err error) { func (d *DeferredDiscoveryRESTMapper) RESTMappings(gk schema.GroupKind) (ms []*meta.RESTMapping, err error) {
del, err := d.getDelegate() del, err := d.getDelegate()
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -23,6 +23,7 @@ import (
"k8s.io/client-go/pkg/api/errors" "k8s.io/client-go/pkg/api/errors"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apimachinery/registered" "k8s.io/client-go/pkg/apimachinery/registered"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/version" "k8s.io/client-go/pkg/version"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
"k8s.io/client-go/rest/fake" "k8s.io/client-go/rest/fake"
@ -69,43 +70,43 @@ func TestRESTMapper(t *testing.T) {
restMapper := NewRESTMapper(resources, nil) restMapper := NewRESTMapper(resources, nil)
kindTCs := []struct { kindTCs := []struct {
input unversioned.GroupVersionResource input schema.GroupVersionResource
want unversioned.GroupVersionKind want schema.GroupVersionKind
}{ }{
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Version: "v1", Version: "v1",
Resource: "pods", Resource: "pods",
}, },
want: unversioned.GroupVersionKind{ want: schema.GroupVersionKind{
Version: "v1", Version: "v1",
Kind: "Pod", Kind: "Pod",
}, },
}, },
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Version: "v2", Version: "v2",
Resource: "pods", Resource: "pods",
}, },
want: unversioned.GroupVersionKind{ want: schema.GroupVersionKind{
Version: "v2", Version: "v2",
Kind: "Pod", Kind: "Pod",
}, },
}, },
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Resource: "pods", Resource: "pods",
}, },
want: unversioned.GroupVersionKind{ want: schema.GroupVersionKind{
Version: "v1", Version: "v1",
Kind: "Pod", Kind: "Pod",
}, },
}, },
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Resource: "jobs", Resource: "jobs",
}, },
want: unversioned.GroupVersionKind{ want: schema.GroupVersionKind{
Group: "extensions", Group: "extensions",
Version: "v1beta", Version: "v1beta",
Kind: "Job", Kind: "Job",
@ -126,43 +127,43 @@ func TestRESTMapper(t *testing.T) {
} }
resourceTCs := []struct { resourceTCs := []struct {
input unversioned.GroupVersionResource input schema.GroupVersionResource
want unversioned.GroupVersionResource want schema.GroupVersionResource
}{ }{
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Version: "v1", Version: "v1",
Resource: "pods", Resource: "pods",
}, },
want: unversioned.GroupVersionResource{ want: schema.GroupVersionResource{
Version: "v1", Version: "v1",
Resource: "pods", Resource: "pods",
}, },
}, },
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Version: "v2", Version: "v2",
Resource: "pods", Resource: "pods",
}, },
want: unversioned.GroupVersionResource{ want: schema.GroupVersionResource{
Version: "v2", Version: "v2",
Resource: "pods", Resource: "pods",
}, },
}, },
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Resource: "pods", Resource: "pods",
}, },
want: unversioned.GroupVersionResource{ want: schema.GroupVersionResource{
Version: "v1", Version: "v1",
Resource: "pods", Resource: "pods",
}, },
}, },
{ {
input: unversioned.GroupVersionResource{ input: schema.GroupVersionResource{
Resource: "jobs", Resource: "jobs",
}, },
want: unversioned.GroupVersionResource{ want: schema.GroupVersionResource{
Group: "extensions", Group: "extensions",
Version: "v1beta", Version: "v1beta",
Resource: "jobs", Resource: "jobs",
@ -191,7 +192,7 @@ func TestDeferredDiscoveryRESTMapper_CacheMiss(t *testing.T) {
assert.False(cdc.fresh, "should NOT be fresh after instantiation") assert.False(cdc.fresh, "should NOT be fresh after instantiation")
assert.Zero(cdc.invalidateCalls, "should not have called Invalidate()") assert.Zero(cdc.invalidateCalls, "should not have called Invalidate()")
gvk, err := m.KindFor(unversioned.GroupVersionResource{ gvk, err := m.KindFor(schema.GroupVersionResource{
Group: "a", Group: "a",
Version: "v1", Version: "v1",
Resource: "foo", Resource: "foo",
@ -201,7 +202,7 @@ func TestDeferredDiscoveryRESTMapper_CacheMiss(t *testing.T) {
assert.Equal(cdc.invalidateCalls, 1, "should have called Invalidate() once") assert.Equal(cdc.invalidateCalls, 1, "should have called Invalidate() once")
assert.Equal(gvk.Kind, "Foo") assert.Equal(gvk.Kind, "Foo")
gvk, err = m.KindFor(unversioned.GroupVersionResource{ gvk, err = m.KindFor(schema.GroupVersionResource{
Group: "a", Group: "a",
Version: "v1", Version: "v1",
Resource: "foo", Resource: "foo",
@ -209,7 +210,7 @@ func TestDeferredDiscoveryRESTMapper_CacheMiss(t *testing.T) {
assert.NoError(err) assert.NoError(err)
assert.Equal(cdc.invalidateCalls, 1, "should NOT have called Invalidate() again") assert.Equal(cdc.invalidateCalls, 1, "should NOT have called Invalidate() again")
gvk, err = m.KindFor(unversioned.GroupVersionResource{ gvk, err = m.KindFor(schema.GroupVersionResource{
Group: "a", Group: "a",
Version: "v1", Version: "v1",
Resource: "bar", Resource: "bar",
@ -218,7 +219,7 @@ func TestDeferredDiscoveryRESTMapper_CacheMiss(t *testing.T) {
assert.Equal(cdc.invalidateCalls, 1, "should NOT have called Invalidate() again after another cache-miss, but with fresh==true") assert.Equal(cdc.invalidateCalls, 1, "should NOT have called Invalidate() again after another cache-miss, but with fresh==true")
cdc.fresh = false cdc.fresh = false
gvk, err = m.KindFor(unversioned.GroupVersionResource{ gvk, err = m.KindFor(schema.GroupVersionResource{
Group: "a", Group: "a",
Version: "v1", Version: "v1",
Resource: "bar", Resource: "bar",
@ -286,7 +287,7 @@ func (c *fakeCachedDiscoveryInterface) ServerResourcesForGroupVersion(groupVersi
}, nil }, nil
} }
return nil, errors.NewNotFound(unversioned.GroupResource{}, "") return nil, errors.NewNotFound(schema.GroupResource{}, "")
} }
func (c *fakeCachedDiscoveryInterface) ServerResources() (map[string]*unversioned.APIResourceList, error) { func (c *fakeCachedDiscoveryInterface) ServerResources() (map[string]*unversioned.APIResourceList, error) {
@ -299,9 +300,9 @@ func (c *fakeCachedDiscoveryInterface) ServerResources() (map[string]*unversione
return map[string]*unversioned.APIResourceList{}, nil return map[string]*unversioned.APIResourceList{}, nil
} }
func (c *fakeCachedDiscoveryInterface) ServerPreferredResources() ([]unversioned.GroupVersionResource, error) { func (c *fakeCachedDiscoveryInterface) ServerPreferredResources() ([]schema.GroupVersionResource, error) {
if c.enabledA { if c.enabledA {
return []unversioned.GroupVersionResource{ return []schema.GroupVersionResource{
{ {
Group: "a", Group: "a",
Version: "v1", Version: "v1",
@ -309,17 +310,17 @@ func (c *fakeCachedDiscoveryInterface) ServerPreferredResources() ([]unversioned
}, },
}, nil }, nil
} }
return []unversioned.GroupVersionResource{}, nil return []schema.GroupVersionResource{}, nil
} }
func (c *fakeCachedDiscoveryInterface) ServerPreferredNamespacedResources() ([]unversioned.GroupVersionResource, error) { func (c *fakeCachedDiscoveryInterface) ServerPreferredNamespacedResources() ([]schema.GroupVersionResource, error) {
return []unversioned.GroupVersionResource{}, nil return []schema.GroupVersionResource{}, nil
} }
func (c *fakeCachedDiscoveryInterface) ServerVersion() (*version.Info, error) { func (c *fakeCachedDiscoveryInterface) ServerVersion() (*version.Info, error) {
return &version.Info{}, nil return &version.Info{}, nil
} }
func (c *fakeCachedDiscoveryInterface) SwaggerSchema(version unversioned.GroupVersion) (*swagger.ApiDeclaration, error) { func (c *fakeCachedDiscoveryInterface) SwaggerSchema(version schema.GroupVersion) (*swagger.ApiDeclaration, error) {
return &swagger.ApiDeclaration{}, nil return &swagger.ApiDeclaration{}, nil
} }

View File

@ -19,20 +19,20 @@ package discovery
import ( import (
"fmt" "fmt"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
// UnstructuredObjectTyper provides a runtime.ObjectTyper implmentation for // UnstructuredObjectTyper provides a runtime.ObjectTyper implmentation for
// runtime.Unstructured object based on discovery information. // runtime.Unstructured object based on discovery information.
type UnstructuredObjectTyper struct { type UnstructuredObjectTyper struct {
registered map[unversioned.GroupVersionKind]bool registered map[schema.GroupVersionKind]bool
} }
// NewUnstructuredObjectTyper returns a runtime.ObjectTyper for // NewUnstructuredObjectTyper returns a runtime.ObjectTyper for
// unstructred objects based on discovery information. // unstructred objects based on discovery information.
func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *UnstructuredObjectTyper { func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *UnstructuredObjectTyper {
dot := &UnstructuredObjectTyper{registered: make(map[unversioned.GroupVersionKind]bool)} dot := &UnstructuredObjectTyper{registered: make(map[schema.GroupVersionKind]bool)}
for _, group := range groupResources { for _, group := range groupResources {
for _, discoveryVersion := range group.Group.Versions { for _, discoveryVersion := range group.Group.Versions {
resources, ok := group.VersionedResources[discoveryVersion.Version] resources, ok := group.VersionedResources[discoveryVersion.Version]
@ -40,7 +40,7 @@ func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *Unstructur
continue continue
} }
gv := unversioned.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version} gv := schema.GroupVersion{Group: group.Group.Name, Version: discoveryVersion.Version}
for _, resource := range resources { for _, resource := range resources {
dot.registered[gv.WithKind(resource.Kind)] = true dot.registered[gv.WithKind(resource.Kind)] = true
} }
@ -52,9 +52,9 @@ func NewUnstructuredObjectTyper(groupResources []*APIGroupResources) *Unstructur
// ObjectKind returns the group,version,kind of the provided object, or an error // ObjectKind returns the group,version,kind of the provided object, or an error
// if the object in not *runtime.Unstructured or has no group,version,kind // if the object in not *runtime.Unstructured or has no group,version,kind
// information. // information.
func (d *UnstructuredObjectTyper) ObjectKind(obj runtime.Object) (unversioned.GroupVersionKind, error) { func (d *UnstructuredObjectTyper) ObjectKind(obj runtime.Object) (schema.GroupVersionKind, error) {
if _, ok := obj.(*runtime.Unstructured); !ok { if _, ok := obj.(*runtime.Unstructured); !ok {
return unversioned.GroupVersionKind{}, fmt.Errorf("type %T is invalid for dynamic object typer", obj) return schema.GroupVersionKind{}, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
} }
return obj.GetObjectKind().GroupVersionKind(), nil return obj.GetObjectKind().GroupVersionKind(), nil
@ -65,18 +65,18 @@ func (d *UnstructuredObjectTyper) ObjectKind(obj runtime.Object) (unversioned.Gr
// has no group,version,kind information. unversionedType will always be false // has no group,version,kind information. unversionedType will always be false
// because runtime.Unstructured object should always have group,version,kind // because runtime.Unstructured object should always have group,version,kind
// information set. // information set.
func (d *UnstructuredObjectTyper) ObjectKinds(obj runtime.Object) (gvks []unversioned.GroupVersionKind, unversionedType bool, err error) { func (d *UnstructuredObjectTyper) ObjectKinds(obj runtime.Object) (gvks []schema.GroupVersionKind, unversionedType bool, err error) {
gvk, err := d.ObjectKind(obj) gvk, err := d.ObjectKind(obj)
if err != nil { if err != nil {
return nil, false, err return nil, false, err
} }
return []unversioned.GroupVersionKind{gvk}, false, nil return []schema.GroupVersionKind{gvk}, false, nil
} }
// Recognizes returns true if the provided group,version,kind was in the // Recognizes returns true if the provided group,version,kind was in the
// discovery information. // discovery information.
func (d *UnstructuredObjectTyper) Recognizes(gvk unversioned.GroupVersionKind) bool { func (d *UnstructuredObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
return d.registered[gvk] return d.registered[gvk]
} }

View File

@ -31,6 +31,7 @@ import (
"k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/conversion/queryparams" "k8s.io/client-go/pkg/conversion/queryparams"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/runtime/serializer" "k8s.io/client-go/pkg/runtime/serializer"
"k8s.io/client-go/pkg/util/flowcontrol" "k8s.io/client-go/pkg/util/flowcontrol"
"k8s.io/client-go/pkg/watch" "k8s.io/client-go/pkg/watch"
@ -218,7 +219,7 @@ func (rc *ResourceClient) Patch(name string, pt api.PatchType, data []byte) (*ru
// with special handling for Status objects. // with special handling for Status objects.
type dynamicCodec struct{} type dynamicCodec struct{}
func (dynamicCodec) Decode(data []byte, gvk *unversioned.GroupVersionKind, obj runtime.Object) (runtime.Object, *unversioned.GroupVersionKind, error) { func (dynamicCodec) Decode(data []byte, gvk *schema.GroupVersionKind, obj runtime.Object) (runtime.Object, *schema.GroupVersionKind, error) {
obj, gvk, err := runtime.UnstructuredJSONScheme.Decode(data, gvk, obj) obj, gvk, err := runtime.UnstructuredJSONScheme.Decode(data, gvk, obj)
if err != nil { if err != nil {
return nil, nil, err return nil, nil, err
@ -264,11 +265,11 @@ func ContentConfig() rest.ContentConfig {
// parameters without trying to convert to the target version. // parameters without trying to convert to the target version.
type parameterCodec struct{} type parameterCodec struct{}
func (parameterCodec) EncodeParameters(obj runtime.Object, to unversioned.GroupVersion) (url.Values, error) { func (parameterCodec) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) {
return queryparams.Convert(obj) return queryparams.Convert(obj)
} }
func (parameterCodec) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into runtime.Object) error { func (parameterCodec) DecodeParameters(parameters url.Values, from schema.GroupVersion, into runtime.Object) error {
return errors.New("DecodeParameters not implemented on dynamic parameterCodec") return errors.New("DecodeParameters not implemented on dynamic parameterCodec")
} }
@ -276,7 +277,7 @@ var defaultParameterEncoder runtime.ParameterCodec = parameterCodec{}
type versionedParameterEncoderWithV1Fallback struct{} type versionedParameterEncoderWithV1Fallback struct{}
func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Object, to unversioned.GroupVersion) (url.Values, error) { func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Object, to schema.GroupVersion) (url.Values, error) {
ret, err := api.ParameterCodec.EncodeParameters(obj, to) ret, err := api.ParameterCodec.EncodeParameters(obj, to)
if err != nil && runtime.IsNotRegisteredError(err) { if err != nil && runtime.IsNotRegisteredError(err) {
// fallback to v1 // fallback to v1
@ -285,7 +286,7 @@ func (versionedParameterEncoderWithV1Fallback) EncodeParameters(obj runtime.Obje
return ret, err return ret, err
} }
func (versionedParameterEncoderWithV1Fallback) DecodeParameters(parameters url.Values, from unversioned.GroupVersion, into runtime.Object) error { func (versionedParameterEncoderWithV1Fallback) DecodeParameters(parameters url.Values, from schema.GroupVersion, into runtime.Object) error {
return errors.New("DecodeParameters not implemented on versionedParameterEncoderWithV1Fallback") return errors.New("DecodeParameters not implemented on versionedParameterEncoderWithV1Fallback")
} }

View File

@ -20,7 +20,7 @@ import (
"sync" "sync"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/rest" "k8s.io/client-go/rest"
) )
@ -28,18 +28,18 @@ import (
type ClientPool interface { type ClientPool interface {
// ClientForGroupVersionKind returns a client configured for the specified groupVersionResource. // ClientForGroupVersionKind returns a client configured for the specified groupVersionResource.
// Resource may be empty. // Resource may be empty.
ClientForGroupVersionResource(resource unversioned.GroupVersionResource) (*Client, error) ClientForGroupVersionResource(resource schema.GroupVersionResource) (*Client, error)
// ClientForGroupVersionKind returns a client configured for the specified groupVersionKind. // ClientForGroupVersionKind returns a client configured for the specified groupVersionKind.
// Kind may be empty. // Kind may be empty.
ClientForGroupVersionKind(kind unversioned.GroupVersionKind) (*Client, error) ClientForGroupVersionKind(kind schema.GroupVersionKind) (*Client, error)
} }
// APIPathResolverFunc knows how to convert a groupVersion to its API path. The Kind field is // APIPathResolverFunc knows how to convert a groupVersion to its API path. The Kind field is
// optional. // optional.
type APIPathResolverFunc func(kind unversioned.GroupVersionKind) string type APIPathResolverFunc func(kind schema.GroupVersionKind) string
// LegacyAPIPathResolverFunc can resolve paths properly with the legacy API. // LegacyAPIPathResolverFunc can resolve paths properly with the legacy API.
func LegacyAPIPathResolverFunc(kind unversioned.GroupVersionKind) string { func LegacyAPIPathResolverFunc(kind schema.GroupVersionKind) string {
if len(kind.Group) == 0 { if len(kind.Group) == 0 {
return "/api" return "/api"
} }
@ -51,7 +51,7 @@ func LegacyAPIPathResolverFunc(kind unversioned.GroupVersionKind) string {
type clientPoolImpl struct { type clientPoolImpl struct {
lock sync.RWMutex lock sync.RWMutex
config *rest.Config config *rest.Config
clients map[unversioned.GroupVersion]*Client clients map[schema.GroupVersion]*Client
apiPathResolverFunc APIPathResolverFunc apiPathResolverFunc APIPathResolverFunc
mapper meta.RESTMapper mapper meta.RESTMapper
} }
@ -64,7 +64,7 @@ func NewClientPool(config *rest.Config, mapper meta.RESTMapper, apiPathResolverF
return &clientPoolImpl{ return &clientPoolImpl{
config: &confCopy, config: &confCopy,
clients: map[unversioned.GroupVersion]*Client{}, clients: map[schema.GroupVersion]*Client{},
apiPathResolverFunc: apiPathResolverFunc, apiPathResolverFunc: apiPathResolverFunc,
mapper: mapper, mapper: mapper,
} }
@ -72,11 +72,11 @@ func NewClientPool(config *rest.Config, mapper meta.RESTMapper, apiPathResolverF
// ClientForGroupVersionResource uses the provided RESTMapper to identify the appropriate resource. Resource may // ClientForGroupVersionResource uses the provided RESTMapper to identify the appropriate resource. Resource may
// be empty. If no matching kind is found the underlying client for that group is still returned. // be empty. If no matching kind is found the underlying client for that group is still returned.
func (c *clientPoolImpl) ClientForGroupVersionResource(resource unversioned.GroupVersionResource) (*Client, error) { func (c *clientPoolImpl) ClientForGroupVersionResource(resource schema.GroupVersionResource) (*Client, error) {
kinds, err := c.mapper.KindsFor(resource) kinds, err := c.mapper.KindsFor(resource)
if err != nil { if err != nil {
if meta.IsNoMatchError(err) { if meta.IsNoMatchError(err) {
return c.ClientForGroupVersionKind(unversioned.GroupVersionKind{Group: resource.Group, Version: resource.Version}) return c.ClientForGroupVersionKind(schema.GroupVersionKind{Group: resource.Group, Version: resource.Version})
} }
return nil, err return nil, err
} }
@ -85,7 +85,7 @@ func (c *clientPoolImpl) ClientForGroupVersionResource(resource unversioned.Grou
// ClientForGroupVersion returns a client for the specified groupVersion, creates one if none exists. Kind // ClientForGroupVersion returns a client for the specified groupVersion, creates one if none exists. Kind
// in the GroupVersionKind may be empty. // in the GroupVersionKind may be empty.
func (c *clientPoolImpl) ClientForGroupVersionKind(kind unversioned.GroupVersionKind) (*Client, error) { func (c *clientPoolImpl) ClientForGroupVersionKind(kind schema.GroupVersionKind) (*Client, error) {
c.lock.Lock() c.lock.Lock()
defer c.lock.Unlock() defer c.lock.Unlock()

View File

@ -29,6 +29,7 @@ import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/runtime/serializer/streaming" "k8s.io/client-go/pkg/runtime/serializer/streaming"
"k8s.io/client-go/pkg/watch" "k8s.io/client-go/pkg/watch"
"k8s.io/client-go/pkg/watch/versioned" "k8s.io/client-go/pkg/watch/versioned"
@ -57,7 +58,7 @@ func getObject(version, kind, name string) *runtime.Unstructured {
} }
} }
func getClientServer(gv *unversioned.GroupVersion, h func(http.ResponseWriter, *http.Request)) (*Client, *httptest.Server, error) { func getClientServer(gv *schema.GroupVersion, h func(http.ResponseWriter, *http.Request)) (*Client, *httptest.Server, error) {
srv := httptest.NewServer(http.HandlerFunc(h)) srv := httptest.NewServer(http.HandlerFunc(h))
cl, err := NewClient(&rest.Config{ cl, err := NewClient(&rest.Config{
Host: srv.URL, Host: srv.URL,
@ -115,7 +116,7 @@ func TestList(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "GET" { if r.Method != "GET" {
@ -170,7 +171,7 @@ func TestGet(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "GET" { if r.Method != "GET" {
@ -223,7 +224,7 @@ func TestDelete(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "DELETE" { if r.Method != "DELETE" {
@ -272,7 +273,7 @@ func TestDeleteCollection(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "DELETE" { if r.Method != "DELETE" {
@ -320,7 +321,7 @@ func TestCreate(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "POST" { if r.Method != "POST" {
@ -379,7 +380,7 @@ func TestUpdate(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "PUT" { if r.Method != "PUT" {
@ -446,7 +447,7 @@ func TestWatch(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "GET" { if r.Method != "GET" {
@ -506,7 +507,7 @@ func TestPatch(t *testing.T) {
}, },
} }
for _, tc := range tcs { for _, tc := range tcs {
gv := &unversioned.GroupVersion{Group: "gtest", Version: "vtest"} gv := &schema.GroupVersion{Group: "gtest", Version: "vtest"}
resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0} resource := &unversioned.APIResource{Name: "rtest", Namespaced: len(tc.namespace) != 0}
cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) { cl, srv, err := getClientServer(gv, func(w http.ResponseWriter, r *http.Request) {
if r.Method != "PATCH" { if r.Method != "PATCH" {

View File

@ -22,11 +22,12 @@ import (
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
// VersionInterfaces provides an object converter and metadata // VersionInterfaces provides an object converter and metadata
// accessor appropriate for use with unstructured objects. // accessor appropriate for use with unstructured objects.
func VersionInterfaces(unversioned.GroupVersion) (*meta.VersionInterfaces, error) { func VersionInterfaces(schema.GroupVersion) (*meta.VersionInterfaces, error) {
return &meta.VersionInterfaces{ return &meta.VersionInterfaces{
ObjectConvertor: &runtime.UnstructuredObjectConverter{}, ObjectConvertor: &runtime.UnstructuredObjectConverter{},
MetadataAccessor: meta.NewAccessor(), MetadataAccessor: meta.NewAccessor(),
@ -37,7 +38,7 @@ func VersionInterfaces(unversioned.GroupVersion) (*meta.VersionInterfaces, error
func NewDiscoveryRESTMapper(resources []*unversioned.APIResourceList, versionFunc meta.VersionInterfacesFunc) (*meta.DefaultRESTMapper, error) { func NewDiscoveryRESTMapper(resources []*unversioned.APIResourceList, versionFunc meta.VersionInterfacesFunc) (*meta.DefaultRESTMapper, error) {
rm := meta.NewDefaultRESTMapper(nil, versionFunc) rm := meta.NewDefaultRESTMapper(nil, versionFunc)
for _, resourceList := range resources { for _, resourceList := range resources {
gv, err := unversioned.ParseGroupVersion(resourceList.GroupVersion) gv, err := schema.ParseGroupVersion(resourceList.GroupVersion)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -57,14 +58,14 @@ func NewDiscoveryRESTMapper(resources []*unversioned.APIResourceList, versionFun
// ObjectTyper provides an ObjectTyper implementation for // ObjectTyper provides an ObjectTyper implementation for
// runtime.Unstructured object based on discovery information. // runtime.Unstructured object based on discovery information.
type ObjectTyper struct { type ObjectTyper struct {
registered map[unversioned.GroupVersionKind]bool registered map[schema.GroupVersionKind]bool
} }
// NewObjectTyper constructs an ObjectTyper from discovery information. // NewObjectTyper constructs an ObjectTyper from discovery information.
func NewObjectTyper(resources []*unversioned.APIResourceList) (runtime.ObjectTyper, error) { func NewObjectTyper(resources []*unversioned.APIResourceList) (runtime.ObjectTyper, error) {
ot := &ObjectTyper{registered: make(map[unversioned.GroupVersionKind]bool)} ot := &ObjectTyper{registered: make(map[schema.GroupVersionKind]bool)}
for _, resourceList := range resources { for _, resourceList := range resources {
gv, err := unversioned.ParseGroupVersion(resourceList.GroupVersion) gv, err := schema.ParseGroupVersion(resourceList.GroupVersion)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -80,15 +81,15 @@ func NewObjectTyper(resources []*unversioned.APIResourceList) (runtime.ObjectTyp
// group,version,kind of the provided object, or an error if the // group,version,kind of the provided object, or an error if the
// object is not *runtime.Unstructured or has no group,version,kind // object is not *runtime.Unstructured or has no group,version,kind
// information. // information.
func (ot *ObjectTyper) ObjectKinds(obj runtime.Object) ([]unversioned.GroupVersionKind, bool, error) { func (ot *ObjectTyper) ObjectKinds(obj runtime.Object) ([]schema.GroupVersionKind, bool, error) {
if _, ok := obj.(*runtime.Unstructured); !ok { if _, ok := obj.(*runtime.Unstructured); !ok {
return nil, false, fmt.Errorf("type %T is invalid for dynamic object typer", obj) return nil, false, fmt.Errorf("type %T is invalid for dynamic object typer", obj)
} }
return []unversioned.GroupVersionKind{obj.GetObjectKind().GroupVersionKind()}, false, nil return []schema.GroupVersionKind{obj.GetObjectKind().GroupVersionKind()}, false, nil
} }
// Recognizes returns true if the provided group,version,kind was in // Recognizes returns true if the provided group,version,kind was in
// the discovery information. // the discovery information.
func (ot *ObjectTyper) Recognizes(gvk unversioned.GroupVersionKind) bool { func (ot *ObjectTyper) Recognizes(gvk schema.GroupVersionKind) bool {
return ot.registered[gvk] return ot.registered[gvk]
} }

View File

@ -20,6 +20,7 @@ import (
"testing" "testing"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime/schema"
) )
func TestDiscoveryRESTMapper(t *testing.T) { func TestDiscoveryRESTMapper(t *testing.T) {
@ -36,7 +37,7 @@ func TestDiscoveryRESTMapper(t *testing.T) {
}, },
} }
gvk := unversioned.GroupVersionKind{ gvk := schema.GroupVersionKind{
Group: "test", Group: "test",
Version: "beta1", Version: "beta1",
Kind: "test_kind", Kind: "test_kind",
@ -47,7 +48,7 @@ func TestDiscoveryRESTMapper(t *testing.T) {
t.Fatalf("unexpected error creating mapper: %s", err) t.Fatalf("unexpected error creating mapper: %s", err)
} }
for _, res := range []unversioned.GroupVersionResource{ for _, res := range []schema.GroupVersionResource{
{ {
Group: "test", Group: "test",
Version: "beta1", Version: "beta1",

View File

@ -19,8 +19,8 @@ package v1beta1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *AppsV1beta1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("apps/v1beta1") gv, err := schema.ParseGroupVersion("apps/v1beta1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/apps/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeStatefulSets struct {
ns string ns string
} }
var statefulsetsResource = unversioned.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "statefulsets"} var statefulsetsResource = schema.GroupVersionResource{Group: "apps", Version: "v1beta1", Resource: "statefulsets"}
func (c *FakeStatefulSets) Create(statefulSet *v1beta1.StatefulSet) (result *v1beta1.StatefulSet, err error) { func (c *FakeStatefulSets) Create(statefulSet *v1beta1.StatefulSet) (result *v1beta1.StatefulSet, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1beta1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *AuthenticationV1beta1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("authentication.k8s.io/v1beta1") gv, err := schema.ParseGroupVersion("authentication.k8s.io/v1beta1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -19,8 +19,8 @@ package v1beta1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -78,7 +78,7 @@ func New(c rest.Interface) *AuthorizationV1beta1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("authorization.k8s.io/v1beta1") gv, err := schema.ParseGroupVersion("authorization.k8s.io/v1beta1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -19,8 +19,8 @@ package v1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *AutoscalingV1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("autoscaling/v1") gv, err := schema.ParseGroupVersion("autoscaling/v1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
api_v1 "k8s.io/client-go/pkg/api/v1" api_v1 "k8s.io/client-go/pkg/api/v1"
v1 "k8s.io/client-go/pkg/apis/autoscaling/v1" v1 "k8s.io/client-go/pkg/apis/autoscaling/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeHorizontalPodAutoscalers struct {
ns string ns string
} }
var horizontalpodautoscalersResource = unversioned.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscalers"} var horizontalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling", Version: "v1", Resource: "horizontalpodautoscalers"}
func (c *FakeHorizontalPodAutoscalers) Create(horizontalPodAutoscaler *v1.HorizontalPodAutoscaler) (result *v1.HorizontalPodAutoscaler, err error) { func (c *FakeHorizontalPodAutoscalers) Create(horizontalPodAutoscaler *v1.HorizontalPodAutoscaler) (result *v1.HorizontalPodAutoscaler, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *BatchV1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("batch/v1") gv, err := schema.ParseGroupVersion("batch/v1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
api_v1 "k8s.io/client-go/pkg/api/v1" api_v1 "k8s.io/client-go/pkg/api/v1"
v1 "k8s.io/client-go/pkg/apis/batch/v1" v1 "k8s.io/client-go/pkg/apis/batch/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeJobs struct {
ns string ns string
} }
var jobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"} var jobsResource = schema.GroupVersionResource{Group: "batch", Version: "v1", Resource: "jobs"}
func (c *FakeJobs) Create(job *v1.Job) (result *v1.Job, err error) { func (c *FakeJobs) Create(job *v1.Job) (result *v1.Job, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v2alpha1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -73,7 +73,7 @@ func New(c rest.Interface) *BatchV2alpha1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("batch/v2alpha1") gv, err := schema.ParseGroupVersion("batch/v2alpha1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1" v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeCronJobs struct {
ns string ns string
} }
var cronjobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"} var cronjobsResource = schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}
func (c *FakeCronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) { func (c *FakeCronJobs) Create(cronJob *v2alpha1.CronJob) (result *v2alpha1.CronJob, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1" v2alpha1 "k8s.io/client-go/pkg/apis/batch/v2alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeJobs struct {
ns string ns string
} }
var jobsResource = unversioned.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "jobs"} var jobsResource = schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "jobs"}
func (c *FakeJobs) Create(job *v2alpha1.Job) (result *v2alpha1.Job, err error) { func (c *FakeJobs) Create(job *v2alpha1.Job) (result *v2alpha1.Job, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1alpha1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *CertificatesV1alpha1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("certificates.k8s.io/v1alpha1") gv, err := schema.ParseGroupVersion("certificates.k8s.io/v1alpha1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/certificates/v1alpha1" v1alpha1 "k8s.io/client-go/pkg/apis/certificates/v1alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeCertificateSigningRequests struct {
Fake *FakeCertificatesV1alpha1 Fake *FakeCertificatesV1alpha1
} }
var certificatesigningrequestsResource = unversioned.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1alpha1", Resource: "certificatesigningrequests"} var certificatesigningrequestsResource = schema.GroupVersionResource{Group: "certificates.k8s.io", Version: "v1alpha1", Resource: "certificatesigningrequests"}
func (c *FakeCertificateSigningRequests) Create(certificateSigningRequest *v1alpha1.CertificateSigningRequest) (result *v1alpha1.CertificateSigningRequest, err error) { func (c *FakeCertificateSigningRequests) Create(certificateSigningRequest *v1alpha1.CertificateSigningRequest) (result *v1alpha1.CertificateSigningRequest, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -143,7 +143,7 @@ func New(c rest.Interface) *CoreV1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("/v1") gv, err := schema.ParseGroupVersion("/v1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -30,7 +30,7 @@ type FakeComponentStatuses struct {
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var componentstatusesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuses"} var componentstatusesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "componentstatuses"}
func (c *FakeComponentStatuses) Create(componentStatus *v1.ComponentStatus) (result *v1.ComponentStatus, err error) { func (c *FakeComponentStatuses) Create(componentStatus *v1.ComponentStatus) (result *v1.ComponentStatus, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeConfigMaps struct {
ns string ns string
} }
var configmapsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"} var configmapsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "configmaps"}
func (c *FakeConfigMaps) Create(configMap *v1.ConfigMap) (result *v1.ConfigMap, err error) { func (c *FakeConfigMaps) Create(configMap *v1.ConfigMap) (result *v1.ConfigMap, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeEndpoints struct {
ns string ns string
} }
var endpointsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "endpoints"} var endpointsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "endpoints"}
func (c *FakeEndpoints) Create(endpoints *v1.Endpoints) (result *v1.Endpoints, err error) { func (c *FakeEndpoints) Create(endpoints *v1.Endpoints) (result *v1.Endpoints, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeEvents struct {
ns string ns string
} }
var eventsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "events"} var eventsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "events"}
func (c *FakeEvents) Create(event *v1.Event) (result *v1.Event, err error) { func (c *FakeEvents) Create(event *v1.Event) (result *v1.Event, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeLimitRanges struct {
ns string ns string
} }
var limitrangesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "limitranges"} var limitrangesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "limitranges"}
func (c *FakeLimitRanges) Create(limitRange *v1.LimitRange) (result *v1.LimitRange, err error) { func (c *FakeLimitRanges) Create(limitRange *v1.LimitRange) (result *v1.LimitRange, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -30,7 +30,7 @@ type FakeNamespaces struct {
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var namespacesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"} var namespacesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "namespaces"}
func (c *FakeNamespaces) Create(namespace *v1.Namespace) (result *v1.Namespace, err error) { func (c *FakeNamespaces) Create(namespace *v1.Namespace) (result *v1.Namespace, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -30,7 +30,7 @@ type FakeNodes struct {
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var nodesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"} var nodesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "nodes"}
func (c *FakeNodes) Create(node *v1.Node) (result *v1.Node, err error) { func (c *FakeNodes) Create(node *v1.Node) (result *v1.Node, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -30,7 +30,7 @@ type FakePersistentVolumes struct {
Fake *FakeCoreV1 Fake *FakeCoreV1
} }
var persistentvolumesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"} var persistentvolumesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"}
func (c *FakePersistentVolumes) Create(persistentVolume *v1.PersistentVolume) (result *v1.PersistentVolume, err error) { func (c *FakePersistentVolumes) Create(persistentVolume *v1.PersistentVolume) (result *v1.PersistentVolume, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakePersistentVolumeClaims struct {
ns string ns string
} }
var persistentvolumeclaimsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumeclaims"} var persistentvolumeclaimsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumeclaims"}
func (c *FakePersistentVolumeClaims) Create(persistentVolumeClaim *v1.PersistentVolumeClaim) (result *v1.PersistentVolumeClaim, err error) { func (c *FakePersistentVolumeClaims) Create(persistentVolumeClaim *v1.PersistentVolumeClaim) (result *v1.PersistentVolumeClaim, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakePods struct {
ns string ns string
} }
var podsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"} var podsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "pods"}
func (c *FakePods) Create(pod *v1.Pod) (result *v1.Pod, err error) { func (c *FakePods) Create(pod *v1.Pod) (result *v1.Pod, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakePodTemplates struct {
ns string ns string
} }
var podtemplatesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "podtemplates"} var podtemplatesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "podtemplates"}
func (c *FakePodTemplates) Create(podTemplate *v1.PodTemplate) (result *v1.PodTemplate, err error) { func (c *FakePodTemplates) Create(podTemplate *v1.PodTemplate) (result *v1.PodTemplate, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeReplicationControllers struct {
ns string ns string
} }
var replicationcontrollersResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "replicationcontrollers"} var replicationcontrollersResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "replicationcontrollers"}
func (c *FakeReplicationControllers) Create(replicationController *v1.ReplicationController) (result *v1.ReplicationController, err error) { func (c *FakeReplicationControllers) Create(replicationController *v1.ReplicationController) (result *v1.ReplicationController, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeResourceQuotas struct {
ns string ns string
} }
var resourcequotasResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "resourcequotas"} var resourcequotasResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "resourcequotas"}
func (c *FakeResourceQuotas) Create(resourceQuota *v1.ResourceQuota) (result *v1.ResourceQuota, err error) { func (c *FakeResourceQuotas) Create(resourceQuota *v1.ResourceQuota) (result *v1.ResourceQuota, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeSecrets struct {
ns string ns string
} }
var secretsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"} var secretsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "secrets"}
func (c *FakeSecrets) Create(secret *v1.Secret) (result *v1.Secret, err error) { func (c *FakeSecrets) Create(secret *v1.Secret) (result *v1.Secret, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeServices struct {
ns string ns string
} }
var servicesResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "services"} var servicesResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "services"}
func (c *FakeServices) Create(service *v1.Service) (result *v1.Service, err error) { func (c *FakeServices) Create(service *v1.Service) (result *v1.Service, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,9 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeServiceAccounts struct {
ns string ns string
} }
var serviceaccountsResource = unversioned.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"} var serviceaccountsResource = schema.GroupVersionResource{Group: "", Version: "v1", Resource: "serviceaccounts"}
func (c *FakeServiceAccounts) Create(serviceAccount *v1.ServiceAccount) (result *v1.ServiceAccount, err error) { func (c *FakeServiceAccounts) Create(serviceAccount *v1.ServiceAccount) (result *v1.ServiceAccount, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1beta1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -103,7 +103,7 @@ func New(c rest.Interface) *ExtensionsV1beta1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("extensions/v1beta1") gv, err := schema.ParseGroupVersion("extensions/v1beta1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeDaemonSets struct {
ns string ns string
} }
var daemonsetsResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "daemonsets"} var daemonsetsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "daemonsets"}
func (c *FakeDaemonSets) Create(daemonSet *v1beta1.DaemonSet) (result *v1beta1.DaemonSet, err error) { func (c *FakeDaemonSets) Create(daemonSet *v1beta1.DaemonSet) (result *v1beta1.DaemonSet, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeDeployments struct {
ns string ns string
} }
var deploymentsResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"} var deploymentsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "deployments"}
func (c *FakeDeployments) Create(deployment *v1beta1.Deployment) (result *v1beta1.Deployment, err error) { func (c *FakeDeployments) Create(deployment *v1beta1.Deployment) (result *v1beta1.Deployment, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeIngresses struct {
ns string ns string
} }
var ingressesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "ingresses"} var ingressesResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "ingresses"}
func (c *FakeIngresses) Create(ingress *v1beta1.Ingress) (result *v1beta1.Ingress, err error) { func (c *FakeIngresses) Create(ingress *v1beta1.Ingress) (result *v1beta1.Ingress, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeJobs struct {
ns string ns string
} }
var jobsResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "jobs"} var jobsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "jobs"}
func (c *FakeJobs) Create(job *v1beta1.Job) (result *v1beta1.Job, err error) { func (c *FakeJobs) Create(job *v1beta1.Job) (result *v1beta1.Job, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakePodSecurityPolicies struct {
Fake *FakeExtensionsV1beta1 Fake *FakeExtensionsV1beta1
} }
var podsecuritypoliciesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "podsecuritypolicies"} var podsecuritypoliciesResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "podsecuritypolicies"}
func (c *FakePodSecurityPolicies) Create(podSecurityPolicy *v1beta1.PodSecurityPolicy) (result *v1beta1.PodSecurityPolicy, err error) { func (c *FakePodSecurityPolicies) Create(podSecurityPolicy *v1beta1.PodSecurityPolicy) (result *v1beta1.PodSecurityPolicy, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeReplicaSets struct {
ns string ns string
} }
var replicasetsResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicasets"} var replicasetsResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "replicasets"}
func (c *FakeReplicaSets) Create(replicaSet *v1beta1.ReplicaSet) (result *v1beta1.ReplicaSet, err error) { func (c *FakeReplicaSets) Create(replicaSet *v1beta1.ReplicaSet) (result *v1beta1.ReplicaSet, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -17,8 +17,8 @@ limitations under the License.
package fake package fake
import ( import (
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apis/extensions/v1beta1" "k8s.io/client-go/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/testing" "k8s.io/client-go/testing"
) )
@ -26,7 +26,7 @@ func (c *FakeScales) Get(kind string, name string) (result *v1beta1.Scale, err e
action := testing.GetActionImpl{} action := testing.GetActionImpl{}
action.Verb = "get" action.Verb = "get"
action.Namespace = c.ns action.Namespace = c.ns
action.Resource = unversioned.GroupVersionResource{Resource: kind} action.Resource = schema.GroupVersionResource{Resource: kind}
action.Subresource = "scale" action.Subresource = "scale"
action.Name = name action.Name = name
obj, err := c.Fake.Invokes(action, &v1beta1.Scale{}) obj, err := c.Fake.Invokes(action, &v1beta1.Scale{})
@ -38,7 +38,7 @@ func (c *FakeScales) Update(kind string, scale *v1beta1.Scale) (result *v1beta1.
action := testing.UpdateActionImpl{} action := testing.UpdateActionImpl{}
action.Verb = "update" action.Verb = "update"
action.Namespace = c.ns action.Namespace = c.ns
action.Resource = unversioned.GroupVersionResource{Resource: kind} action.Resource = schema.GroupVersionResource{Resource: kind}
action.Subresource = "scale" action.Subresource = "scale"
action.Object = scale action.Object = scale
obj, err := c.Fake.Invokes(action, scale) obj, err := c.Fake.Invokes(action, scale)

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/extensions/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeThirdPartyResources struct {
Fake *FakeExtensionsV1beta1 Fake *FakeExtensionsV1beta1
} }
var thirdpartyresourcesResource = unversioned.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"} var thirdpartyresourcesResource = schema.GroupVersionResource{Group: "extensions", Version: "v1beta1", Resource: "thirdpartyresources"}
func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) { func (c *FakeThirdPartyResources) Create(thirdPartyResource *v1beta1.ThirdPartyResource) (result *v1beta1.ThirdPartyResource, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,8 +18,8 @@ package v1beta1
import ( import (
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apis/extensions/v1beta1" "k8s.io/client-go/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/pkg/runtime/schema"
) )
// The ScaleExpansion interface allows manually adding extra methods to the ScaleInterface. // The ScaleExpansion interface allows manually adding extra methods to the ScaleInterface.
@ -33,7 +33,7 @@ func (c *scales) Get(kind string, name string) (result *v1beta1.Scale, err error
result = &v1beta1.Scale{} result = &v1beta1.Scale{}
// TODO this method needs to take a proper unambiguous kind // TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind} fullyQualifiedKind := schema.GroupVersionKind{Kind: kind}
resource, _ := meta.KindToResource(fullyQualifiedKind) resource, _ := meta.KindToResource(fullyQualifiedKind)
err = c.client.Get(). err = c.client.Get().
@ -50,7 +50,7 @@ func (c *scales) Update(kind string, scale *v1beta1.Scale) (result *v1beta1.Scal
result = &v1beta1.Scale{} result = &v1beta1.Scale{}
// TODO this method needs to take a proper unambiguous kind // TODO this method needs to take a proper unambiguous kind
fullyQualifiedKind := unversioned.GroupVersionKind{Kind: kind} fullyQualifiedKind := schema.GroupVersionKind{Kind: kind}
resource, _ := meta.KindToResource(fullyQualifiedKind) resource, _ := meta.KindToResource(fullyQualifiedKind)
err = c.client.Put(). err = c.client.Put().

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/policy/v1alpha1" v1alpha1 "k8s.io/client-go/pkg/apis/policy/v1alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
"k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakePodDisruptionBudgets struct {
ns string ns string
} }
var poddisruptionbudgetsResource = unversioned.GroupVersionResource{Group: "policy", Version: "v1alpha1", Resource: "poddisruptionbudgets"} var poddisruptionbudgetsResource = schema.GroupVersionResource{Group: "policy", Version: "v1alpha1", Resource: "poddisruptionbudgets"}
func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) { func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *v1alpha1.PodDisruptionBudget) (result *v1alpha1.PodDisruptionBudget, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,9 +18,10 @@ package v1alpha1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
"k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +69,7 @@ func New(c rest.Interface) *PolicyV1alpha1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("policy/v1alpha1") gv, err := schema.ParseGroupVersion("policy/v1alpha1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/policy/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakePodDisruptionBudgets struct {
ns string ns string
} }
var poddisruptionbudgetsResource = unversioned.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "poddisruptionbudgets"} var poddisruptionbudgetsResource = schema.GroupVersionResource{Group: "policy", Version: "v1beta1", Resource: "poddisruptionbudgets"}
func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *v1beta1.PodDisruptionBudget) (result *v1beta1.PodDisruptionBudget, err error) { func (c *FakePodDisruptionBudgets) Create(podDisruptionBudget *v1beta1.PodDisruptionBudget) (result *v1beta1.PodDisruptionBudget, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1beta1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *PolicyV1beta1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("policy/v1beta1") gv, err := schema.ParseGroupVersion("policy/v1beta1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1" v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeClusterRoles struct {
Fake *FakeRbacV1alpha1 Fake *FakeRbacV1alpha1
} }
var clusterrolesResource = unversioned.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterroles"} var clusterrolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterroles"}
func (c *FakeClusterRoles) Create(clusterRole *v1alpha1.ClusterRole) (result *v1alpha1.ClusterRole, err error) { func (c *FakeClusterRoles) Create(clusterRole *v1alpha1.ClusterRole) (result *v1alpha1.ClusterRole, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1" v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeClusterRoleBindings struct {
Fake *FakeRbacV1alpha1 Fake *FakeRbacV1alpha1
} }
var clusterrolebindingsResource = unversioned.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterrolebindings"} var clusterrolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "clusterrolebindings"}
func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *v1alpha1.ClusterRoleBinding) (result *v1alpha1.ClusterRoleBinding, err error) { func (c *FakeClusterRoleBindings) Create(clusterRoleBinding *v1alpha1.ClusterRoleBinding) (result *v1alpha1.ClusterRoleBinding, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1" v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeRoles struct {
ns string ns string
} }
var rolesResource = unversioned.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "roles"} var rolesResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "roles"}
func (c *FakeRoles) Create(role *v1alpha1.Role) (result *v1alpha1.Role, err error) { func (c *FakeRoles) Create(role *v1alpha1.Role) (result *v1alpha1.Role, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1" v1alpha1 "k8s.io/client-go/pkg/apis/rbac/v1alpha1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -32,7 +32,7 @@ type FakeRoleBindings struct {
ns string ns string
} }
var rolebindingsResource = unversioned.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "rolebindings"} var rolebindingsResource = schema.GroupVersionResource{Group: "rbac.authorization.k8s.io", Version: "v1alpha1", Resource: "rolebindings"}
func (c *FakeRoleBindings) Create(roleBinding *v1alpha1.RoleBinding) (result *v1alpha1.RoleBinding, err error) { func (c *FakeRoleBindings) Create(roleBinding *v1alpha1.RoleBinding) (result *v1alpha1.RoleBinding, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1alpha1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -83,7 +83,7 @@ func New(c rest.Interface) *RbacV1alpha1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("rbac.authorization.k8s.io/v1alpha1") gv, err := schema.ParseGroupVersion("rbac.authorization.k8s.io/v1alpha1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -18,10 +18,10 @@ package fake
import ( import (
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
v1 "k8s.io/client-go/pkg/api/v1" v1 "k8s.io/client-go/pkg/api/v1"
v1beta1 "k8s.io/client-go/pkg/apis/storage/v1beta1" v1beta1 "k8s.io/client-go/pkg/apis/storage/v1beta1"
labels "k8s.io/client-go/pkg/labels" labels "k8s.io/client-go/pkg/labels"
schema "k8s.io/client-go/pkg/runtime/schema"
watch "k8s.io/client-go/pkg/watch" watch "k8s.io/client-go/pkg/watch"
testing "k8s.io/client-go/testing" testing "k8s.io/client-go/testing"
) )
@ -31,7 +31,7 @@ type FakeStorageClasses struct {
Fake *FakeStorageV1beta1 Fake *FakeStorageV1beta1
} }
var storageclassesResource = unversioned.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "storageclasses"} var storageclassesResource = schema.GroupVersionResource{Group: "storage.k8s.io", Version: "v1beta1", Resource: "storageclasses"}
func (c *FakeStorageClasses) Create(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) { func (c *FakeStorageClasses) Create(storageClass *v1beta1.StorageClass) (result *v1beta1.StorageClass, err error) {
obj, err := c.Fake. obj, err := c.Fake.

View File

@ -19,8 +19,8 @@ package v1beta1
import ( import (
fmt "fmt" fmt "fmt"
api "k8s.io/client-go/pkg/api" api "k8s.io/client-go/pkg/api"
unversioned "k8s.io/client-go/pkg/api/unversioned"
registered "k8s.io/client-go/pkg/apimachinery/registered" registered "k8s.io/client-go/pkg/apimachinery/registered"
schema "k8s.io/client-go/pkg/runtime/schema"
serializer "k8s.io/client-go/pkg/runtime/serializer" serializer "k8s.io/client-go/pkg/runtime/serializer"
rest "k8s.io/client-go/rest" rest "k8s.io/client-go/rest"
) )
@ -68,7 +68,7 @@ func New(c rest.Interface) *StorageV1beta1Client {
} }
func setConfigDefaults(config *rest.Config) error { func setConfigDefaults(config *rest.Config) error {
gv, err := unversioned.ParseGroupVersion("storage.k8s.io/v1beta1") gv, err := schema.ParseGroupVersion("storage.k8s.io/v1beta1")
if err != nil { if err != nil {
return err return err
} }

View File

@ -24,6 +24,7 @@ import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/util/validation/field" "k8s.io/client-go/pkg/util/validation/field"
) )
@ -91,7 +92,7 @@ func FromObject(obj runtime.Object) error {
} }
// NewNotFound returns a new error which indicates that the resource of the kind and the name was not found. // NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.
func NewNotFound(qualifiedResource unversioned.GroupResource, name string) *StatusError { func NewNotFound(qualifiedResource schema.GroupResource, name string) *StatusError {
return &StatusError{unversioned.Status{ return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure, Status: unversioned.StatusFailure,
Code: http.StatusNotFound, Code: http.StatusNotFound,
@ -106,7 +107,7 @@ func NewNotFound(qualifiedResource unversioned.GroupResource, name string) *Stat
} }
// NewAlreadyExists returns an error indicating the item requested exists by that identifier. // NewAlreadyExists returns an error indicating the item requested exists by that identifier.
func NewAlreadyExists(qualifiedResource unversioned.GroupResource, name string) *StatusError { func NewAlreadyExists(qualifiedResource schema.GroupResource, name string) *StatusError {
return &StatusError{unversioned.Status{ return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure, Status: unversioned.StatusFailure,
Code: http.StatusConflict, Code: http.StatusConflict,
@ -136,7 +137,7 @@ func NewUnauthorized(reason string) *StatusError {
} }
// NewForbidden returns an error indicating the requested action was forbidden // NewForbidden returns an error indicating the requested action was forbidden
func NewForbidden(qualifiedResource unversioned.GroupResource, name string, err error) *StatusError { func NewForbidden(qualifiedResource schema.GroupResource, name string, err error) *StatusError {
return &StatusError{unversioned.Status{ return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure, Status: unversioned.StatusFailure,
Code: http.StatusForbidden, Code: http.StatusForbidden,
@ -151,7 +152,7 @@ func NewForbidden(qualifiedResource unversioned.GroupResource, name string, err
} }
// NewConflict returns an error indicating the item can't be updated as provided. // NewConflict returns an error indicating the item can't be updated as provided.
func NewConflict(qualifiedResource unversioned.GroupResource, name string, err error) *StatusError { func NewConflict(qualifiedResource schema.GroupResource, name string, err error) *StatusError {
return &StatusError{unversioned.Status{ return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure, Status: unversioned.StatusFailure,
Code: http.StatusConflict, Code: http.StatusConflict,
@ -176,7 +177,7 @@ func NewGone(message string) *StatusError {
} }
// NewInvalid returns an error indicating the item is invalid and cannot be processed. // NewInvalid returns an error indicating the item is invalid and cannot be processed.
func NewInvalid(qualifiedKind unversioned.GroupKind, name string, errs field.ErrorList) *StatusError { func NewInvalid(qualifiedKind schema.GroupKind, name string, errs field.ErrorList) *StatusError {
causes := make([]unversioned.StatusCause, 0, len(errs)) causes := make([]unversioned.StatusCause, 0, len(errs))
for i := range errs { for i := range errs {
err := errs[i] err := errs[i]
@ -221,7 +222,7 @@ func NewServiceUnavailable(reason string) *StatusError {
} }
// NewMethodNotSupported returns an error indicating the requested action is not supported on this kind. // NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
func NewMethodNotSupported(qualifiedResource unversioned.GroupResource, action string) *StatusError { func NewMethodNotSupported(qualifiedResource schema.GroupResource, action string) *StatusError {
return &StatusError{unversioned.Status{ return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure, Status: unversioned.StatusFailure,
Code: http.StatusMethodNotAllowed, Code: http.StatusMethodNotAllowed,
@ -236,7 +237,7 @@ func NewMethodNotSupported(qualifiedResource unversioned.GroupResource, action s
// NewServerTimeout returns an error indicating the requested action could not be completed due to a // NewServerTimeout returns an error indicating the requested action could not be completed due to a
// transient error, and the client should try again. // transient error, and the client should try again.
func NewServerTimeout(qualifiedResource unversioned.GroupResource, operation string, retryAfterSeconds int) *StatusError { func NewServerTimeout(qualifiedResource schema.GroupResource, operation string, retryAfterSeconds int) *StatusError {
return &StatusError{unversioned.Status{ return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure, Status: unversioned.StatusFailure,
Code: http.StatusInternalServerError, Code: http.StatusInternalServerError,
@ -253,8 +254,8 @@ func NewServerTimeout(qualifiedResource unversioned.GroupResource, operation str
// NewServerTimeoutForKind should not exist. Server timeouts happen when accessing resources, the Kind is just what we // NewServerTimeoutForKind should not exist. Server timeouts happen when accessing resources, the Kind is just what we
// happened to be looking at when the request failed. This delegates to keep code sane, but we should work towards removing this. // happened to be looking at when the request failed. This delegates to keep code sane, but we should work towards removing this.
func NewServerTimeoutForKind(qualifiedKind unversioned.GroupKind, operation string, retryAfterSeconds int) *StatusError { func NewServerTimeoutForKind(qualifiedKind schema.GroupKind, operation string, retryAfterSeconds int) *StatusError {
return NewServerTimeout(unversioned.GroupResource{Group: qualifiedKind.Group, Resource: qualifiedKind.Kind}, operation, retryAfterSeconds) return NewServerTimeout(schema.GroupResource{Group: qualifiedKind.Group, Resource: qualifiedKind.Kind}, operation, retryAfterSeconds)
} }
// NewInternalError returns an error indicating the item is invalid and cannot be processed. // NewInternalError returns an error indicating the item is invalid and cannot be processed.
@ -285,7 +286,7 @@ func NewTimeoutError(message string, retryAfterSeconds int) *StatusError {
} }
// NewGenericServerResponse returns a new error for server responses that are not in a recognizable form. // NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.
func NewGenericServerResponse(code int, verb string, qualifiedResource unversioned.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) *StatusError { func NewGenericServerResponse(code int, verb string, qualifiedResource schema.GroupResource, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) *StatusError {
reason := unversioned.StatusReasonUnknown reason := unversioned.StatusReasonUnknown
message := fmt.Sprintf("the server responded with the status code %d but did not return more information", code) message := fmt.Sprintf("the server responded with the status code %d but did not return more information", code)
switch code { switch code {

View File

@ -25,11 +25,11 @@ import (
"k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/api/v1" "k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/pkg/apimachinery" "k8s.io/client-go/pkg/apimachinery"
"k8s.io/client-go/pkg/apimachinery/registered" "k8s.io/client-go/pkg/apimachinery/registered"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/util/sets" "k8s.io/client-go/pkg/util/sets"
) )
@ -38,11 +38,11 @@ const importPrefix = "k8s.io/client-go/pkg/api"
var accessor = meta.NewAccessor() var accessor = meta.NewAccessor()
// availableVersions lists all known external versions for this group from most preferred to least preferred // availableVersions lists all known external versions for this group from most preferred to least preferred
var availableVersions = []unversioned.GroupVersion{v1.SchemeGroupVersion} var availableVersions = []schema.GroupVersion{v1.SchemeGroupVersion}
func init() { func init() {
registered.RegisterVersions(availableVersions) registered.RegisterVersions(availableVersions)
externalVersions := []unversioned.GroupVersion{} externalVersions := []schema.GroupVersion{}
for _, v := range availableVersions { for _, v := range availableVersions {
if registered.IsAllowedVersion(v) { if registered.IsAllowedVersion(v) {
externalVersions = append(externalVersions, v) externalVersions = append(externalVersions, v)
@ -67,7 +67,7 @@ func init() {
// group. // group.
// We can combine registered.RegisterVersions, registered.EnableVersions and // We can combine registered.RegisterVersions, registered.EnableVersions and
// registered.RegisterGroup once we have moved enableVersions there. // registered.RegisterGroup once we have moved enableVersions there.
func enableVersions(externalVersions []unversioned.GroupVersion) error { func enableVersions(externalVersions []schema.GroupVersion) error {
addVersionsToScheme(externalVersions...) addVersionsToScheme(externalVersions...)
preferredExternalVersion := externalVersions[0] preferredExternalVersion := externalVersions[0]
@ -85,7 +85,7 @@ func enableVersions(externalVersions []unversioned.GroupVersion) error {
return nil return nil
} }
func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper { func newRESTMapper(externalVersions []schema.GroupVersion) meta.RESTMapper {
// the list of kinds that are scoped at the root of the api hierarchy // the list of kinds that are scoped at the root of the api hierarchy
// if a kind is not enumerated here, it is assumed to have a namespace scope // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString( rootScoped := sets.NewString(
@ -117,7 +117,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper
// InterfacesFor returns the default Codec and ResourceVersioner for a given version // InterfacesFor returns the default Codec and ResourceVersioner for a given version
// string, or an error if the version is not known. // string, or an error if the version is not known.
func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { func interfacesFor(version schema.GroupVersion) (*meta.VersionInterfaces, error) {
switch version { switch version {
case v1.SchemeGroupVersion: case v1.SchemeGroupVersion:
return &meta.VersionInterfaces{ return &meta.VersionInterfaces{
@ -130,7 +130,7 @@ func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, e
} }
} }
func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) { func addVersionsToScheme(externalVersions ...schema.GroupVersion) {
// add the internal version to Scheme // add the internal version to Scheme
if err := api.AddToScheme(api.Scheme); err != nil { if err := api.AddToScheme(api.Scheme); err != nil {
// Programmer error, detect immediately // Programmer error, detect immediately

View File

@ -20,19 +20,19 @@ import (
"strings" "strings"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/util/sets" "k8s.io/client-go/pkg/util/sets"
) )
// Instantiates a DefaultRESTMapper based on types registered in api.Scheme // Instantiates a DefaultRESTMapper based on types registered in api.Scheme
func NewDefaultRESTMapper(defaultGroupVersions []unversioned.GroupVersion, interfacesFunc meta.VersionInterfacesFunc, func NewDefaultRESTMapper(defaultGroupVersions []schema.GroupVersion, interfacesFunc meta.VersionInterfacesFunc,
importPathPrefix string, ignoredKinds, rootScoped sets.String) *meta.DefaultRESTMapper { importPathPrefix string, ignoredKinds, rootScoped sets.String) *meta.DefaultRESTMapper {
return NewDefaultRESTMapperFromScheme(defaultGroupVersions, interfacesFunc, importPathPrefix, ignoredKinds, rootScoped, Scheme) return NewDefaultRESTMapperFromScheme(defaultGroupVersions, interfacesFunc, importPathPrefix, ignoredKinds, rootScoped, Scheme)
} }
// Instantiates a DefaultRESTMapper based on types registered in the given scheme. // Instantiates a DefaultRESTMapper based on types registered in the given scheme.
func NewDefaultRESTMapperFromScheme(defaultGroupVersions []unversioned.GroupVersion, interfacesFunc meta.VersionInterfacesFunc, func NewDefaultRESTMapperFromScheme(defaultGroupVersions []schema.GroupVersion, interfacesFunc meta.VersionInterfacesFunc,
importPathPrefix string, ignoredKinds, rootScoped sets.String, scheme *runtime.Scheme) *meta.DefaultRESTMapper { importPathPrefix string, ignoredKinds, rootScoped sets.String, scheme *runtime.Scheme) *meta.DefaultRESTMapper {
mapper := meta.NewDefaultRESTMapper(defaultGroupVersions, interfacesFunc) mapper := meta.NewDefaultRESTMapper(defaultGroupVersions, interfacesFunc)

View File

@ -19,15 +19,15 @@ package meta
import ( import (
"fmt" "fmt"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/runtime/schema"
) )
// AmbiguousResourceError is returned if the RESTMapper finds multiple matches for a resource // AmbiguousResourceError is returned if the RESTMapper finds multiple matches for a resource
type AmbiguousResourceError struct { type AmbiguousResourceError struct {
PartialResource unversioned.GroupVersionResource PartialResource schema.GroupVersionResource
MatchingResources []unversioned.GroupVersionResource MatchingResources []schema.GroupVersionResource
MatchingKinds []unversioned.GroupVersionKind MatchingKinds []schema.GroupVersionKind
} }
func (e *AmbiguousResourceError) Error() string { func (e *AmbiguousResourceError) Error() string {
@ -44,10 +44,10 @@ func (e *AmbiguousResourceError) Error() string {
// AmbiguousKindError is returned if the RESTMapper finds multiple matches for a kind // AmbiguousKindError is returned if the RESTMapper finds multiple matches for a kind
type AmbiguousKindError struct { type AmbiguousKindError struct {
PartialKind unversioned.GroupVersionKind PartialKind schema.GroupVersionKind
MatchingResources []unversioned.GroupVersionResource MatchingResources []schema.GroupVersionResource
MatchingKinds []unversioned.GroupVersionKind MatchingKinds []schema.GroupVersionKind
} }
func (e *AmbiguousKindError) Error() string { func (e *AmbiguousKindError) Error() string {
@ -76,7 +76,7 @@ func IsAmbiguousError(err error) bool {
// NoResourceMatchError is returned if the RESTMapper can't find any match for a resource // NoResourceMatchError is returned if the RESTMapper can't find any match for a resource
type NoResourceMatchError struct { type NoResourceMatchError struct {
PartialResource unversioned.GroupVersionResource PartialResource schema.GroupVersionResource
} }
func (e *NoResourceMatchError) Error() string { func (e *NoResourceMatchError) Error() string {
@ -85,7 +85,7 @@ func (e *NoResourceMatchError) Error() string {
// NoKindMatchError is returned if the RESTMapper can't find any match for a kind // NoKindMatchError is returned if the RESTMapper can't find any match for a kind
type NoKindMatchError struct { type NoKindMatchError struct {
PartialKind unversioned.GroupVersionKind PartialKind schema.GroupVersionKind
} }
func (e *NoKindMatchError) Error() string { func (e *NoKindMatchError) Error() string {

View File

@ -19,7 +19,7 @@ package meta
import ( import (
"fmt" "fmt"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/runtime/schema"
utilerrors "k8s.io/client-go/pkg/util/errors" utilerrors "k8s.io/client-go/pkg/util/errors"
) )
@ -33,7 +33,7 @@ func (m FirstHitRESTMapper) String() string {
return fmt.Sprintf("FirstHitRESTMapper{\n\t%v\n}", m.MultiRESTMapper) return fmt.Sprintf("FirstHitRESTMapper{\n\t%v\n}", m.MultiRESTMapper)
} }
func (m FirstHitRESTMapper) ResourceFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { func (m FirstHitRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) {
errors := []error{} errors := []error{}
for _, t := range m.MultiRESTMapper { for _, t := range m.MultiRESTMapper {
ret, err := t.ResourceFor(resource) ret, err := t.ResourceFor(resource)
@ -43,10 +43,10 @@ func (m FirstHitRESTMapper) ResourceFor(resource unversioned.GroupVersionResourc
errors = append(errors, err) errors = append(errors, err)
} }
return unversioned.GroupVersionResource{}, collapseAggregateErrors(errors) return schema.GroupVersionResource{}, collapseAggregateErrors(errors)
} }
func (m FirstHitRESTMapper) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { func (m FirstHitRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
errors := []error{} errors := []error{}
for _, t := range m.MultiRESTMapper { for _, t := range m.MultiRESTMapper {
ret, err := t.KindFor(resource) ret, err := t.KindFor(resource)
@ -56,13 +56,13 @@ func (m FirstHitRESTMapper) KindFor(resource unversioned.GroupVersionResource) (
errors = append(errors, err) errors = append(errors, err)
} }
return unversioned.GroupVersionKind{}, collapseAggregateErrors(errors) return schema.GroupVersionKind{}, collapseAggregateErrors(errors)
} }
// RESTMapping provides the REST mapping for the resource based on the // RESTMapping provides the REST mapping for the resource based on the
// kind and version. This implementation supports multiple REST schemas and // kind and version. This implementation supports multiple REST schemas and
// return the first match. // return the first match.
func (m FirstHitRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error) { func (m FirstHitRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*RESTMapping, error) {
errors := []error{} errors := []error{}
for _, t := range m.MultiRESTMapper { for _, t := range m.MultiRESTMapper {
ret, err := t.RESTMapping(gk, versions...) ret, err := t.RESTMapping(gk, versions...)

View File

@ -20,6 +20,7 @@ import (
"k8s.io/client-go/pkg/api/meta/metatypes" "k8s.io/client-go/pkg/api/meta/metatypes"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/types" "k8s.io/client-go/pkg/types"
) )
@ -143,7 +144,7 @@ type RESTMapping struct {
// Resource is a string representing the name of this resource as a REST client would see it // Resource is a string representing the name of this resource as a REST client would see it
Resource string Resource string
GroupVersionKind unversioned.GroupVersionKind GroupVersionKind schema.GroupVersionKind
// Scope contains the information needed to deal with REST Resources that are in a resource hierarchy // Scope contains the information needed to deal with REST Resources that are in a resource hierarchy
Scope RESTScope Scope RESTScope
@ -163,21 +164,21 @@ type RESTMapping struct {
// TODO: split into sub-interfaces // TODO: split into sub-interfaces
type RESTMapper interface { type RESTMapper interface {
// KindFor takes a partial resource and returns the single match. Returns an error if there are multiple matches // KindFor takes a partial resource and returns the single match. Returns an error if there are multiple matches
KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error)
// KindsFor takes a partial resource and returns the list of potential kinds in priority order // KindsFor takes a partial resource and returns the list of potential kinds in priority order
KindsFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionKind, error) KindsFor(resource schema.GroupVersionResource) ([]schema.GroupVersionKind, error)
// ResourceFor takes a partial resource and returns the single match. Returns an error if there are multiple matches // ResourceFor takes a partial resource and returns the single match. Returns an error if there are multiple matches
ResourceFor(input unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) ResourceFor(input schema.GroupVersionResource) (schema.GroupVersionResource, error)
// ResourcesFor takes a partial resource and returns the list of potential resource in priority order // ResourcesFor takes a partial resource and returns the list of potential resource in priority order
ResourcesFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) ResourcesFor(input schema.GroupVersionResource) ([]schema.GroupVersionResource, error)
// RESTMapping identifies a preferred resource mapping for the provided group kind. // RESTMapping identifies a preferred resource mapping for the provided group kind.
RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error) RESTMapping(gk schema.GroupKind, versions ...string) (*RESTMapping, error)
// RESTMappings returns all resource mappings for the provided group kind. // RESTMappings returns all resource mappings for the provided group kind.
RESTMappings(gk unversioned.GroupKind) ([]*RESTMapping, error) RESTMappings(gk schema.GroupKind) ([]*RESTMapping, error)
AliasesForResource(resource string) ([]string, bool) AliasesForResource(resource string) ([]string, bool)
ResourceSingularizer(resource string) (singular string, err error) ResourceSingularizer(resource string) (singular string, err error)

View File

@ -24,6 +24,7 @@ import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/conversion" "k8s.io/client-go/pkg/conversion"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/types" "k8s.io/client-go/pkg/types"
"github.com/golang/glog" "github.com/golang/glog"
@ -140,9 +141,9 @@ func (obj objectAccessor) GetAPIVersion() string {
func (obj objectAccessor) SetAPIVersion(version string) { func (obj objectAccessor) SetAPIVersion(version string) {
gvk := obj.GetObjectKind().GroupVersionKind() gvk := obj.GetObjectKind().GroupVersionKind()
gv, err := unversioned.ParseGroupVersion(version) gv, err := schema.ParseGroupVersion(version)
if err != nil { if err != nil {
gv = unversioned.GroupVersion{Version: version} gv = schema.GroupVersion{Version: version}
} }
gvk.Group, gvk.Version = gv.Group, gv.Version gvk.Group, gvk.Version = gv.Group, gv.Version
obj.GetObjectKind().SetGroupVersionKind(gvk) obj.GetObjectKind().SetGroupVersionKind(gvk)

View File

@ -20,7 +20,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/runtime/schema"
utilerrors "k8s.io/client-go/pkg/util/errors" utilerrors "k8s.io/client-go/pkg/util/errors"
"k8s.io/client-go/pkg/util/sets" "k8s.io/client-go/pkg/util/sets"
) )
@ -51,8 +51,8 @@ func (m MultiRESTMapper) ResourceSingularizer(resource string) (singular string,
return return
} }
func (m MultiRESTMapper) ResourcesFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) { func (m MultiRESTMapper) ResourcesFor(resource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) {
allGVRs := []unversioned.GroupVersionResource{} allGVRs := []schema.GroupVersionResource{}
for _, t := range m { for _, t := range m {
gvrs, err := t.ResourcesFor(resource) gvrs, err := t.ResourcesFor(resource)
// ignore "no match" errors, but any other error percolates back up // ignore "no match" errors, but any other error percolates back up
@ -86,8 +86,8 @@ func (m MultiRESTMapper) ResourcesFor(resource unversioned.GroupVersionResource)
return allGVRs, nil return allGVRs, nil
} }
func (m MultiRESTMapper) KindsFor(resource unversioned.GroupVersionResource) (gvk []unversioned.GroupVersionKind, err error) { func (m MultiRESTMapper) KindsFor(resource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) {
allGVKs := []unversioned.GroupVersionKind{} allGVKs := []schema.GroupVersionKind{}
for _, t := range m { for _, t := range m {
gvks, err := t.KindsFor(resource) gvks, err := t.KindsFor(resource)
// ignore "no match" errors, but any other error percolates back up // ignore "no match" errors, but any other error percolates back up
@ -121,34 +121,34 @@ func (m MultiRESTMapper) KindsFor(resource unversioned.GroupVersionResource) (gv
return allGVKs, nil return allGVKs, nil
} }
func (m MultiRESTMapper) ResourceFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { func (m MultiRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) {
resources, err := m.ResourcesFor(resource) resources, err := m.ResourcesFor(resource)
if err != nil { if err != nil {
return unversioned.GroupVersionResource{}, err return schema.GroupVersionResource{}, err
} }
if len(resources) == 1 { if len(resources) == 1 {
return resources[0], nil return resources[0], nil
} }
return unversioned.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources} return schema.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources}
} }
func (m MultiRESTMapper) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { func (m MultiRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
kinds, err := m.KindsFor(resource) kinds, err := m.KindsFor(resource)
if err != nil { if err != nil {
return unversioned.GroupVersionKind{}, err return schema.GroupVersionKind{}, err
} }
if len(kinds) == 1 { if len(kinds) == 1 {
return kinds[0], nil return kinds[0], nil
} }
return unversioned.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: resource, MatchingKinds: kinds} return schema.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: resource, MatchingKinds: kinds}
} }
// RESTMapping provides the REST mapping for the resource based on the // RESTMapping provides the REST mapping for the resource based on the
// kind and version. This implementation supports multiple REST schemas and // kind and version. This implementation supports multiple REST schemas and
// return the first match. // return the first match.
func (m MultiRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error) { func (m MultiRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*RESTMapping, error) {
allMappings := []*RESTMapping{} allMappings := []*RESTMapping{}
errors := []error{} errors := []error{}
@ -171,7 +171,7 @@ func (m MultiRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...strin
return allMappings[0], nil return allMappings[0], nil
} }
if len(allMappings) > 1 { if len(allMappings) > 1 {
var kinds []unversioned.GroupVersionKind var kinds []schema.GroupVersionKind
for _, m := range allMappings { for _, m := range allMappings {
kinds = append(kinds, m.GroupVersionKind) kinds = append(kinds, m.GroupVersionKind)
} }
@ -185,7 +185,7 @@ func (m MultiRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...strin
// RESTMappings returns all possible RESTMappings for the provided group kind, or an error // RESTMappings returns all possible RESTMappings for the provided group kind, or an error
// if the type is not recognized. // if the type is not recognized.
func (m MultiRESTMapper) RESTMappings(gk unversioned.GroupKind) ([]*RESTMapping, error) { func (m MultiRESTMapper) RESTMappings(gk schema.GroupKind) ([]*RESTMapping, error) {
var allMappings []*RESTMapping var allMappings []*RESTMapping
var errors []error var errors []error

View File

@ -19,7 +19,7 @@ package meta
import ( import (
"fmt" "fmt"
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/runtime/schema"
) )
const ( const (
@ -39,13 +39,13 @@ type PriorityRESTMapper struct {
// The list of all matching resources is narrowed based on the patterns until only one remains. // The list of all matching resources is narrowed based on the patterns until only one remains.
// A pattern with no matches is skipped. A pattern with more than one match uses its // A pattern with no matches is skipped. A pattern with more than one match uses its
// matches as the list to continue matching against. // matches as the list to continue matching against.
ResourcePriority []unversioned.GroupVersionResource ResourcePriority []schema.GroupVersionResource
// KindPriority is a list of priority patterns to apply to matching kinds. // KindPriority is a list of priority patterns to apply to matching kinds.
// The list of all matching kinds is narrowed based on the patterns until only one remains. // The list of all matching kinds is narrowed based on the patterns until only one remains.
// A pattern with no matches is skipped. A pattern with more than one match uses its // A pattern with no matches is skipped. A pattern with more than one match uses its
// matches as the list to continue matching against. // matches as the list to continue matching against.
KindPriority []unversioned.GroupVersionKind KindPriority []schema.GroupVersionKind
} }
func (m PriorityRESTMapper) String() string { func (m PriorityRESTMapper) String() string {
@ -53,18 +53,18 @@ func (m PriorityRESTMapper) String() string {
} }
// ResourceFor finds all resources, then passes them through the ResourcePriority patterns to find a single matching hit. // ResourceFor finds all resources, then passes them through the ResourcePriority patterns to find a single matching hit.
func (m PriorityRESTMapper) ResourceFor(partiallySpecifiedResource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { func (m PriorityRESTMapper) ResourceFor(partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionResource, error) {
originalGVRs, err := m.Delegate.ResourcesFor(partiallySpecifiedResource) originalGVRs, err := m.Delegate.ResourcesFor(partiallySpecifiedResource)
if err != nil { if err != nil {
return unversioned.GroupVersionResource{}, err return schema.GroupVersionResource{}, err
} }
if len(originalGVRs) == 1 { if len(originalGVRs) == 1 {
return originalGVRs[0], nil return originalGVRs[0], nil
} }
remainingGVRs := append([]unversioned.GroupVersionResource{}, originalGVRs...) remainingGVRs := append([]schema.GroupVersionResource{}, originalGVRs...)
for _, pattern := range m.ResourcePriority { for _, pattern := range m.ResourcePriority {
matchedGVRs := []unversioned.GroupVersionResource{} matchedGVRs := []schema.GroupVersionResource{}
for _, gvr := range remainingGVRs { for _, gvr := range remainingGVRs {
if resourceMatches(pattern, gvr) { if resourceMatches(pattern, gvr) {
matchedGVRs = append(matchedGVRs, gvr) matchedGVRs = append(matchedGVRs, gvr)
@ -85,22 +85,22 @@ func (m PriorityRESTMapper) ResourceFor(partiallySpecifiedResource unversioned.G
} }
} }
return unversioned.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: partiallySpecifiedResource, MatchingResources: originalGVRs} return schema.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: partiallySpecifiedResource, MatchingResources: originalGVRs}
} }
// KindFor finds all kinds, then passes them through the KindPriority patterns to find a single matching hit. // KindFor finds all kinds, then passes them through the KindPriority patterns to find a single matching hit.
func (m PriorityRESTMapper) KindFor(partiallySpecifiedResource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { func (m PriorityRESTMapper) KindFor(partiallySpecifiedResource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
originalGVKs, err := m.Delegate.KindsFor(partiallySpecifiedResource) originalGVKs, err := m.Delegate.KindsFor(partiallySpecifiedResource)
if err != nil { if err != nil {
return unversioned.GroupVersionKind{}, err return schema.GroupVersionKind{}, err
} }
if len(originalGVKs) == 1 { if len(originalGVKs) == 1 {
return originalGVKs[0], nil return originalGVKs[0], nil
} }
remainingGVKs := append([]unversioned.GroupVersionKind{}, originalGVKs...) remainingGVKs := append([]schema.GroupVersionKind{}, originalGVKs...)
for _, pattern := range m.KindPriority { for _, pattern := range m.KindPriority {
matchedGVKs := []unversioned.GroupVersionKind{} matchedGVKs := []schema.GroupVersionKind{}
for _, gvr := range remainingGVKs { for _, gvr := range remainingGVKs {
if kindMatches(pattern, gvr) { if kindMatches(pattern, gvr) {
matchedGVKs = append(matchedGVKs, gvr) matchedGVKs = append(matchedGVKs, gvr)
@ -121,10 +121,10 @@ func (m PriorityRESTMapper) KindFor(partiallySpecifiedResource unversioned.Group
} }
} }
return unversioned.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: partiallySpecifiedResource, MatchingKinds: originalGVKs} return schema.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: partiallySpecifiedResource, MatchingKinds: originalGVKs}
} }
func resourceMatches(pattern unversioned.GroupVersionResource, resource unversioned.GroupVersionResource) bool { func resourceMatches(pattern schema.GroupVersionResource, resource schema.GroupVersionResource) bool {
if pattern.Group != AnyGroup && pattern.Group != resource.Group { if pattern.Group != AnyGroup && pattern.Group != resource.Group {
return false return false
} }
@ -138,7 +138,7 @@ func resourceMatches(pattern unversioned.GroupVersionResource, resource unversio
return true return true
} }
func kindMatches(pattern unversioned.GroupVersionKind, kind unversioned.GroupVersionKind) bool { func kindMatches(pattern schema.GroupVersionKind, kind schema.GroupVersionKind) bool {
if pattern.Group != AnyGroup && pattern.Group != kind.Group { if pattern.Group != AnyGroup && pattern.Group != kind.Group {
return false return false
} }
@ -152,7 +152,7 @@ func kindMatches(pattern unversioned.GroupVersionKind, kind unversioned.GroupVer
return true return true
} }
func (m PriorityRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (mapping *RESTMapping, err error) { func (m PriorityRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (mapping *RESTMapping, err error) {
mappings, err := m.Delegate.RESTMappings(gk) mappings, err := m.Delegate.RESTMappings(gk)
if err != nil { if err != nil {
return nil, err return nil, err
@ -161,9 +161,9 @@ func (m PriorityRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...st
// any versions the user provides take priority // any versions the user provides take priority
priorities := m.KindPriority priorities := m.KindPriority
if len(versions) > 0 { if len(versions) > 0 {
priorities = make([]unversioned.GroupVersionKind, 0, len(m.KindPriority)+len(versions)) priorities = make([]schema.GroupVersionKind, 0, len(m.KindPriority)+len(versions))
for _, version := range versions { for _, version := range versions {
gv, err := unversioned.ParseGroupVersion(version) gv, err := schema.ParseGroupVersion(version)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -198,14 +198,14 @@ func (m PriorityRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...st
return remaining[0], nil return remaining[0], nil
} }
var kinds []unversioned.GroupVersionKind var kinds []schema.GroupVersionKind
for _, m := range mappings { for _, m := range mappings {
kinds = append(kinds, m.GroupVersionKind) kinds = append(kinds, m.GroupVersionKind)
} }
return nil, &AmbiguousKindError{PartialKind: gk.WithVersion(""), MatchingKinds: kinds} return nil, &AmbiguousKindError{PartialKind: gk.WithVersion(""), MatchingKinds: kinds}
} }
func (m PriorityRESTMapper) RESTMappings(gk unversioned.GroupKind) ([]*RESTMapping, error) { func (m PriorityRESTMapper) RESTMappings(gk schema.GroupKind) ([]*RESTMapping, error) {
return m.Delegate.RESTMappings(gk) return m.Delegate.RESTMappings(gk)
} }
@ -217,10 +217,10 @@ func (m PriorityRESTMapper) ResourceSingularizer(resource string) (singular stri
return m.Delegate.ResourceSingularizer(resource) return m.Delegate.ResourceSingularizer(resource)
} }
func (m PriorityRESTMapper) ResourcesFor(partiallySpecifiedResource unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) { func (m PriorityRESTMapper) ResourcesFor(partiallySpecifiedResource schema.GroupVersionResource) ([]schema.GroupVersionResource, error) {
return m.Delegate.ResourcesFor(partiallySpecifiedResource) return m.Delegate.ResourcesFor(partiallySpecifiedResource)
} }
func (m PriorityRESTMapper) KindsFor(partiallySpecifiedResource unversioned.GroupVersionResource) (gvk []unversioned.GroupVersionKind, err error) { func (m PriorityRESTMapper) KindsFor(partiallySpecifiedResource schema.GroupVersionResource) (gvk []schema.GroupVersionKind, err error) {
return m.Delegate.KindsFor(partiallySpecifiedResource) return m.Delegate.KindsFor(partiallySpecifiedResource)
} }

View File

@ -22,8 +22,8 @@ import (
"sort" "sort"
"strings" "strings"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
// Implements RESTScope interface // Implements RESTScope interface
@ -70,13 +70,13 @@ var RESTScopeRoot = &restScope{
// TODO: Only accept plural for some operations for increased control? // TODO: Only accept plural for some operations for increased control?
// (`get pod bar` vs `get pods bar`) // (`get pod bar` vs `get pods bar`)
type DefaultRESTMapper struct { type DefaultRESTMapper struct {
defaultGroupVersions []unversioned.GroupVersion defaultGroupVersions []schema.GroupVersion
resourceToKind map[unversioned.GroupVersionResource]unversioned.GroupVersionKind resourceToKind map[schema.GroupVersionResource]schema.GroupVersionKind
kindToPluralResource map[unversioned.GroupVersionKind]unversioned.GroupVersionResource kindToPluralResource map[schema.GroupVersionKind]schema.GroupVersionResource
kindToScope map[unversioned.GroupVersionKind]RESTScope kindToScope map[schema.GroupVersionKind]RESTScope
singularToPlural map[unversioned.GroupVersionResource]unversioned.GroupVersionResource singularToPlural map[schema.GroupVersionResource]schema.GroupVersionResource
pluralToSingular map[unversioned.GroupVersionResource]unversioned.GroupVersionResource pluralToSingular map[schema.GroupVersionResource]schema.GroupVersionResource
interfacesFunc VersionInterfacesFunc interfacesFunc VersionInterfacesFunc
@ -92,19 +92,19 @@ var _ RESTMapper = &DefaultRESTMapper{}
// VersionInterfacesFunc returns the appropriate typer, and metadata accessor for a // VersionInterfacesFunc returns the appropriate typer, and metadata accessor for a
// given api version, or an error if no such api version exists. // given api version, or an error if no such api version exists.
type VersionInterfacesFunc func(version unversioned.GroupVersion) (*VersionInterfaces, error) type VersionInterfacesFunc func(version schema.GroupVersion) (*VersionInterfaces, error)
// NewDefaultRESTMapper initializes a mapping between Kind and APIVersion // NewDefaultRESTMapper initializes a mapping between Kind and APIVersion
// to a resource name and back based on the objects in a runtime.Scheme // to a resource name and back based on the objects in a runtime.Scheme
// and the Kubernetes API conventions. Takes a group name, a priority list of the versions // and the Kubernetes API conventions. Takes a group name, a priority list of the versions
// to search when an object has no default version (set empty to return an error), // to search when an object has no default version (set empty to return an error),
// and a function that retrieves the correct metadata for a given version. // and a function that retrieves the correct metadata for a given version.
func NewDefaultRESTMapper(defaultGroupVersions []unversioned.GroupVersion, f VersionInterfacesFunc) *DefaultRESTMapper { func NewDefaultRESTMapper(defaultGroupVersions []schema.GroupVersion, f VersionInterfacesFunc) *DefaultRESTMapper {
resourceToKind := make(map[unversioned.GroupVersionResource]unversioned.GroupVersionKind) resourceToKind := make(map[schema.GroupVersionResource]schema.GroupVersionKind)
kindToPluralResource := make(map[unversioned.GroupVersionKind]unversioned.GroupVersionResource) kindToPluralResource := make(map[schema.GroupVersionKind]schema.GroupVersionResource)
kindToScope := make(map[unversioned.GroupVersionKind]RESTScope) kindToScope := make(map[schema.GroupVersionKind]RESTScope)
singularToPlural := make(map[unversioned.GroupVersionResource]unversioned.GroupVersionResource) singularToPlural := make(map[schema.GroupVersionResource]schema.GroupVersionResource)
pluralToSingular := make(map[unversioned.GroupVersionResource]unversioned.GroupVersionResource) pluralToSingular := make(map[schema.GroupVersionResource]schema.GroupVersionResource)
aliasToResource := make(map[string][]string) aliasToResource := make(map[string][]string)
// TODO: verify name mappings work correctly when versions differ // TODO: verify name mappings work correctly when versions differ
@ -120,7 +120,7 @@ func NewDefaultRESTMapper(defaultGroupVersions []unversioned.GroupVersion, f Ver
} }
} }
func (m *DefaultRESTMapper) Add(kind unversioned.GroupVersionKind, scope RESTScope) { func (m *DefaultRESTMapper) Add(kind schema.GroupVersionKind, scope RESTScope) {
plural, singular := KindToResource(kind) plural, singular := KindToResource(kind)
m.singularToPlural[singular] = plural m.singularToPlural[singular] = plural
@ -144,10 +144,10 @@ var unpluralizedSuffixes = []string{
// KindToResource converts Kind to a resource name. // KindToResource converts Kind to a resource name.
// Broken. This method only "sort of" works when used outside of this package. It assumes that Kinds and Resources match // Broken. This method only "sort of" works when used outside of this package. It assumes that Kinds and Resources match
// and they aren't guaranteed to do so. // and they aren't guaranteed to do so.
func KindToResource(kind unversioned.GroupVersionKind) ( /*plural*/ unversioned.GroupVersionResource /*singular*/, unversioned.GroupVersionResource) { func KindToResource(kind schema.GroupVersionKind) ( /*plural*/ schema.GroupVersionResource /*singular*/, schema.GroupVersionResource) {
kindName := kind.Kind kindName := kind.Kind
if len(kindName) == 0 { if len(kindName) == 0 {
return unversioned.GroupVersionResource{}, unversioned.GroupVersionResource{} return schema.GroupVersionResource{}, schema.GroupVersionResource{}
} }
singularName := strings.ToLower(kindName) singularName := strings.ToLower(kindName)
singular := kind.GroupVersion().WithResource(singularName) singular := kind.GroupVersion().WithResource(singularName)
@ -171,13 +171,13 @@ func KindToResource(kind unversioned.GroupVersionKind) ( /*plural*/ unversioned.
// ResourceSingularizer implements RESTMapper // ResourceSingularizer implements RESTMapper
// It converts a resource name from plural to singular (e.g., from pods to pod) // It converts a resource name from plural to singular (e.g., from pods to pod)
func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, error) { func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, error) {
partialResource := unversioned.GroupVersionResource{Resource: resourceType} partialResource := schema.GroupVersionResource{Resource: resourceType}
resources, err := m.ResourcesFor(partialResource) resources, err := m.ResourcesFor(partialResource)
if err != nil { if err != nil {
return resourceType, err return resourceType, err
} }
singular := unversioned.GroupVersionResource{} singular := schema.GroupVersionResource{}
for _, curr := range resources { for _, curr := range resources {
currSingular, ok := m.pluralToSingular[curr] currSingular, ok := m.pluralToSingular[curr]
if !ok { if !ok {
@ -201,7 +201,7 @@ func (m *DefaultRESTMapper) ResourceSingularizer(resourceType string) (string, e
} }
// coerceResourceForMatching makes the resource lower case and converts internal versions to unspecified (legacy behavior) // coerceResourceForMatching makes the resource lower case and converts internal versions to unspecified (legacy behavior)
func coerceResourceForMatching(resource unversioned.GroupVersionResource) unversioned.GroupVersionResource { func coerceResourceForMatching(resource schema.GroupVersionResource) schema.GroupVersionResource {
resource.Resource = strings.ToLower(resource.Resource) resource.Resource = strings.ToLower(resource.Resource)
if resource.Version == runtime.APIVersionInternal { if resource.Version == runtime.APIVersionInternal {
resource.Version = "" resource.Version = ""
@ -210,7 +210,7 @@ func coerceResourceForMatching(resource unversioned.GroupVersionResource) unvers
return resource return resource
} }
func (m *DefaultRESTMapper) ResourcesFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error) { func (m *DefaultRESTMapper) ResourcesFor(input schema.GroupVersionResource) ([]schema.GroupVersionResource, error) {
resource := coerceResourceForMatching(input) resource := coerceResourceForMatching(input)
hasResource := len(resource.Resource) > 0 hasResource := len(resource.Resource) > 0
@ -221,7 +221,7 @@ func (m *DefaultRESTMapper) ResourcesFor(input unversioned.GroupVersionResource)
return nil, fmt.Errorf("a resource must be present, got: %v", resource) return nil, fmt.Errorf("a resource must be present, got: %v", resource)
} }
ret := []unversioned.GroupVersionResource{} ret := []schema.GroupVersionResource{}
switch { switch {
case hasGroup && hasVersion: case hasGroup && hasVersion:
// fully qualified. Find the exact match // fully qualified. Find the exact match
@ -297,19 +297,19 @@ func (m *DefaultRESTMapper) ResourcesFor(input unversioned.GroupVersionResource)
return ret, nil return ret, nil
} }
func (m *DefaultRESTMapper) ResourceFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error) { func (m *DefaultRESTMapper) ResourceFor(resource schema.GroupVersionResource) (schema.GroupVersionResource, error) {
resources, err := m.ResourcesFor(resource) resources, err := m.ResourcesFor(resource)
if err != nil { if err != nil {
return unversioned.GroupVersionResource{}, err return schema.GroupVersionResource{}, err
} }
if len(resources) == 1 { if len(resources) == 1 {
return resources[0], nil return resources[0], nil
} }
return unversioned.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources} return schema.GroupVersionResource{}, &AmbiguousResourceError{PartialResource: resource, MatchingResources: resources}
} }
func (m *DefaultRESTMapper) KindsFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionKind, error) { func (m *DefaultRESTMapper) KindsFor(input schema.GroupVersionResource) ([]schema.GroupVersionKind, error) {
resource := coerceResourceForMatching(input) resource := coerceResourceForMatching(input)
hasResource := len(resource.Resource) > 0 hasResource := len(resource.Resource) > 0
@ -320,7 +320,7 @@ func (m *DefaultRESTMapper) KindsFor(input unversioned.GroupVersionResource) ([]
return nil, fmt.Errorf("a resource must be present, got: %v", resource) return nil, fmt.Errorf("a resource must be present, got: %v", resource)
} }
ret := []unversioned.GroupVersionKind{} ret := []schema.GroupVersionKind{}
switch { switch {
// fully qualified. Find the exact match // fully qualified. Find the exact match
case hasGroup && hasVersion: case hasGroup && hasVersion:
@ -376,21 +376,21 @@ func (m *DefaultRESTMapper) KindsFor(input unversioned.GroupVersionResource) ([]
return ret, nil return ret, nil
} }
func (m *DefaultRESTMapper) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) { func (m *DefaultRESTMapper) KindFor(resource schema.GroupVersionResource) (schema.GroupVersionKind, error) {
kinds, err := m.KindsFor(resource) kinds, err := m.KindsFor(resource)
if err != nil { if err != nil {
return unversioned.GroupVersionKind{}, err return schema.GroupVersionKind{}, err
} }
if len(kinds) == 1 { if len(kinds) == 1 {
return kinds[0], nil return kinds[0], nil
} }
return unversioned.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: resource, MatchingKinds: kinds} return schema.GroupVersionKind{}, &AmbiguousResourceError{PartialResource: resource, MatchingKinds: kinds}
} }
type kindByPreferredGroupVersion struct { type kindByPreferredGroupVersion struct {
list []unversioned.GroupVersionKind list []schema.GroupVersionKind
sortOrder []unversioned.GroupVersion sortOrder []schema.GroupVersion
} }
func (o kindByPreferredGroupVersion) Len() int { return len(o.list) } func (o kindByPreferredGroupVersion) Len() int { return len(o.list) }
@ -427,8 +427,8 @@ func (o kindByPreferredGroupVersion) Less(i, j int) bool {
} }
type resourceByPreferredGroupVersion struct { type resourceByPreferredGroupVersion struct {
list []unversioned.GroupVersionResource list []schema.GroupVersionResource
sortOrder []unversioned.GroupVersion sortOrder []schema.GroupVersion
} }
func (o resourceByPreferredGroupVersion) Len() int { return len(o.list) } func (o resourceByPreferredGroupVersion) Len() int { return len(o.list) }
@ -469,9 +469,9 @@ func (o resourceByPreferredGroupVersion) Less(i, j int) bool {
// order is not provided, the search order provided to DefaultRESTMapper will be used to resolve which // order is not provided, the search order provided to DefaultRESTMapper will be used to resolve which
// version should be used to access the named group/kind. // version should be used to access the named group/kind.
// TODO: consider refactoring to use RESTMappings in a way that preserves version ordering and preference // TODO: consider refactoring to use RESTMappings in a way that preserves version ordering and preference
func (m *DefaultRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error) { func (m *DefaultRESTMapper) RESTMapping(gk schema.GroupKind, versions ...string) (*RESTMapping, error) {
// Pick an appropriate version // Pick an appropriate version
var gvk *unversioned.GroupVersionKind var gvk *schema.GroupVersionKind
hadVersion := false hadVersion := false
for _, version := range versions { for _, version := range versions {
if len(version) == 0 || version == runtime.APIVersionInternal { if len(version) == 0 || version == runtime.APIVersionInternal {
@ -506,7 +506,7 @@ func (m *DefaultRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...st
// Ensure we have a REST mapping // Ensure we have a REST mapping
resource, ok := m.kindToPluralResource[*gvk] resource, ok := m.kindToPluralResource[*gvk]
if !ok { if !ok {
found := []unversioned.GroupVersion{} found := []schema.GroupVersion{}
for _, gv := range m.defaultGroupVersions { for _, gv := range m.defaultGroupVersions {
if _, ok := m.kindToPluralResource[*gvk]; ok { if _, ok := m.kindToPluralResource[*gvk]; ok {
found = append(found, gv) found = append(found, gv)
@ -543,7 +543,7 @@ func (m *DefaultRESTMapper) RESTMapping(gk unversioned.GroupKind, versions ...st
// RESTMappings returns the RESTMappings for the provided group kind in a rough internal preferred order. If no // RESTMappings returns the RESTMappings for the provided group kind in a rough internal preferred order. If no
// kind is found it will return a NoResourceMatchError. // kind is found it will return a NoResourceMatchError.
func (m *DefaultRESTMapper) RESTMappings(gk unversioned.GroupKind) ([]*RESTMapping, error) { func (m *DefaultRESTMapper) RESTMappings(gk schema.GroupKind) ([]*RESTMapping, error) {
// Use the default preferred versions // Use the default preferred versions
var mappings []*RESTMapping var mappings []*RESTMapping
for _, gv := range m.defaultGroupVersions { for _, gv := range m.defaultGroupVersions {
@ -579,7 +579,7 @@ func (m *DefaultRESTMapper) RESTMappings(gk unversioned.GroupKind) ([]*RESTMappi
} }
if len(mappings) == 0 { if len(mappings) == 0 {
return nil, &NoResourceMatchError{PartialResource: unversioned.GroupVersionResource{Group: gk.Group, Resource: gk.Kind}} return nil, &NoResourceMatchError{PartialResource: schema.GroupVersionResource{Group: gk.Group, Resource: gk.Kind}}
} }
return mappings, nil return mappings, nil
} }

View File

@ -17,13 +17,13 @@ limitations under the License.
package meta package meta
import ( import (
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
// InterfacesForUnstructured returns VersionInterfaces suitable for // InterfacesForUnstructured returns VersionInterfaces suitable for
// dealing with runtime.Unstructured objects. // dealing with runtime.Unstructured objects.
func InterfacesForUnstructured(unversioned.GroupVersion) (*VersionInterfaces, error) { func InterfacesForUnstructured(schema.GroupVersion) (*VersionInterfaces, error) {
return &VersionInterfaces{ return &VersionInterfaces{
ObjectConvertor: &runtime.UnstructuredObjectConverter{}, ObjectConvertor: &runtime.UnstructuredObjectConverter{},
MetadataAccessor: NewAccessor(), MetadataAccessor: NewAccessor(),

View File

@ -23,8 +23,8 @@ import (
"strings" "strings"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
var ( var (
@ -122,11 +122,11 @@ func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference
// IsAnAPIObject allows clients to preemptively get a reference to an API object and pass it to places that // IsAnAPIObject allows clients to preemptively get a reference to an API object and pass it to places that
// intend only to get a reference to that object. This simplifies the event recording interface. // intend only to get a reference to that object. This simplifies the event recording interface.
func (obj *ObjectReference) SetGroupVersionKind(gvk unversioned.GroupVersionKind) { func (obj *ObjectReference) SetGroupVersionKind(gvk schema.GroupVersionKind) {
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
} }
func (obj *ObjectReference) GroupVersionKind() unversioned.GroupVersionKind { func (obj *ObjectReference) GroupVersionKind() schema.GroupVersionKind {
return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
} }
func (obj *ObjectReference) GetObjectKind() unversioned.ObjectKind { return obj } func (obj *ObjectReference) GetObjectKind() schema.ObjectKind { return obj }

View File

@ -19,6 +19,7 @@ package api
import ( import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/runtime/serializer" "k8s.io/client-go/pkg/runtime/serializer"
) )
@ -36,22 +37,22 @@ var Codecs = serializer.NewCodecFactory(Scheme)
const GroupName = "" const GroupName = ""
// SchemeGroupVersion is group version used to register these objects // SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Unversioned is group version for unversioned API objects // Unversioned is group version for unversioned API objects
// TODO: this should be v1 probably // TODO: this should be v1 probably
var Unversioned = unversioned.GroupVersion{Group: "", Version: "v1"} var Unversioned = schema.GroupVersion{Group: "", Version: "v1"}
// ParameterCodec handles versioning of objects that are converted to query parameters. // ParameterCodec handles versioning of objects that are converted to query parameters.
var ParameterCodec = runtime.NewParameterCodec(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme)
// Kind takes an unqualified kind and returns a Group qualified GroupKind // Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind { func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind() return SchemeGroupVersion.WithKind(kind).GroupKind()
} }
// Resource takes an unqualified resource and returns a Group qualified GroupResource // Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource { func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource() return SchemeGroupVersion.WithResource(resource).GroupResource()
} }

View File

@ -32,7 +32,6 @@ import (
"k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apimachinery/registered" "k8s.io/client-go/pkg/apimachinery/registered"
"k8s.io/client-go/pkg/apis/apps" "k8s.io/client-go/pkg/apis/apps"
"k8s.io/client-go/pkg/apis/authorization" "k8s.io/client-go/pkg/apis/authorization"
@ -47,6 +46,7 @@ import (
"k8s.io/client-go/pkg/apis/storage" "k8s.io/client-go/pkg/apis/storage"
"k8s.io/client-go/pkg/federation/apis/federation" "k8s.io/client-go/pkg/federation/apis/federation"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/runtime/serializer/recognizer" "k8s.io/client-go/pkg/runtime/serializer/recognizer"
_ "k8s.io/client-go/pkg/api/install" _ "k8s.io/client-go/pkg/api/install"
@ -86,8 +86,8 @@ var (
) )
type TestGroup struct { type TestGroup struct {
externalGroupVersion unversioned.GroupVersion externalGroupVersion schema.GroupVersion
internalGroupVersion unversioned.GroupVersion internalGroupVersion schema.GroupVersion
internalTypes map[string]reflect.Type internalTypes map[string]reflect.Type
externalTypes map[string]reflect.Type externalTypes map[string]reflect.Type
} }
@ -123,12 +123,12 @@ func init() {
testGroupVersions := strings.Split(kubeTestAPI, ",") testGroupVersions := strings.Split(kubeTestAPI, ",")
for i := len(testGroupVersions) - 1; i >= 0; i-- { for i := len(testGroupVersions) - 1; i >= 0; i-- {
gvString := testGroupVersions[i] gvString := testGroupVersions[i]
groupVersion, err := unversioned.ParseGroupVersion(gvString) groupVersion, err := schema.ParseGroupVersion(gvString)
if err != nil { if err != nil {
panic(fmt.Sprintf("Error parsing groupversion %v: %v", gvString, err)) panic(fmt.Sprintf("Error parsing groupversion %v: %v", gvString, err))
} }
internalGroupVersion := unversioned.GroupVersion{Group: groupVersion.Group, Version: runtime.APIVersionInternal} internalGroupVersion := schema.GroupVersion{Group: groupVersion.Group, Version: runtime.APIVersionInternal}
Groups[groupVersion.Group] = TestGroup{ Groups[groupVersion.Group] = TestGroup{
externalGroupVersion: groupVersion, externalGroupVersion: groupVersion,
internalGroupVersion: internalGroupVersion, internalGroupVersion: internalGroupVersion,
@ -139,7 +139,7 @@ func init() {
} }
if _, ok := Groups[api.GroupName]; !ok { if _, ok := Groups[api.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: api.GroupName, Version: registered.GroupOrDie(api.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: api.GroupName, Version: registered.GroupOrDie(api.GroupName).GroupVersion.Version}
Groups[api.GroupName] = TestGroup{ Groups[api.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: api.SchemeGroupVersion, internalGroupVersion: api.SchemeGroupVersion,
@ -148,7 +148,7 @@ func init() {
} }
} }
if _, ok := Groups[extensions.GroupName]; !ok { if _, ok := Groups[extensions.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: extensions.GroupName, Version: registered.GroupOrDie(extensions.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: extensions.GroupName, Version: registered.GroupOrDie(extensions.GroupName).GroupVersion.Version}
Groups[extensions.GroupName] = TestGroup{ Groups[extensions.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: extensions.SchemeGroupVersion, internalGroupVersion: extensions.SchemeGroupVersion,
@ -164,7 +164,7 @@ func init() {
} }
internalTypes[k] = t internalTypes[k] = t
} }
externalGroupVersion := unversioned.GroupVersion{Group: autoscaling.GroupName, Version: registered.GroupOrDie(autoscaling.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: autoscaling.GroupName, Version: registered.GroupOrDie(autoscaling.GroupName).GroupVersion.Version}
Groups[autoscaling.GroupName] = TestGroup{ Groups[autoscaling.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: extensions.SchemeGroupVersion, internalGroupVersion: extensions.SchemeGroupVersion,
@ -180,7 +180,7 @@ func init() {
break break
} }
} }
externalGroupVersion := unversioned.GroupVersion{Group: autoscaling.GroupName, Version: registered.GroupOrDie(autoscaling.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: autoscaling.GroupName, Version: registered.GroupOrDie(autoscaling.GroupName).GroupVersion.Version}
Groups[autoscaling.GroupName] = TestGroup{ Groups[autoscaling.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: autoscaling.SchemeGroupVersion, internalGroupVersion: autoscaling.SchemeGroupVersion,
@ -189,7 +189,7 @@ func init() {
} }
} }
if _, ok := Groups[batch.GroupName]; !ok { if _, ok := Groups[batch.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: batch.GroupName, Version: registered.GroupOrDie(batch.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: batch.GroupName, Version: registered.GroupOrDie(batch.GroupName).GroupVersion.Version}
Groups[batch.GroupName] = TestGroup{ Groups[batch.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: batch.SchemeGroupVersion, internalGroupVersion: batch.SchemeGroupVersion,
@ -198,7 +198,7 @@ func init() {
} }
} }
if _, ok := Groups[apps.GroupName]; !ok { if _, ok := Groups[apps.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: apps.GroupName, Version: registered.GroupOrDie(apps.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: apps.GroupName, Version: registered.GroupOrDie(apps.GroupName).GroupVersion.Version}
Groups[apps.GroupName] = TestGroup{ Groups[apps.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: extensions.SchemeGroupVersion, internalGroupVersion: extensions.SchemeGroupVersion,
@ -207,7 +207,7 @@ func init() {
} }
} }
if _, ok := Groups[policy.GroupName]; !ok { if _, ok := Groups[policy.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: policy.GroupName, Version: registered.GroupOrDie(policy.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: policy.GroupName, Version: registered.GroupOrDie(policy.GroupName).GroupVersion.Version}
Groups[policy.GroupName] = TestGroup{ Groups[policy.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: policy.SchemeGroupVersion, internalGroupVersion: policy.SchemeGroupVersion,
@ -216,7 +216,7 @@ func init() {
} }
} }
if _, ok := Groups[federation.GroupName]; !ok { if _, ok := Groups[federation.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: federation.GroupName, Version: registered.GroupOrDie(federation.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: federation.GroupName, Version: registered.GroupOrDie(federation.GroupName).GroupVersion.Version}
Groups[federation.GroupName] = TestGroup{ Groups[federation.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: federation.SchemeGroupVersion, internalGroupVersion: federation.SchemeGroupVersion,
@ -225,7 +225,7 @@ func init() {
} }
} }
if _, ok := Groups[rbac.GroupName]; !ok { if _, ok := Groups[rbac.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: rbac.GroupName, Version: registered.GroupOrDie(rbac.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: rbac.GroupName, Version: registered.GroupOrDie(rbac.GroupName).GroupVersion.Version}
Groups[rbac.GroupName] = TestGroup{ Groups[rbac.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: rbac.SchemeGroupVersion, internalGroupVersion: rbac.SchemeGroupVersion,
@ -234,7 +234,7 @@ func init() {
} }
} }
if _, ok := Groups[storage.GroupName]; !ok { if _, ok := Groups[storage.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: storage.GroupName, Version: registered.GroupOrDie(storage.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: storage.GroupName, Version: registered.GroupOrDie(storage.GroupName).GroupVersion.Version}
Groups[storage.GroupName] = TestGroup{ Groups[storage.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: storage.SchemeGroupVersion, internalGroupVersion: storage.SchemeGroupVersion,
@ -243,7 +243,7 @@ func init() {
} }
} }
if _, ok := Groups[certificates.GroupName]; !ok { if _, ok := Groups[certificates.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: certificates.GroupName, Version: registered.GroupOrDie(certificates.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: certificates.GroupName, Version: registered.GroupOrDie(certificates.GroupName).GroupVersion.Version}
Groups[certificates.GroupName] = TestGroup{ Groups[certificates.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: certificates.SchemeGroupVersion, internalGroupVersion: certificates.SchemeGroupVersion,
@ -252,7 +252,7 @@ func init() {
} }
} }
if _, ok := Groups[imagepolicy.GroupName]; !ok { if _, ok := Groups[imagepolicy.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: imagepolicy.GroupName, Version: registered.GroupOrDie(imagepolicy.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: imagepolicy.GroupName, Version: registered.GroupOrDie(imagepolicy.GroupName).GroupVersion.Version}
Groups[imagepolicy.GroupName] = TestGroup{ Groups[imagepolicy.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: imagepolicy.SchemeGroupVersion, internalGroupVersion: imagepolicy.SchemeGroupVersion,
@ -261,7 +261,7 @@ func init() {
} }
} }
if _, ok := Groups[authorization.GroupName]; !ok { if _, ok := Groups[authorization.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: authorization.GroupName, Version: registered.GroupOrDie(authorization.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: authorization.GroupName, Version: registered.GroupOrDie(authorization.GroupName).GroupVersion.Version}
Groups[authorization.GroupName] = TestGroup{ Groups[authorization.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: authorization.SchemeGroupVersion, internalGroupVersion: authorization.SchemeGroupVersion,
@ -270,7 +270,7 @@ func init() {
} }
} }
if _, ok := Groups[kubeadm.GroupName]; !ok { if _, ok := Groups[kubeadm.GroupName]; !ok {
externalGroupVersion := unversioned.GroupVersion{Group: kubeadm.GroupName, Version: registered.GroupOrDie(kubeadm.GroupName).GroupVersion.Version} externalGroupVersion := schema.GroupVersion{Group: kubeadm.GroupName, Version: registered.GroupOrDie(kubeadm.GroupName).GroupVersion.Version}
Groups[kubeadm.GroupName] = TestGroup{ Groups[kubeadm.GroupName] = TestGroup{
externalGroupVersion: externalGroupVersion, externalGroupVersion: externalGroupVersion,
internalGroupVersion: kubeadm.SchemeGroupVersion, internalGroupVersion: kubeadm.SchemeGroupVersion,
@ -293,18 +293,18 @@ func init() {
Authorization = Groups[authorization.GroupName] Authorization = Groups[authorization.GroupName]
} }
func (g TestGroup) ContentConfig() (string, *unversioned.GroupVersion, runtime.Codec) { func (g TestGroup) ContentConfig() (string, *schema.GroupVersion, runtime.Codec) {
return "application/json", g.GroupVersion(), g.Codec() return "application/json", g.GroupVersion(), g.Codec()
} }
func (g TestGroup) GroupVersion() *unversioned.GroupVersion { func (g TestGroup) GroupVersion() *schema.GroupVersion {
copyOfGroupVersion := g.externalGroupVersion copyOfGroupVersion := g.externalGroupVersion
return &copyOfGroupVersion return &copyOfGroupVersion
} }
// InternalGroupVersion returns the group,version used to identify the internal // InternalGroupVersion returns the group,version used to identify the internal
// types for this API // types for this API
func (g TestGroup) InternalGroupVersion() unversioned.GroupVersion { func (g TestGroup) InternalGroupVersion() schema.GroupVersion {
return g.internalGroupVersion return g.internalGroupVersion
} }
@ -324,7 +324,7 @@ func (g TestGroup) Codec() runtime.Codec {
if serializer.Serializer == nil { if serializer.Serializer == nil {
return api.Codecs.LegacyCodec(g.externalGroupVersion) return api.Codecs.LegacyCodec(g.externalGroupVersion)
} }
return api.Codecs.CodecForVersions(serializer.Serializer, api.Codecs.UniversalDeserializer(), unversioned.GroupVersions{g.externalGroupVersion}, nil) return api.Codecs.CodecForVersions(serializer.Serializer, api.Codecs.UniversalDeserializer(), schema.GroupVersions{g.externalGroupVersion}, nil)
} }
// NegotiatedSerializer returns the negotiated serializer for the server. // NegotiatedSerializer returns the negotiated serializer for the server.
@ -352,7 +352,7 @@ func (g TestGroup) StorageCodec() runtime.Codec {
} }
ds := recognizer.NewDecoder(s, api.Codecs.UniversalDeserializer()) ds := recognizer.NewDecoder(s, api.Codecs.UniversalDeserializer())
return api.Codecs.CodecForVersions(s, ds, unversioned.GroupVersions{g.externalGroupVersion}, nil) return api.Codecs.CodecForVersions(s, ds, schema.GroupVersions{g.externalGroupVersion}, nil)
} }
// Converter returns the api.Scheme for the API version to test against, as set by the // Converter returns the api.Scheme for the API version to test against, as set by the
@ -436,8 +436,8 @@ func (g TestGroup) RESTMapper() meta.RESTMapper {
} }
// ExternalGroupVersions returns all external group versions allowed for the server. // ExternalGroupVersions returns all external group versions allowed for the server.
func ExternalGroupVersions() unversioned.GroupVersions { func ExternalGroupVersions() schema.GroupVersions {
versions := []unversioned.GroupVersion{} versions := []schema.GroupVersion{}
for _, g := range Groups { for _, g := range Groups {
gv := g.GroupVersion() gv := g.GroupVersion()
versions = append(versions, *gv) versions = append(versions, *gv)
@ -473,6 +473,6 @@ func GetCodecForObject(obj runtime.Object) (runtime.Codec, error) {
return nil, fmt.Errorf("unexpected kind: %v", kind) return nil, fmt.Errorf("unexpected kind: %v", kind)
} }
func NewTestGroup(external, internal unversioned.GroupVersion, internalTypes map[string]reflect.Type, externalTypes map[string]reflect.Type) TestGroup { func NewTestGroup(external, internal schema.GroupVersion, internalTypes map[string]reflect.Type, externalTypes map[string]reflect.Type) TestGroup {
return TestGroup{external, internal, internalTypes, externalTypes} return TestGroup{external, internal, internalTypes, externalTypes}
} }

View File

@ -4446,92 +4446,93 @@ var (
) )
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 1390 bytes of a gzipped FileDescriptorProto // 1400 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6f, 0x1b, 0x45, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xcc, 0x57, 0x4f, 0x6b, 0x1b, 0x47,
0x14, 0xf7, 0xda,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, 0x75, 0xf5, 0x95, 0xce, 0xc1, 0x5e, 0xbd, 0xca, 0x07, 0x5c, 0x53, 0x31, 0x50, 0x6c,
0x26, 0x8a, 0xf1, 0x0e, 0x94, 0xb0, 0x60, 0x08, 0x6f, 0xfa, 0x18, 0xac, 0x91, 0x1a, 0x92, 0x52, 0x62, 0xdd, 0x83, 0xea, 0xea, 0xfd, 0xc0, 0x27, 0xec, 0x66, 0xc0, 0x44, 0x31, 0xde, 0x83, 0x12,
0xe3, 0x0c, 0x14, 0xf1, 0x3d, 0xbb, 0xc3, 0x24, 0xea, 0xaa, 0x52, 0xad, 0xb8, 0xce, 0x99, 0x28, 0x16, 0x0c, 0xe1, 0x4d, 0x1f, 0x81, 0x35, 0x52, 0x43, 0x52, 0x6a, 0x9c, 0x81, 0x22, 0xbe, 0x6f,
0x92, 0x59, 0x77, 0xa1, 0x2c, 0x90, 0xc1, 0xc1, 0xc5, 0x2d, 0x04, 0x30, 0x24, 0x76, 0x62, 0x0b, 0x77, 0x98, 0x44, 0x5d, 0x55, 0xaa, 0x15, 0x57, 0x39, 0x13, 0x45, 0x32, 0xeb, 0x1e, 0x94, 0x05,
0xa1, 0x81, 0x22, 0x59, 0x8c, 0xce, 0xfc, 0x34, 0x74, 0x26, 0xca, 0xd0, 0x87, 0x6a, 0x64, 0xab, 0x32, 0x38, 0xb8, 0xb8, 0x85, 0x00, 0x86, 0xc4, 0x4e, 0x6c, 0x21, 0x34, 0x50, 0x24, 0x8b, 0xd1,
0x2e, 0x4c, 0xa6, 0x08, 0xe7, 0x40, 0x57, 0xa0, 0x91, 0x51, 0xe2, 0x59, 0xa9, 0x1c, 0xa1, 0x58, 0x99, 0x9f, 0x84, 0xce, 0x44, 0x19, 0xfa, 0x50, 0x8d, 0x6c, 0xd5, 0x85, 0xc9, 0x14, 0xe1, 0x1c,
0x23, 0x11, 0x6d, 0x0f, 0x52, 0x28, 0xcf, 0x16, 0xec, 0x2c, 0x9c, 0x90, 0xd0, 0x90, 0xb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xf8, 0x89, 0xdc, 0x66, 0x77,
0xe7, 0xa0, 0x73, 0x28, 0x89, 0x59, 0xa9, 0xba, 0xa3, 0x4d, 0xed, 0xce, 0x32, 0x80, 0x1d, 0xb8, 0xa1, 0xcc, 0xa3, 0x51, 0x66, 0x0f, 0x82, 0xd7, 0x1d, 0xd2, 0xfa, 0x02, 0x74, 0x0e, 0x25, 0x31,
0xe9, 0xd1, 0x18, 0x0f, 0xa4, 0xf1, 0x73, 0x1f, 0x25, 0xb4, 0xda, 0xe7, 0x9f, 0x3e, 0xaf, 0xe5, 0x2b, 0x55, 0x77, 0xb4, 0x89, 0xdd, 0x59, 0x04, 0xb0, 0x03, 0x37, 0x3d, 0x1a, 0xe3, 0x81, 0x34,
0x9e, 0x3d, 0xaf, 0xe5, 0x7e, 0x7d, 0x5e, 0xcb, 0xdd, 0x3f, 0xa8, 0x69, 0x4f, 0x0f, 0x6a, 0xda, 0x7a, 0xee, 0xa3, 0x84, 0x56, 0xfb, 0xfc, 0xb3, 0x17, 0xb5, 0xdc, 0xf3, 0x17, 0xb5, 0xdc, 0x6f,
0xb3, 0x83, 0x9a, 0xf6, 0xfb, 0x41, 0x4d, 0x7b, 0xf8, 0x47, 0x2d, 0x77, 0xbb, 0x92, 0x68, 0xe4, 0x2f, 0x6a, 0xb9, 0x07, 0xfb, 0x35, 0xed, 0xd9, 0x7e, 0x4d, 0x7b, 0xbe, 0x5f, 0xd3, 0xfe, 0xd8,
0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0a, 0x22, 0x00, 0xde, 0x9c, 0x10, 0x00, 0x00, 0xaf, 0x69, 0x8f, 0xfe, 0xac, 0xe5, 0xee, 0x54, 0x12, 0x8d, 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff,
0xac, 0x17, 0x87, 0x87, 0xd2, 0x10, 0x00, 0x00,
} }

View File

@ -22,6 +22,7 @@ syntax = 'proto2';
package k8s.io.kubernetes.pkg.api.unversioned; package k8s.io.kubernetes.pkg.api.unversioned;
import "k8s.io/kubernetes/pkg/runtime/generated.proto"; import "k8s.io/kubernetes/pkg/runtime/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/schema/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated". // Package-wide variables from generator "generated".

View File

@ -20,23 +20,10 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"strings" "strings"
"k8s.io/client-go/pkg/runtime/schema"
) )
// ParseResourceArg takes the common style of string which may be either `resource.group.com` or `resource.version.group.com`
// and parses it out into both possibilities. This code takes no responsibility for knowing which representation was intended
// but with a knowledge of all GroupVersions, calling code can take a very good guess. If there are only two segments, then
// `*GroupVersionResource` is nil.
// `resource.group.com` -> `group=com, version=group, resource=resource` and `group=group.com, resource=resource`
func ParseResourceArg(arg string) (*GroupVersionResource, GroupResource) {
var gvr *GroupVersionResource
if strings.Count(arg, ".") >= 2 {
s := strings.SplitN(arg, ".", 3)
gvr = &GroupVersionResource{Group: s[2], Version: s[1], Resource: s[0]}
}
return gvr, ParseGroupResource(arg)
}
// GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying // GroupResource specifies a Group and a Resource, but does not force a version. This is useful for identifying
// concepts during lookup stages without having partially valid types // concepts during lookup stages without having partially valid types
// //
@ -46,14 +33,6 @@ type GroupResource struct {
Resource string `protobuf:"bytes,2,opt,name=resource"` Resource string `protobuf:"bytes,2,opt,name=resource"`
} }
func (gr GroupResource) WithVersion(version string) GroupVersionResource {
return GroupVersionResource{Group: gr.Group, Version: version, Resource: gr.Resource}
}
func (gr GroupResource) Empty() bool {
return len(gr.Group) == 0 && len(gr.Resource) == 0
}
func (gr *GroupResource) String() string { func (gr *GroupResource) String() string {
if len(gr.Group) == 0 { if len(gr.Group) == 0 {
return gr.Resource return gr.Resource
@ -61,16 +40,6 @@ func (gr *GroupResource) String() string {
return gr.Resource + "." + gr.Group return gr.Resource + "." + gr.Group
} }
// ParseGroupResource turns "resource.group" string into a GroupResource struct. Empty strings are allowed
// for each field.
func ParseGroupResource(gr string) GroupResource {
if i := strings.Index(gr, "."); i == -1 {
return GroupResource{Resource: gr}
} else {
return GroupResource{Group: gr[i+1:], Resource: gr[:i]}
}
}
// GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion // GroupVersionResource unambiguously identifies a resource. It doesn't anonymously include GroupVersion
// to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling // to avoid automatic coersion. It doesn't use a GroupVersion to avoid custom marshalling
// //
@ -81,18 +50,6 @@ type GroupVersionResource struct {
Resource string `protobuf:"bytes,3,opt,name=resource"` Resource string `protobuf:"bytes,3,opt,name=resource"`
} }
func (gvr GroupVersionResource) Empty() bool {
return len(gvr.Group) == 0 && len(gvr.Version) == 0 && len(gvr.Resource) == 0
}
func (gvr GroupVersionResource) GroupResource() GroupResource {
return GroupResource{Group: gvr.Group, Resource: gvr.Resource}
}
func (gvr GroupVersionResource) GroupVersion() GroupVersion {
return GroupVersion{Group: gvr.Group, Version: gvr.Version}
}
func (gvr *GroupVersionResource) String() string { func (gvr *GroupVersionResource) String() string {
return strings.Join([]string{gvr.Group, "/", gvr.Version, ", Resource=", gvr.Resource}, "") return strings.Join([]string{gvr.Group, "/", gvr.Version, ", Resource=", gvr.Resource}, "")
} }
@ -106,14 +63,6 @@ type GroupKind struct {
Kind string `protobuf:"bytes,2,opt,name=kind"` Kind string `protobuf:"bytes,2,opt,name=kind"`
} }
func (gk GroupKind) Empty() bool {
return len(gk.Group) == 0 && len(gk.Kind) == 0
}
func (gk GroupKind) WithVersion(version string) GroupVersionKind {
return GroupVersionKind{Group: gk.Group, Version: version, Kind: gk.Kind}
}
func (gk *GroupKind) String() string { func (gk *GroupKind) String() string {
if len(gk.Group) == 0 { if len(gk.Group) == 0 {
return gk.Kind return gk.Kind
@ -131,19 +80,6 @@ type GroupVersionKind struct {
Kind string `protobuf:"bytes,3,opt,name=kind"` Kind string `protobuf:"bytes,3,opt,name=kind"`
} }
// Empty returns true if group, version, and kind are empty
func (gvk GroupVersionKind) Empty() bool {
return len(gvk.Group) == 0 && len(gvk.Version) == 0 && len(gvk.Kind) == 0
}
func (gvk GroupVersionKind) GroupKind() GroupKind {
return GroupKind{Group: gvk.Group, Kind: gvk.Kind}
}
func (gvk GroupVersionKind) GroupVersion() GroupVersion {
return GroupVersion{Group: gvk.Group, Version: gvk.Version}
}
func (gvk GroupVersionKind) String() string { func (gvk GroupVersionKind) String() string {
return gvk.Group + "/" + gvk.Version + ", Kind=" + gvk.Kind return gvk.Group + "/" + gvk.Version + ", Kind=" + gvk.Kind
} }
@ -179,55 +115,6 @@ func (gv GroupVersion) String() string {
return gv.Version return gv.Version
} }
// KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false
// if none of the options match the group. It prefers a match to group and version over just group.
// TODO: Move GroupVersion to a package under pkg/runtime, since it's used by scheme.
// TODO: Introduce an adapter type between GroupVersion and runtime.GroupVersioner, and use LegacyCodec(GroupVersion)
// in fewer places.
func (gv GroupVersion) KindForGroupVersionKinds(kinds []GroupVersionKind) (target GroupVersionKind, ok bool) {
for _, gvk := range kinds {
if gvk.Group == gv.Group && gvk.Version == gv.Version {
return gvk, true
}
}
for _, gvk := range kinds {
if gvk.Group == gv.Group {
return gv.WithKind(gvk.Kind), true
}
}
return GroupVersionKind{}, false
}
// ParseGroupVersion turns "group/version" string into a GroupVersion struct. It reports error
// if it cannot parse the string.
func ParseGroupVersion(gv string) (GroupVersion, error) {
// this can be the internal version for the legacy kube types
// TODO once we've cleared the last uses as strings, this special case should be removed.
if (len(gv) == 0) || (gv == "/") {
return GroupVersion{}, nil
}
switch strings.Count(gv, "/") {
case 0:
return GroupVersion{"", gv}, nil
case 1:
i := strings.Index(gv, "/")
return GroupVersion{gv[:i], gv[i+1:]}, nil
default:
return GroupVersion{}, fmt.Errorf("unexpected GroupVersion string: %v", gv)
}
}
// WithKind creates a GroupVersionKind based on the method receiver's GroupVersion and the passed Kind.
func (gv GroupVersion) WithKind(kind string) GroupVersionKind {
return GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: kind}
}
// WithResource creates a GroupVersionResource based on the method receiver's GroupVersion and the passed Resource.
func (gv GroupVersion) WithResource(resource string) GroupVersionResource {
return GroupVersionResource{Group: gv.Group, Version: gv.Version, Resource: resource}
}
// MarshalJSON implements the json.Marshaller interface. // MarshalJSON implements the json.Marshaller interface.
func (gv GroupVersion) MarshalJSON() ([]byte, error) { func (gv GroupVersion) MarshalJSON() ([]byte, error) {
s := gv.String() s := gv.String()
@ -242,11 +129,11 @@ func (gv *GroupVersion) unmarshal(value []byte) error {
if err := json.Unmarshal(value, &s); err != nil { if err := json.Unmarshal(value, &s); err != nil {
return err return err
} }
parsed, err := ParseGroupVersion(s) parsed, err := schema.ParseGroupVersion(s)
if err != nil { if err != nil {
return err return err
} }
*gv = parsed gv.Group, gv.Version = parsed.Group, parsed.Version
return nil return nil
} }
@ -259,87 +146,3 @@ func (gv *GroupVersion) UnmarshalJSON(value []byte) error {
func (gv *GroupVersion) UnmarshalText(value []byte) error { func (gv *GroupVersion) UnmarshalText(value []byte) error {
return gv.unmarshal(value) return gv.unmarshal(value)
} }
// GroupVersions can be used to represent a set of desired group versions.
// TODO: Move GroupVersions to a package under pkg/runtime, since it's used by scheme.
// TODO: Introduce an adapter type between GroupVersions and runtime.GroupVersioner, and use LegacyCodec(GroupVersion)
// in fewer places.
type GroupVersions []GroupVersion
// KindForGroupVersionKinds identifies the preferred GroupVersionKind out of a list. It returns ok false
// if none of the options match the group.
func (gvs GroupVersions) KindForGroupVersionKinds(kinds []GroupVersionKind) (GroupVersionKind, bool) {
var targets []GroupVersionKind
for _, gv := range gvs {
target, ok := gv.KindForGroupVersionKinds(kinds)
if !ok {
continue
}
targets = append(targets, target)
}
if len(targets) == 1 {
return targets[0], true
}
if len(targets) > 1 {
return bestMatch(kinds, targets), true
}
return GroupVersionKind{}, false
}
// bestMatch tries to pick best matching GroupVersionKind and falls back to the first
// found if no exact match exists.
func bestMatch(kinds []GroupVersionKind, targets []GroupVersionKind) GroupVersionKind {
for _, gvk := range targets {
for _, k := range kinds {
if k == gvk {
return k
}
}
}
return targets[0]
}
// ToAPIVersionAndKind is a convenience method for satisfying runtime.Object on types that
// do not use TypeMeta.
func (gvk *GroupVersionKind) ToAPIVersionAndKind() (string, string) {
if gvk == nil {
return "", ""
}
return gvk.GroupVersion().String(), gvk.Kind
}
// FromAPIVersionAndKind returns a GVK representing the provided fields for types that
// do not use TypeMeta. This method exists to support test types and legacy serializations
// that have a distinct group and kind.
// TODO: further reduce usage of this method.
func FromAPIVersionAndKind(apiVersion, kind string) GroupVersionKind {
if gv, err := ParseGroupVersion(apiVersion); err == nil {
return GroupVersionKind{Group: gv.Group, Version: gv.Version, Kind: kind}
}
return GroupVersionKind{Kind: kind}
}
// All objects that are serialized from a Scheme encode their type information. This interface is used
// by serialization to set type information from the Scheme onto the serialized version of an object.
// For objects that cannot be serialized or have unique requirements, this interface may be a no-op.
// TODO: this belongs in pkg/runtime, move unversioned.GVK into runtime.
type ObjectKind interface {
// SetGroupVersionKind sets or clears the intended serialized kind of an object. Passing kind nil
// should clear the current setting.
SetGroupVersionKind(kind GroupVersionKind)
// GroupVersionKind returns the stored group, version, and kind of an object, or nil if the object does
// not expose or provide these fields.
GroupVersionKind() GroupVersionKind
}
// EmptyObjectKind implements the ObjectKind interface as a noop
// TODO: this belongs in pkg/runtime, move unversioned.GVK into runtime.
var EmptyObjectKind = emptyObjectKind{}
type emptyObjectKind struct{}
// SetGroupVersionKind implements the ObjectKind interface
func (emptyObjectKind) SetGroupVersionKind(gvk GroupVersionKind) {}
// GroupVersionKind implements the ObjectKind interface
func (emptyObjectKind) GroupVersionKind() GroupVersionKind { return GroupVersionKind{} }

View File

@ -16,6 +16,10 @@ limitations under the License.
package unversioned package unversioned
import (
"k8s.io/client-go/pkg/runtime/schema"
)
// ListMetaAccessor retrieves the list interface from an object // ListMetaAccessor retrieves the list interface from an object
// TODO: move this, and TypeMeta and ListMeta, to a different package // TODO: move this, and TypeMeta and ListMeta, to a different package
type ListMetaAccessor interface { type ListMetaAccessor interface {
@ -47,16 +51,16 @@ func (meta *ListMeta) SetResourceVersion(version string) { meta.ResourceVersion
func (meta *ListMeta) GetSelfLink() string { return meta.SelfLink } func (meta *ListMeta) GetSelfLink() string { return meta.SelfLink }
func (meta *ListMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink } func (meta *ListMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
func (obj *TypeMeta) GetObjectKind() ObjectKind { return obj } func (obj *TypeMeta) GetObjectKind() schema.ObjectKind { return obj }
// SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta // SetGroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta
func (obj *TypeMeta) SetGroupVersionKind(gvk GroupVersionKind) { func (obj *TypeMeta) SetGroupVersionKind(gvk schema.GroupVersionKind) {
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
} }
// GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta // GroupVersionKind satisfies the ObjectKind interface for all objects that embed TypeMeta
func (obj *TypeMeta) GroupVersionKind() GroupVersionKind { func (obj *TypeMeta) GroupVersionKind() schema.GroupVersionKind {
return FromAPIVersionAndKind(obj.APIVersion, obj.Kind) return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
} }
func (obj *ListMeta) GetListMeta() List { return obj } func (obj *ListMeta) GetListMeta() List { return obj }

View File

@ -16,10 +16,14 @@ limitations under the License.
package unversioned package unversioned
import (
"k8s.io/client-go/pkg/runtime/schema"
)
// SchemeGroupVersion is group version used to register these objects // SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = GroupVersion{Group: "", Version: ""} var SchemeGroupVersion = schema.GroupVersion{Group: "", Version: ""}
// Kind takes an unqualified kind and returns a Group qualified GroupKind // Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) GroupKind { func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind() return SchemeGroupVersion.WithKind(kind).GroupKind()
} }

64
pkg/api/v1/generate.go Normal file
View File

@ -0,0 +1,64 @@
/*
Copyright 2014 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 v1
import (
"fmt"
utilrand "k8s.io/client-go/pkg/util/rand"
)
// NameGenerator generates names for objects. Some backends may have more information
// available to guide selection of new names and this interface hides those details.
type NameGenerator interface {
// GenerateName generates a valid name from the base name, adding a random suffix to the
// the base. If base is valid, the returned name must also be valid. The generator is
// responsible for knowing the maximum valid name length.
GenerateName(base string) string
}
// GenerateName will resolve the object name of the provided ObjectMeta to a generated version if
// necessary. It expects that validation for ObjectMeta has already completed (that Base is a
// valid name) and that the NameGenerator generates a name that is also valid.
func GenerateName(u NameGenerator, meta *ObjectMeta) {
if len(meta.GenerateName) == 0 || len(meta.Name) != 0 {
return
}
meta.Name = u.GenerateName(meta.GenerateName)
}
// simpleNameGenerator generates random names.
type simpleNameGenerator struct{}
// SimpleNameGenerator is a generator that returns the name plus a random suffix of five alphanumerics
// when a name is requested. The string is guaranteed to not exceed the length of a standard Kubernetes
// name (63 characters)
var SimpleNameGenerator NameGenerator = simpleNameGenerator{}
const (
// TODO: make this flexible for non-core resources with alternate naming rules.
maxNameLength = 63
randomLength = 5
maxGeneratedNameLength = maxNameLength - randomLength
)
func (simpleNameGenerator) GenerateName(base string) string {
if len(base) > maxGeneratedNameLength {
base = base[:maxGeneratedNameLength]
}
return fmt.Sprintf("%s%s", base, utilrand.String(randomLength))
}

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,7 @@ package k8s.io.kubernetes.pkg.api.v1;
import "k8s.io/kubernetes/pkg/api/resource/generated.proto"; import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto"; import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/generated.proto"; import "k8s.io/kubernetes/pkg/runtime/generated.proto";
import "k8s.io/kubernetes/pkg/runtime/schema/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated". // Package-wide variables from generator "generated".
@ -1465,6 +1466,13 @@ message NodeProxyOptions {
optional string path = 1; optional string path = 1;
} }
// NodeResources is an object for conveying resource information about a node.
// see http://releases.k8s.io/HEAD/docs/design/resources.md for more details.
message NodeResources {
// Capacity represents the available resources of a node
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> capacity = 1;
}
// A node selector represents the union of the results of one or more label queries // A node selector represents the union of the results of one or more label queries
// over a set of nodes; that is, it represents the OR of the selectors represented // over a set of nodes; that is, it represents the OR of the selectors represented
// by the node selector terms. // by the node selector terms.
@ -1514,7 +1522,7 @@ message NodeSpec {
optional string providerID = 3; optional string providerID = 3;
// Unschedulable controls node schedulability of new pods. By default, node is schedulable. // Unschedulable controls node schedulability of new pods. By default, node is schedulable.
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration"` // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration"
// +optional // +optional
optional bool unschedulable = 4; optional bool unschedulable = 4;
} }
@ -3360,6 +3368,12 @@ message ServiceStatus {
optional LoadBalancerStatus loadBalancer = 1; optional LoadBalancerStatus loadBalancer = 1;
} }
message Sysctl {
optional string name = 1;
optional string value = 2;
}
// TCPSocketAction describes an action based on opening a socket // TCPSocketAction describes an action based on opening a socket
message TCPSocketAction { message TCPSocketAction {
// Number or name of the port to access on the container. // Number or name of the port to access on the container.

View File

@ -1,5 +1,5 @@
/* /*
Copyright 2016 The Kubernetes Authors. Copyright 2014 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -16,18 +16,441 @@ limitations under the License.
package v1 package v1
import "k8s.io/client-go/pkg/types" import (
"encoding/json"
"fmt"
"strings"
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/fields"
"k8s.io/client-go/pkg/labels"
"k8s.io/client-go/pkg/selection"
"k8s.io/client-go/pkg/types"
"k8s.io/client-go/pkg/util/sets"
)
// IsOpaqueIntResourceName returns true if the resource name has the opaque
// integer resource prefix.
func IsOpaqueIntResourceName(name ResourceName) bool {
return strings.HasPrefix(string(name), ResourceOpaqueIntPrefix)
}
// OpaqueIntResourceName returns a ResourceName with the canonical opaque
// integer prefix prepended. If the argument already has the prefix, it is
// returned unmodified.
func OpaqueIntResourceName(name string) ResourceName {
if IsOpaqueIntResourceName(ResourceName(name)) {
return ResourceName(name)
}
return ResourceName(fmt.Sprintf("%s%s", api.ResourceOpaqueIntPrefix, name))
}
// NewDeleteOptions returns a DeleteOptions indicating the resource should // NewDeleteOptions returns a DeleteOptions indicating the resource should
// be deleted within the specified grace period. Use zero to indicate // be deleted within the specified grace period. Use zero to indicate
// immediate deletion. If you would prefer to use the default grace period, // immediate deletion. If you would prefer to use the default grace period,
// use &v1.DeleteOptions{} directly. // use &api.DeleteOptions{} directly.
func NewDeleteOptions(grace int64) *DeleteOptions { func NewDeleteOptions(grace int64) *DeleteOptions {
return &DeleteOptions{GracePeriodSeconds: &grace} return &DeleteOptions{GracePeriodSeconds: &grace}
} }
// NewPreconditionDeleteOptions returns a DeleteOptions with a UID precondition set.
func NewPreconditionDeleteOptions(uid string) *DeleteOptions {
u := types.UID(uid)
p := Preconditions{UID: &u}
return &DeleteOptions{Preconditions: &p}
}
// NewUIDPreconditions returns a Preconditions with UID set. // NewUIDPreconditions returns a Preconditions with UID set.
func NewUIDPreconditions(uid string) *Preconditions { func NewUIDPreconditions(uid string) *Preconditions {
u := types.UID(uid) u := types.UID(uid)
return &Preconditions{UID: &u} return &Preconditions{UID: &u}
} }
// this function aims to check if the service's ClusterIP is set or not
// the objective is not to perform validation here
func IsServiceIPSet(service *Service) bool {
return service.Spec.ClusterIP != ClusterIPNone && service.Spec.ClusterIP != ""
}
// this function aims to check if the service's cluster IP is requested or not
func IsServiceIPRequested(service *Service) bool {
// ExternalName services are CNAME aliases to external ones. Ignore the IP.
if service.Spec.Type == ServiceTypeExternalName {
return false
}
return service.Spec.ClusterIP == ""
}
var standardFinalizers = sets.NewString(
string(FinalizerKubernetes),
FinalizerOrphan,
)
// HasAnnotation returns a bool if passed in annotation exists
func HasAnnotation(obj ObjectMeta, ann string) bool {
_, found := obj.Annotations[ann]
return found
}
// SetMetaDataAnnotation sets the annotation and value
func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) {
if obj.Annotations == nil {
obj.Annotations = make(map[string]string)
}
obj.Annotations[ann] = value
}
func IsStandardFinalizerName(str string) bool {
return standardFinalizers.Has(str)
}
// SingleObject returns a ListOptions for watching a single object.
func SingleObject(meta ObjectMeta) ListOptions {
return ListOptions{
FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name).String(),
ResourceVersion: meta.ResourceVersion,
}
}
// AddToNodeAddresses appends the NodeAddresses to the passed-by-pointer slice,
// only if they do not already exist
func AddToNodeAddresses(addresses *[]NodeAddress, addAddresses ...NodeAddress) {
for _, add := range addAddresses {
exists := false
for _, existing := range *addresses {
if existing.Address == add.Address && existing.Type == add.Type {
exists = true
break
}
}
if !exists {
*addresses = append(*addresses, add)
}
}
}
// TODO: make method on LoadBalancerStatus?
func LoadBalancerStatusEqual(l, r *LoadBalancerStatus) bool {
return ingressSliceEqual(l.Ingress, r.Ingress)
}
func ingressSliceEqual(lhs, rhs []LoadBalancerIngress) bool {
if len(lhs) != len(rhs) {
return false
}
for i := range lhs {
if !ingressEqual(&lhs[i], &rhs[i]) {
return false
}
}
return true
}
func ingressEqual(lhs, rhs *LoadBalancerIngress) bool {
if lhs.IP != rhs.IP {
return false
}
if lhs.Hostname != rhs.Hostname {
return false
}
return true
}
// TODO: make method on LoadBalancerStatus?
func LoadBalancerStatusDeepCopy(lb *LoadBalancerStatus) *LoadBalancerStatus {
c := &LoadBalancerStatus{}
c.Ingress = make([]LoadBalancerIngress, len(lb.Ingress))
for i := range lb.Ingress {
c.Ingress[i] = lb.Ingress[i]
}
return c
}
// GetAccessModesAsString returns a string representation of an array of access modes.
// modes, when present, are always in the same order: RWO,ROX,RWX.
func GetAccessModesAsString(modes []PersistentVolumeAccessMode) string {
modes = removeDuplicateAccessModes(modes)
modesStr := []string{}
if containsAccessMode(modes, ReadWriteOnce) {
modesStr = append(modesStr, "RWO")
}
if containsAccessMode(modes, ReadOnlyMany) {
modesStr = append(modesStr, "ROX")
}
if containsAccessMode(modes, ReadWriteMany) {
modesStr = append(modesStr, "RWX")
}
return strings.Join(modesStr, ",")
}
// GetAccessModesAsString returns an array of AccessModes from a string created by GetAccessModesAsString
func GetAccessModesFromString(modes string) []PersistentVolumeAccessMode {
strmodes := strings.Split(modes, ",")
accessModes := []PersistentVolumeAccessMode{}
for _, s := range strmodes {
s = strings.Trim(s, " ")
switch {
case s == "RWO":
accessModes = append(accessModes, ReadWriteOnce)
case s == "ROX":
accessModes = append(accessModes, ReadOnlyMany)
case s == "RWX":
accessModes = append(accessModes, ReadWriteMany)
}
}
return accessModes
}
// removeDuplicateAccessModes returns an array of access modes without any duplicates
func removeDuplicateAccessModes(modes []PersistentVolumeAccessMode) []PersistentVolumeAccessMode {
accessModes := []PersistentVolumeAccessMode{}
for _, m := range modes {
if !containsAccessMode(accessModes, m) {
accessModes = append(accessModes, m)
}
}
return accessModes
}
func containsAccessMode(modes []PersistentVolumeAccessMode, mode PersistentVolumeAccessMode) bool {
for _, m := range modes {
if m == mode {
return true
}
}
return false
}
// NodeSelectorRequirementsAsSelector converts the []NodeSelectorRequirement api type into a struct that implements
// labels.Selector.
func NodeSelectorRequirementsAsSelector(nsm []NodeSelectorRequirement) (labels.Selector, error) {
if len(nsm) == 0 {
return labels.Nothing(), nil
}
selector := labels.NewSelector()
for _, expr := range nsm {
var op selection.Operator
switch expr.Operator {
case NodeSelectorOpIn:
op = selection.In
case NodeSelectorOpNotIn:
op = selection.NotIn
case NodeSelectorOpExists:
op = selection.Exists
case NodeSelectorOpDoesNotExist:
op = selection.DoesNotExist
case NodeSelectorOpGt:
op = selection.GreaterThan
case NodeSelectorOpLt:
op = selection.LessThan
default:
return nil, fmt.Errorf("%q is not a valid node selector operator", expr.Operator)
}
r, err := labels.NewRequirement(expr.Key, op, expr.Values)
if err != nil {
return nil, err
}
selector = selector.Add(*r)
}
return selector, nil
}
const (
// AffinityAnnotationKey represents the key of affinity data (json serialized)
// in the Annotations of a Pod.
AffinityAnnotationKey string = "scheduler.alpha.kubernetes.io/affinity"
// TolerationsAnnotationKey represents the key of tolerations data (json serialized)
// in the Annotations of a Pod.
TolerationsAnnotationKey string = "scheduler.alpha.kubernetes.io/tolerations"
// TaintsAnnotationKey represents the key of taints data (json serialized)
// in the Annotations of a Node.
TaintsAnnotationKey string = "scheduler.alpha.kubernetes.io/taints"
// SeccompPodAnnotationKey represents the key of a seccomp profile applied
// to all containers of a pod.
SeccompPodAnnotationKey string = "seccomp.security.alpha.kubernetes.io/pod"
// SeccompContainerAnnotationKeyPrefix represents the key of a seccomp profile applied
// to one container of a pod.
SeccompContainerAnnotationKeyPrefix string = "container.seccomp.security.alpha.kubernetes.io/"
// CreatedByAnnotation represents the key used to store the spec(json)
// used to create the resource.
CreatedByAnnotation = "kubernetes.io/created-by"
// PreferAvoidPodsAnnotationKey represents the key of preferAvoidPods data (json serialized)
// in the Annotations of a Node.
PreferAvoidPodsAnnotationKey string = "scheduler.alpha.kubernetes.io/preferAvoidPods"
// SysctlsPodAnnotationKey represents the key of sysctls which are set for the infrastructure
// container of a pod. The annotation value is a comma separated list of sysctl_name=value
// key-value pairs. Only a limited set of whitelisted and isolated sysctls is supported by
// the kubelet. Pods with other sysctls will fail to launch.
SysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/sysctls"
// UnsafeSysctlsPodAnnotationKey represents the key of sysctls which are set for the infrastructure
// container of a pod. The annotation value is a comma separated list of sysctl_name=value
// key-value pairs. Unsafe sysctls must be explicitly enabled for a kubelet. They are properly
// namespaced to a pod or a container, but their isolation is usually unclear or weak. Their use
// is at-your-own-risk. Pods that attempt to set an unsafe sysctl that is not enabled for a kubelet
// will fail to launch.
UnsafeSysctlsPodAnnotationKey string = "security.alpha.kubernetes.io/unsafe-sysctls"
)
// GetAffinityFromPod gets the json serialized affinity data from Pod.Annotations
// and converts it to the Affinity type in api.
func GetAffinityFromPodAnnotations(annotations map[string]string) (*Affinity, error) {
if len(annotations) > 0 && annotations[AffinityAnnotationKey] != "" {
var affinity Affinity
err := json.Unmarshal([]byte(annotations[AffinityAnnotationKey]), &affinity)
if err != nil {
return nil, err
}
return &affinity, nil
}
return nil, nil
}
// GetTolerationsFromPodAnnotations gets the json serialized tolerations data from Pod.Annotations
// and converts it to the []Toleration type in api.
func GetTolerationsFromPodAnnotations(annotations map[string]string) ([]Toleration, error) {
var tolerations []Toleration
if len(annotations) > 0 && annotations[TolerationsAnnotationKey] != "" {
err := json.Unmarshal([]byte(annotations[TolerationsAnnotationKey]), &tolerations)
if err != nil {
return tolerations, err
}
}
return tolerations, nil
}
// GetTaintsFromNodeAnnotations gets the json serialized taints data from Pod.Annotations
// and converts it to the []Taint type in api.
func GetTaintsFromNodeAnnotations(annotations map[string]string) ([]Taint, error) {
var taints []Taint
if len(annotations) > 0 && annotations[TaintsAnnotationKey] != "" {
err := json.Unmarshal([]byte(annotations[TaintsAnnotationKey]), &taints)
if err != nil {
return []Taint{}, err
}
}
return taints, nil
}
// TolerationToleratesTaint checks if the toleration tolerates the taint.
func TolerationToleratesTaint(toleration *Toleration, taint *Taint) bool {
if len(toleration.Effect) != 0 && toleration.Effect != taint.Effect {
return false
}
if toleration.Key != taint.Key {
return false
}
// TODO: Use proper defaulting when Toleration becomes a field of PodSpec
if (len(toleration.Operator) == 0 || toleration.Operator == TolerationOpEqual) && toleration.Value == taint.Value {
return true
}
if toleration.Operator == TolerationOpExists {
return true
}
return false
}
// TaintToleratedByTolerations checks if taint is tolerated by any of the tolerations.
func TaintToleratedByTolerations(taint *Taint, tolerations []Toleration) bool {
tolerated := false
for i := range tolerations {
if TolerationToleratesTaint(&tolerations[i], taint) {
tolerated = true
break
}
}
return tolerated
}
// MatchTaint checks if the taint matches taintToMatch. Taints are unique by key:effect,
// if the two taints have same key:effect, regard as they match.
func (t *Taint) MatchTaint(taintToMatch Taint) bool {
return t.Key == taintToMatch.Key && t.Effect == taintToMatch.Effect
}
// taint.ToString() converts taint struct to string in format key=value:effect or key:effect.
func (t *Taint) ToString() string {
if len(t.Value) == 0 {
return fmt.Sprintf("%v:%v", t.Key, t.Effect)
}
return fmt.Sprintf("%v=%v:%v", t.Key, t.Value, t.Effect)
}
func GetAvoidPodsFromNodeAnnotations(annotations map[string]string) (AvoidPods, error) {
var avoidPods AvoidPods
if len(annotations) > 0 && annotations[PreferAvoidPodsAnnotationKey] != "" {
err := json.Unmarshal([]byte(annotations[PreferAvoidPodsAnnotationKey]), &avoidPods)
if err != nil {
return avoidPods, err
}
}
return avoidPods, nil
}
// SysctlsFromPodAnnotations parses the sysctl annotations into a slice of safe Sysctls
// and a slice of unsafe Sysctls. This is only a convenience wrapper around
// SysctlsFromPodAnnotation.
func SysctlsFromPodAnnotations(a map[string]string) ([]Sysctl, []Sysctl, error) {
safe, err := SysctlsFromPodAnnotation(a[SysctlsPodAnnotationKey])
if err != nil {
return nil, nil, err
}
unsafe, err := SysctlsFromPodAnnotation(a[UnsafeSysctlsPodAnnotationKey])
if err != nil {
return nil, nil, err
}
return safe, unsafe, nil
}
// SysctlsFromPodAnnotation parses an annotation value into a slice of Sysctls.
func SysctlsFromPodAnnotation(annotation string) ([]Sysctl, error) {
if len(annotation) == 0 {
return nil, nil
}
kvs := strings.Split(annotation, ",")
sysctls := make([]Sysctl, len(kvs))
for i, kv := range kvs {
cs := strings.Split(kv, "=")
if len(cs) != 2 || len(cs[0]) == 0 {
return nil, fmt.Errorf("sysctl %q not of the format sysctl_name=value", kv)
}
sysctls[i].Name = cs[0]
sysctls[i].Value = cs[1]
}
return sysctls, nil
}
// PodAnnotationsFromSysctls creates an annotation value for a slice of Sysctls.
func PodAnnotationsFromSysctls(sysctls []Sysctl) string {
if len(sysctls) == 0 {
return ""
}
kvs := make([]string, len(sysctls))
for i := range sysctls {
kvs[i] = fmt.Sprintf("%s=%s", sysctls[i].Name, sysctls[i].Value)
}
return strings.Join(kvs, ",")
}
type Sysctl struct {
Name string `protobuf:"bytes,1,opt,name=name"`
Value string `protobuf:"bytes,2,opt,name=value"`
}
// NodeResources is an object for conveying resource information about a node.
// see http://releases.k8s.io/HEAD/docs/design/resources.md for more details.
type NodeResources struct {
// Capacity represents the available resources of a node
Capacity ResourceList `protobuf:"bytes,1,rep,name=capacity,casttype=ResourceList,castkey=ResourceName"`
}

View File

@ -24,8 +24,8 @@ import (
"strings" "strings"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
var ( var (
@ -123,11 +123,11 @@ func GetPartialReference(obj runtime.Object, fieldPath string) (*ObjectReference
// IsAnAPIObject allows clients to preemptively get a reference to an API object and pass it to places that // IsAnAPIObject allows clients to preemptively get a reference to an API object and pass it to places that
// intend only to get a reference to that object. This simplifies the event recording interface. // intend only to get a reference to that object. This simplifies the event recording interface.
func (obj *ObjectReference) SetGroupVersionKind(gvk unversioned.GroupVersionKind) { func (obj *ObjectReference) SetGroupVersionKind(gvk schema.GroupVersionKind) {
obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind() obj.APIVersion, obj.Kind = gvk.ToAPIVersionAndKind()
} }
func (obj *ObjectReference) GroupVersionKind() unversioned.GroupVersionKind { func (obj *ObjectReference) GroupVersionKind() schema.GroupVersionKind {
return unversioned.FromAPIVersionAndKind(obj.APIVersion, obj.Kind) return schema.FromAPIVersionAndKind(obj.APIVersion, obj.Kind)
} }
func (obj *ObjectReference) GetObjectKind() unversioned.ObjectKind { return obj } func (obj *ObjectReference) GetObjectKind() schema.ObjectKind { return obj }

View File

@ -19,6 +19,7 @@ package v1
import ( import (
"k8s.io/client-go/pkg/api/unversioned" "k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
versionedwatch "k8s.io/client-go/pkg/watch/versioned" versionedwatch "k8s.io/client-go/pkg/watch/versioned"
) )
@ -26,7 +27,7 @@ import (
const GroupName = "" const GroupName = ""
// SchemeGroupVersion is group version used to register these objects // SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: "v1"} var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}
var ( var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs, addConversionFuncs, addFastPathConversionFuncs) SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes, addDefaultingFuncs, addConversionFuncs, addFastPathConversionFuncs)

View File

@ -0,0 +1,229 @@
/*
Copyright 2014 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 v1
import (
"time"
"k8s.io/client-go/pkg/api/resource"
"k8s.io/client-go/pkg/api/unversioned"
)
// Returns string version of ResourceName.
func (self ResourceName) String() string {
return string(self)
}
// Returns the CPU limit if specified.
func (self *ResourceList) Cpu() *resource.Quantity {
if val, ok := (*self)[ResourceCPU]; ok {
return &val
}
return &resource.Quantity{Format: resource.DecimalSI}
}
// Returns the Memory limit if specified.
func (self *ResourceList) Memory() *resource.Quantity {
if val, ok := (*self)[ResourceMemory]; ok {
return &val
}
return &resource.Quantity{Format: resource.BinarySI}
}
func (self *ResourceList) Pods() *resource.Quantity {
if val, ok := (*self)[ResourcePods]; ok {
return &val
}
return &resource.Quantity{}
}
func (self *ResourceList) NvidiaGPU() *resource.Quantity {
if val, ok := (*self)[ResourceNvidiaGPU]; ok {
return &val
}
return &resource.Quantity{}
}
func GetContainerStatus(statuses []ContainerStatus, name string) (ContainerStatus, bool) {
for i := range statuses {
if statuses[i].Name == name {
return statuses[i], true
}
}
return ContainerStatus{}, false
}
func GetExistingContainerStatus(statuses []ContainerStatus, name string) ContainerStatus {
for i := range statuses {
if statuses[i].Name == name {
return statuses[i]
}
}
return ContainerStatus{}
}
// IsPodAvailable returns true if a pod is available; false otherwise.
// Precondition for an available pod is that it must be ready. On top
// of that, there are two cases when a pod can be considered available:
// 1. minReadySeconds == 0, or
// 2. LastTransitionTime (is set) + minReadySeconds < current time
func IsPodAvailable(pod *Pod, minReadySeconds int32, now unversioned.Time) bool {
if !IsPodReady(pod) {
return false
}
c := GetPodReadyCondition(pod.Status)
minReadySecondsDuration := time.Duration(minReadySeconds) * time.Second
if minReadySeconds == 0 || !c.LastTransitionTime.IsZero() && c.LastTransitionTime.Add(minReadySecondsDuration).Before(now.Time) {
return true
}
return false
}
// IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReady(pod *Pod) bool {
return IsPodReadyConditionTrue(pod.Status)
}
// IsPodReady retruns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue(status PodStatus) bool {
condition := GetPodReadyCondition(status)
return condition != nil && condition.Status == ConditionTrue
}
// Extracts the pod ready condition from the given status and returns that.
// Returns nil if the condition is not present.
func GetPodReadyCondition(status PodStatus) *PodCondition {
_, condition := GetPodCondition(&status, PodReady)
return condition
}
// GetPodCondition extracts the provided condition from the given status and returns that.
// Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodCondition(status *PodStatus, conditionType PodConditionType) (int, *PodCondition) {
if status == nil {
return -1, nil
}
for i := range status.Conditions {
if status.Conditions[i].Type == conditionType {
return i, &status.Conditions[i]
}
}
return -1, nil
}
// GetNodeCondition extracts the provided condition from the given status and returns that.
// Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetNodeCondition(status *NodeStatus, conditionType NodeConditionType) (int, *NodeCondition) {
if status == nil {
return -1, nil
}
for i := range status.Conditions {
if status.Conditions[i].Type == conditionType {
return i, &status.Conditions[i]
}
}
return -1, nil
}
// Updates existing pod condition or creates a new one. Sets LastTransitionTime to now if the
// status has changed.
// Returns true if pod condition has changed or has been added.
func UpdatePodCondition(status *PodStatus, condition *PodCondition) bool {
condition.LastTransitionTime = unversioned.Now()
// Try to find this pod condition.
conditionIndex, oldCondition := GetPodCondition(status, condition.Type)
if oldCondition == nil {
// We are adding new pod condition.
status.Conditions = append(status.Conditions, *condition)
return true
} else {
// We are updating an existing condition, so we need to check if it has changed.
if condition.Status == oldCondition.Status {
condition.LastTransitionTime = oldCondition.LastTransitionTime
}
isEqual := condition.Status == oldCondition.Status &&
condition.Reason == oldCondition.Reason &&
condition.Message == oldCondition.Message &&
condition.LastProbeTime.Equal(oldCondition.LastProbeTime) &&
condition.LastTransitionTime.Equal(oldCondition.LastTransitionTime)
status.Conditions[conditionIndex] = *condition
// Return true if one of the fields have changed.
return !isEqual
}
}
// IsNodeReady returns true if a node is ready; false otherwise.
func IsNodeReady(node *Node) bool {
for _, c := range node.Status.Conditions {
if c.Type == NodeReady {
return c.Status == ConditionTrue
}
}
return false
}
// PodRequestsAndLimits returns a dictionary of all defined resources summed up for all
// containers of the pod.
func PodRequestsAndLimits(pod *Pod) (reqs map[ResourceName]resource.Quantity, limits map[ResourceName]resource.Quantity, err error) {
reqs, limits = map[ResourceName]resource.Quantity{}, map[ResourceName]resource.Quantity{}
for _, container := range pod.Spec.Containers {
for name, quantity := range container.Resources.Requests {
if value, ok := reqs[name]; !ok {
reqs[name] = *quantity.Copy()
} else {
value.Add(quantity)
reqs[name] = value
}
}
for name, quantity := range container.Resources.Limits {
if value, ok := limits[name]; !ok {
limits[name] = *quantity.Copy()
} else {
value.Add(quantity)
limits[name] = value
}
}
}
// init containers define the minimum of any resource
for _, container := range pod.Spec.InitContainers {
for name, quantity := range container.Resources.Requests {
value, ok := reqs[name]
if !ok {
reqs[name] = *quantity.Copy()
continue
}
if quantity.Cmp(value) > 0 {
reqs[name] = *quantity.Copy()
}
}
for name, quantity := range container.Resources.Limits {
value, ok := limits[name]
if !ok {
limits[name] = *quantity.Copy()
continue
}
if quantity.Cmp(value) > 0 {
limits[name] = *quantity.Copy()
}
}
}
return
}

View File

@ -2818,7 +2818,7 @@ type NodeSpec struct {
// +optional // +optional
ProviderID string `json:"providerID,omitempty" protobuf:"bytes,3,opt,name=providerID"` ProviderID string `json:"providerID,omitempty" protobuf:"bytes,3,opt,name=providerID"`
// Unschedulable controls node schedulability of new pods. By default, node is schedulable. // Unschedulable controls node schedulability of new pods. By default, node is schedulable.
// More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration"` // More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration"
// +optional // +optional
Unschedulable bool `json:"unschedulable,omitempty" protobuf:"varint,4,opt,name=unschedulable"` Unschedulable bool `json:"unschedulable,omitempty" protobuf:"varint,4,opt,name=unschedulable"`
} }
@ -2995,6 +2995,8 @@ const (
NodeDiskPressure NodeConditionType = "DiskPressure" NodeDiskPressure NodeConditionType = "DiskPressure"
// NodeNetworkUnavailable means that network for the node is not correctly configured. // NodeNetworkUnavailable means that network for the node is not correctly configured.
NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable" NodeNetworkUnavailable NodeConditionType = "NetworkUnavailable"
// NodeInodePressure means the kublet is under pressure due to insufficient available inodes.
NodeInodePressure NodeConditionType = "InodePressure"
) )
// NodeCondition contains condition information for a node. // NodeCondition contains condition information for a node.
@ -3056,6 +3058,11 @@ const (
// Number of Pods that may be running on this Node: see ResourcePods // Number of Pods that may be running on this Node: see ResourcePods
) )
const (
// Namespace prefix for opaque counted resources (alpha).
ResourceOpaqueIntPrefix = "pod.alpha.kubernetes.io/opaque-int-resource-"
)
// ResourceList is a set of (resource name, quantity) pairs. // ResourceList is a set of (resource name, quantity) pairs.
type ResourceList map[ResourceName]resource.Quantity type ResourceList map[ResourceName]resource.Quantity
@ -3790,6 +3797,35 @@ const (
// DockerConfigKey is the key of the required data for SecretTypeDockercfg secrets // DockerConfigKey is the key of the required data for SecretTypeDockercfg secrets
DockerConfigKey = ".dockercfg" DockerConfigKey = ".dockercfg"
// SecretTypeDockerConfigJson contains a dockercfg file that follows the same format rules as ~/.docker/config.json
//
// Required fields:
// - Secret.Data[".dockerconfigjson"] - a serialized ~/.docker/config.json file
SecretTypeDockerConfigJson SecretType = "kubernetes.io/dockerconfigjson"
// DockerConfigJsonKey is the key of the required data for SecretTypeDockerConfigJson secrets
DockerConfigJsonKey = ".dockerconfigjson"
// SecretTypeBasicAuth contains data needed for basic authentication.
//
// Required at least one of fields:
// - Secret.Data["username"] - username used for authentication
// - Secret.Data["password"] - password or token needed for authentication
SecretTypeBasicAuth SecretType = "kubernetes.io/basic-auth"
// BasicAuthUsernameKey is the key of the username for SecretTypeBasicAuth secrets
BasicAuthUsernameKey = "username"
// BasicAuthPasswordKey is the key of the password or token for SecretTypeBasicAuth secrets
BasicAuthPasswordKey = "password"
// SecretTypeSSHAuth contains data needed for SSH authetication.
//
// Required field:
// - Secret.Data["ssh-privatekey"] - private SSH key needed for authentication
SecretTypeSSHAuth SecretType = "kubernetes.io/ssh-auth"
// SSHAuthPrivateKey is the key of the required SSH private key for SecretTypeSSHAuth secrets
SSHAuthPrivateKey = "ssh-privatekey"
// SecretTypeTLS contains information about a TLS client or server secret. It // SecretTypeTLS contains information about a TLS client or server secret. It
// is primarily used with TLS termination of the Ingress resource, but may be // is primarily used with TLS termination of the Ingress resource, but may be
// used in other types. // used in other types.
@ -4011,4 +4047,14 @@ type RangeAllocation struct {
const ( const (
// "default-scheduler" is the name of default scheduler. // "default-scheduler" is the name of default scheduler.
DefaultSchedulerName = "default-scheduler" DefaultSchedulerName = "default-scheduler"
// RequiredDuringScheduling affinity is not symmetric, but there is an implicit PreferredDuringScheduling affinity rule
// corresponding to every RequiredDuringScheduling affinity rule.
// When the --hard-pod-affinity-weight scheduler flag is not specified,
// DefaultHardPodAffinityWeight defines the weight of the implicit PreferredDuringScheduling affinity rule.
DefaultHardPodAffinitySymmetricWeight int = 1
// When the --failure-domains scheduler flag is not specified,
// DefaultFailureDomains defines the set of label keys used when TopologyKey is empty in PreferredDuringScheduling anti-affinity.
DefaultFailureDomains string = unversioned.LabelHostname + "," + unversioned.LabelZoneFailureDomain + "," + unversioned.LabelZoneRegion
) )

View File

@ -901,7 +901,7 @@ var map_NodeSpec = map[string]string{
"podCIDR": "PodCIDR represents the pod IP range assigned to the node.", "podCIDR": "PodCIDR represents the pod IP range assigned to the node.",
"externalID": "External ID of the node assigned by some machine database (e.g. a cloud provider). Deprecated.", "externalID": "External ID of the node assigned by some machine database (e.g. a cloud provider). Deprecated.",
"providerID": "ID of the node assigned by the cloud provider in the format: <ProviderName>://<ProviderSpecificNodeID>", "providerID": "ID of the node assigned by the cloud provider in the format: <ProviderName>://<ProviderSpecificNodeID>",
"unschedulable": "Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration\"`", "unschedulable": "Unschedulable controls node schedulability of new pods. By default, node is schedulable. More info: http://releases.k8s.io/HEAD/docs/admin/node.md#manual-node-administration\"",
} }
func (NodeSpec) SwaggerDoc() map[string]string { func (NodeSpec) SwaggerDoc() map[string]string {

View File

@ -189,6 +189,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_api_NodeList_To_v1_NodeList, Convert_api_NodeList_To_v1_NodeList,
Convert_v1_NodeProxyOptions_To_api_NodeProxyOptions, Convert_v1_NodeProxyOptions_To_api_NodeProxyOptions,
Convert_api_NodeProxyOptions_To_v1_NodeProxyOptions, Convert_api_NodeProxyOptions_To_v1_NodeProxyOptions,
Convert_v1_NodeResources_To_api_NodeResources,
Convert_api_NodeResources_To_v1_NodeResources,
Convert_v1_NodeSelector_To_api_NodeSelector, Convert_v1_NodeSelector_To_api_NodeSelector,
Convert_api_NodeSelector_To_v1_NodeSelector, Convert_api_NodeSelector_To_v1_NodeSelector,
Convert_v1_NodeSelectorRequirement_To_api_NodeSelectorRequirement, Convert_v1_NodeSelectorRequirement_To_api_NodeSelectorRequirement,
@ -333,6 +335,8 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_api_ServiceSpec_To_v1_ServiceSpec, Convert_api_ServiceSpec_To_v1_ServiceSpec,
Convert_v1_ServiceStatus_To_api_ServiceStatus, Convert_v1_ServiceStatus_To_api_ServiceStatus,
Convert_api_ServiceStatus_To_v1_ServiceStatus, Convert_api_ServiceStatus_To_v1_ServiceStatus,
Convert_v1_Sysctl_To_api_Sysctl,
Convert_api_Sysctl_To_v1_Sysctl,
Convert_v1_TCPSocketAction_To_api_TCPSocketAction, Convert_v1_TCPSocketAction_To_api_TCPSocketAction,
Convert_api_TCPSocketAction_To_v1_TCPSocketAction, Convert_api_TCPSocketAction_To_v1_TCPSocketAction,
Convert_v1_Taint_To_api_Taint, Convert_v1_Taint_To_api_Taint,
@ -2152,6 +2156,24 @@ func Convert_api_NodeProxyOptions_To_v1_NodeProxyOptions(in *api.NodeProxyOption
return autoConvert_api_NodeProxyOptions_To_v1_NodeProxyOptions(in, out, s) return autoConvert_api_NodeProxyOptions_To_v1_NodeProxyOptions(in, out, s)
} }
func autoConvert_v1_NodeResources_To_api_NodeResources(in *NodeResources, out *api.NodeResources, s conversion.Scope) error {
out.Capacity = *(*api.ResourceList)(unsafe.Pointer(&in.Capacity))
return nil
}
func Convert_v1_NodeResources_To_api_NodeResources(in *NodeResources, out *api.NodeResources, s conversion.Scope) error {
return autoConvert_v1_NodeResources_To_api_NodeResources(in, out, s)
}
func autoConvert_api_NodeResources_To_v1_NodeResources(in *api.NodeResources, out *NodeResources, s conversion.Scope) error {
out.Capacity = *(*ResourceList)(unsafe.Pointer(&in.Capacity))
return nil
}
func Convert_api_NodeResources_To_v1_NodeResources(in *api.NodeResources, out *NodeResources, s conversion.Scope) error {
return autoConvert_api_NodeResources_To_v1_NodeResources(in, out, s)
}
func autoConvert_v1_NodeSelector_To_api_NodeSelector(in *NodeSelector, out *api.NodeSelector, s conversion.Scope) error { func autoConvert_v1_NodeSelector_To_api_NodeSelector(in *NodeSelector, out *api.NodeSelector, s conversion.Scope) error {
out.NodeSelectorTerms = *(*[]api.NodeSelectorTerm)(unsafe.Pointer(&in.NodeSelectorTerms)) out.NodeSelectorTerms = *(*[]api.NodeSelectorTerm)(unsafe.Pointer(&in.NodeSelectorTerms))
return nil return nil
@ -4155,6 +4177,26 @@ func Convert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *S
return autoConvert_api_ServiceStatus_To_v1_ServiceStatus(in, out, s) return autoConvert_api_ServiceStatus_To_v1_ServiceStatus(in, out, s)
} }
func autoConvert_v1_Sysctl_To_api_Sysctl(in *Sysctl, out *api.Sysctl, s conversion.Scope) error {
out.Name = in.Name
out.Value = in.Value
return nil
}
func Convert_v1_Sysctl_To_api_Sysctl(in *Sysctl, out *api.Sysctl, s conversion.Scope) error {
return autoConvert_v1_Sysctl_To_api_Sysctl(in, out, s)
}
func autoConvert_api_Sysctl_To_v1_Sysctl(in *api.Sysctl, out *Sysctl, s conversion.Scope) error {
out.Name = in.Name
out.Value = in.Value
return nil
}
func Convert_api_Sysctl_To_v1_Sysctl(in *api.Sysctl, out *Sysctl, s conversion.Scope) error {
return autoConvert_api_Sysctl_To_v1_Sysctl(in, out, s)
}
func autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error { func autoConvert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out *api.TCPSocketAction, s conversion.Scope) error {
out.Port = in.Port out.Port = in.Port
return nil return nil

View File

@ -112,6 +112,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeDaemonEndpoints, InType: reflect.TypeOf(&NodeDaemonEndpoints{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeDaemonEndpoints, InType: reflect.TypeOf(&NodeDaemonEndpoints{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeList, InType: reflect.TypeOf(&NodeList{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeList, InType: reflect.TypeOf(&NodeList{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeProxyOptions, InType: reflect.TypeOf(&NodeProxyOptions{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeProxyOptions, InType: reflect.TypeOf(&NodeProxyOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeResources, InType: reflect.TypeOf(&NodeResources{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeSelector, InType: reflect.TypeOf(&NodeSelector{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeSelector, InType: reflect.TypeOf(&NodeSelector{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeSelectorRequirement, InType: reflect.TypeOf(&NodeSelectorRequirement{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeSelectorRequirement, InType: reflect.TypeOf(&NodeSelectorRequirement{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeSelectorTerm, InType: reflect.TypeOf(&NodeSelectorTerm{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_NodeSelectorTerm, InType: reflect.TypeOf(&NodeSelectorTerm{})},
@ -184,6 +185,7 @@ func RegisterDeepCopies(scheme *runtime.Scheme) error {
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ServiceProxyOptions, InType: reflect.TypeOf(&ServiceProxyOptions{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ServiceProxyOptions, InType: reflect.TypeOf(&ServiceProxyOptions{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ServiceSpec, InType: reflect.TypeOf(&ServiceSpec{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ServiceSpec, InType: reflect.TypeOf(&ServiceSpec{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ServiceStatus, InType: reflect.TypeOf(&ServiceStatus{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_ServiceStatus, InType: reflect.TypeOf(&ServiceStatus{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Sysctl, InType: reflect.TypeOf(&Sysctl{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TCPSocketAction, InType: reflect.TypeOf(&TCPSocketAction{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_TCPSocketAction, InType: reflect.TypeOf(&TCPSocketAction{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Taint, InType: reflect.TypeOf(&Taint{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Taint, InType: reflect.TypeOf(&Taint{})},
conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Toleration, InType: reflect.TypeOf(&Toleration{})}, conversion.GeneratedDeepCopyFunc{Fn: DeepCopy_v1_Toleration, InType: reflect.TypeOf(&Toleration{})},
@ -1689,6 +1691,23 @@ func DeepCopy_v1_NodeProxyOptions(in interface{}, out interface{}, c *conversion
} }
} }
func DeepCopy_v1_NodeResources(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*NodeResources)
out := out.(*NodeResources)
if in.Capacity != nil {
in, out := &in.Capacity, &out.Capacity
*out = make(ResourceList)
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
} else {
out.Capacity = nil
}
return nil
}
}
func DeepCopy_v1_NodeSelector(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1_NodeSelector(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*NodeSelector) in := in.(*NodeSelector)
@ -3494,6 +3513,16 @@ func DeepCopy_v1_ServiceStatus(in interface{}, out interface{}, c *conversion.Cl
} }
} }
func DeepCopy_v1_Sysctl(in interface{}, out interface{}, c *conversion.Cloner) error {
{
in := in.(*Sysctl)
out := out.(*Sysctl)
out.Name = in.Name
out.Value = in.Value
return nil
}
}
func DeepCopy_v1_TCPSocketAction(in interface{}, out interface{}, c *conversion.Cloner) error { func DeepCopy_v1_TCPSocketAction(in interface{}, out interface{}, c *conversion.Cloner) error {
{ {
in := in.(*TCPSocketAction) in := in.(*TCPSocketAction)

View File

@ -23,10 +23,10 @@ import (
"k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apimachinery" "k8s.io/client-go/pkg/apimachinery"
"k8s.io/client-go/pkg/apimachinery/registered" "k8s.io/client-go/pkg/apimachinery/registered"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/util/sets" "k8s.io/client-go/pkg/util/sets"
) )
@ -107,7 +107,7 @@ type GroupMetaFactory struct {
VersionArgs map[string]*GroupVersionFactoryArgs VersionArgs map[string]*GroupVersionFactoryArgs
// assembled by Register() // assembled by Register()
prioritizedVersionList []unversioned.GroupVersion prioritizedVersionList []schema.GroupVersion
} }
// Register constructs the finalized prioritized version list and sanity checks // Register constructs the finalized prioritized version list and sanity checks
@ -124,11 +124,11 @@ func (gmf *GroupMetaFactory) Register(m *registered.APIRegistrationManager) erro
if pvSet.Len() != len(gmf.GroupArgs.VersionPreferenceOrder) { if pvSet.Len() != len(gmf.GroupArgs.VersionPreferenceOrder) {
return fmt.Errorf("preference order for group %v has duplicates: %v", gmf.GroupArgs.GroupName, gmf.GroupArgs.VersionPreferenceOrder) return fmt.Errorf("preference order for group %v has duplicates: %v", gmf.GroupArgs.GroupName, gmf.GroupArgs.VersionPreferenceOrder)
} }
prioritizedVersions := []unversioned.GroupVersion{} prioritizedVersions := []schema.GroupVersion{}
for _, v := range gmf.GroupArgs.VersionPreferenceOrder { for _, v := range gmf.GroupArgs.VersionPreferenceOrder {
prioritizedVersions = append( prioritizedVersions = append(
prioritizedVersions, prioritizedVersions,
unversioned.GroupVersion{ schema.GroupVersion{
Group: gmf.GroupArgs.GroupName, Group: gmf.GroupArgs.GroupName,
Version: v, Version: v,
}, },
@ -136,7 +136,7 @@ func (gmf *GroupMetaFactory) Register(m *registered.APIRegistrationManager) erro
} }
// Go through versions that weren't explicitly prioritized. // Go through versions that weren't explicitly prioritized.
unprioritizedVersions := []unversioned.GroupVersion{} unprioritizedVersions := []schema.GroupVersion{}
for _, v := range gmf.VersionArgs { for _, v := range gmf.VersionArgs {
if v.GroupName != gmf.GroupArgs.GroupName { if v.GroupName != gmf.GroupArgs.GroupName {
return fmt.Errorf("found %v/%v in group %v?", v.GroupName, v.VersionName, gmf.GroupArgs.GroupName) return fmt.Errorf("found %v/%v in group %v?", v.GroupName, v.VersionName, gmf.GroupArgs.GroupName)
@ -145,7 +145,7 @@ func (gmf *GroupMetaFactory) Register(m *registered.APIRegistrationManager) erro
pvSet.Delete(v.VersionName) pvSet.Delete(v.VersionName)
continue continue
} }
unprioritizedVersions = append(unprioritizedVersions, unversioned.GroupVersion{Group: v.GroupName, Version: v.VersionName}) unprioritizedVersions = append(unprioritizedVersions, schema.GroupVersion{Group: v.GroupName, Version: v.VersionName})
} }
if len(unprioritizedVersions) > 1 { if len(unprioritizedVersions) > 1 {
glog.Warningf("group %v has multiple unprioritized versions: %#v. They will have an arbitrary preference order!", gmf.GroupArgs.GroupName, unprioritizedVersions) glog.Warningf("group %v has multiple unprioritized versions: %#v. They will have an arbitrary preference order!", gmf.GroupArgs.GroupName, unprioritizedVersions)
@ -159,7 +159,7 @@ func (gmf *GroupMetaFactory) Register(m *registered.APIRegistrationManager) erro
return nil return nil
} }
func (gmf *GroupMetaFactory) newRESTMapper(scheme *runtime.Scheme, externalVersions []unversioned.GroupVersion, groupMeta *apimachinery.GroupMeta) meta.RESTMapper { func (gmf *GroupMetaFactory) newRESTMapper(scheme *runtime.Scheme, externalVersions []schema.GroupVersion, groupMeta *apimachinery.GroupMeta) meta.RESTMapper {
// the list of kinds that are scoped at the root of the api hierarchy // the list of kinds that are scoped at the root of the api hierarchy
// if a kind is not enumerated here, it is assumed to have a namespace scope // if a kind is not enumerated here, it is assumed to have a namespace scope
rootScoped := sets.NewString() rootScoped := sets.NewString()
@ -183,7 +183,7 @@ func (gmf *GroupMetaFactory) newRESTMapper(scheme *runtime.Scheme, externalVersi
// Enable enables group versions that are allowed, adds methods to the scheme, etc. // Enable enables group versions that are allowed, adds methods to the scheme, etc.
func (gmf *GroupMetaFactory) Enable(m *registered.APIRegistrationManager, scheme *runtime.Scheme) error { func (gmf *GroupMetaFactory) Enable(m *registered.APIRegistrationManager, scheme *runtime.Scheme) error {
externalVersions := []unversioned.GroupVersion{} externalVersions := []schema.GroupVersion{}
for _, v := range gmf.prioritizedVersionList { for _, v := range gmf.prioritizedVersionList {
if !m.IsAllowedVersion(v) { if !m.IsAllowedVersion(v) {
continue continue
@ -214,7 +214,7 @@ func (gmf *GroupMetaFactory) Enable(m *registered.APIRegistrationManager, scheme
for _, v := range externalVersions { for _, v := range externalVersions {
gvf := gmf.VersionArgs[v.Version] gvf := gmf.VersionArgs[v.Version]
if err := groupMeta.AddVersionInterfaces( if err := groupMeta.AddVersionInterfaces(
unversioned.GroupVersion{Group: gvf.GroupName, Version: gvf.VersionName}, schema.GroupVersion{Group: gvf.GroupName, Version: gvf.VersionName},
&meta.VersionInterfaces{ &meta.VersionInterfaces{
ObjectConvertor: scheme, ObjectConvertor: scheme,
MetadataAccessor: accessor, MetadataAccessor: accessor,

View File

@ -26,8 +26,8 @@ import (
"github.com/golang/glog" "github.com/golang/glog"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/apimachinery" "k8s.io/client-go/pkg/apimachinery"
"k8s.io/client-go/pkg/runtime/schema"
"k8s.io/client-go/pkg/util/sets" "k8s.io/client-go/pkg/util/sets"
) )
@ -45,16 +45,16 @@ var (
// isn't easy right now because there are so many callers of this package. // isn't easy right now because there are so many callers of this package.
type APIRegistrationManager struct { type APIRegistrationManager struct {
// registeredGroupVersions stores all API group versions for which RegisterGroup is called. // registeredGroupVersions stores all API group versions for which RegisterGroup is called.
registeredVersions map[unversioned.GroupVersion]struct{} registeredVersions map[schema.GroupVersion]struct{}
// thirdPartyGroupVersions are API versions which are dynamically // thirdPartyGroupVersions are API versions which are dynamically
// registered (and unregistered) via API calls to the apiserver // registered (and unregistered) via API calls to the apiserver
thirdPartyGroupVersions []unversioned.GroupVersion thirdPartyGroupVersions []schema.GroupVersion
// enabledVersions represents all enabled API versions. It should be a // enabledVersions represents all enabled API versions. It should be a
// subset of registeredVersions. Please call EnableVersions() to add // subset of registeredVersions. Please call EnableVersions() to add
// enabled versions. // enabled versions.
enabledVersions map[unversioned.GroupVersion]struct{} enabledVersions map[schema.GroupVersion]struct{}
// map of group meta for all groups. // map of group meta for all groups.
groupMetaMap map[string]*apimachinery.GroupMeta groupMetaMap map[string]*apimachinery.GroupMeta
@ -63,7 +63,7 @@ type APIRegistrationManager struct {
// KUBE_API_VERSIONS environment variable. The install package of each group // KUBE_API_VERSIONS environment variable. The install package of each group
// checks this list before add their versions to the latest package and // checks this list before add their versions to the latest package and
// Scheme. This list is small and order matters, so represent as a slice // Scheme. This list is small and order matters, so represent as a slice
envRequestedVersions []unversioned.GroupVersion envRequestedVersions []schema.GroupVersion
} }
// NewAPIRegistrationManager constructs a new manager. The argument ought to be // NewAPIRegistrationManager constructs a new manager. The argument ought to be
@ -71,16 +71,16 @@ type APIRegistrationManager struct {
// wish to test. // wish to test.
func NewAPIRegistrationManager(kubeAPIVersions string) (*APIRegistrationManager, error) { func NewAPIRegistrationManager(kubeAPIVersions string) (*APIRegistrationManager, error) {
m := &APIRegistrationManager{ m := &APIRegistrationManager{
registeredVersions: map[unversioned.GroupVersion]struct{}{}, registeredVersions: map[schema.GroupVersion]struct{}{},
thirdPartyGroupVersions: []unversioned.GroupVersion{}, thirdPartyGroupVersions: []schema.GroupVersion{},
enabledVersions: map[unversioned.GroupVersion]struct{}{}, enabledVersions: map[schema.GroupVersion]struct{}{},
groupMetaMap: map[string]*apimachinery.GroupMeta{}, groupMetaMap: map[string]*apimachinery.GroupMeta{},
envRequestedVersions: []unversioned.GroupVersion{}, envRequestedVersions: []schema.GroupVersion{},
} }
if len(kubeAPIVersions) != 0 { if len(kubeAPIVersions) != 0 {
for _, version := range strings.Split(kubeAPIVersions, ",") { for _, version := range strings.Split(kubeAPIVersions, ",") {
gv, err := unversioned.ParseGroupVersion(version) gv, err := schema.ParseGroupVersion(version)
if err != nil { if err != nil {
return nil, fmt.Errorf("invalid api version: %s in KUBE_API_VERSIONS: %s.", return nil, fmt.Errorf("invalid api version: %s in KUBE_API_VERSIONS: %s.",
version, kubeAPIVersions) version, kubeAPIVersions)
@ -122,7 +122,7 @@ var (
) )
// RegisterVersions adds the given group versions to the list of registered group versions. // RegisterVersions adds the given group versions to the list of registered group versions.
func (m *APIRegistrationManager) RegisterVersions(availableVersions []unversioned.GroupVersion) { func (m *APIRegistrationManager) RegisterVersions(availableVersions []schema.GroupVersion) {
for _, v := range availableVersions { for _, v := range availableVersions {
m.registeredVersions[v] = struct{}{} m.registeredVersions[v] = struct{}{}
} }
@ -141,8 +141,8 @@ func (m *APIRegistrationManager) RegisterGroup(groupMeta apimachinery.GroupMeta)
// EnableVersions adds the versions for the given group to the list of enabled versions. // EnableVersions adds the versions for the given group to the list of enabled versions.
// Note that the caller should call RegisterGroup before calling this method. // Note that the caller should call RegisterGroup before calling this method.
// The caller of this function is responsible to add the versions to scheme and RESTMapper. // The caller of this function is responsible to add the versions to scheme and RESTMapper.
func (m *APIRegistrationManager) EnableVersions(versions ...unversioned.GroupVersion) error { func (m *APIRegistrationManager) EnableVersions(versions ...schema.GroupVersion) error {
var unregisteredVersions []unversioned.GroupVersion var unregisteredVersions []schema.GroupVersion
for _, v := range versions { for _, v := range versions {
if _, found := m.registeredVersions[v]; !found { if _, found := m.registeredVersions[v]; !found {
unregisteredVersions = append(unregisteredVersions, v) unregisteredVersions = append(unregisteredVersions, v)
@ -158,7 +158,7 @@ func (m *APIRegistrationManager) EnableVersions(versions ...unversioned.GroupVer
// IsAllowedVersion returns if the version is allowed by the KUBE_API_VERSIONS // IsAllowedVersion returns if the version is allowed by the KUBE_API_VERSIONS
// environment variable. If the environment variable is empty, then it always // environment variable. If the environment variable is empty, then it always
// returns true. // returns true.
func (m *APIRegistrationManager) IsAllowedVersion(v unversioned.GroupVersion) bool { func (m *APIRegistrationManager) IsAllowedVersion(v schema.GroupVersion) bool {
if len(m.envRequestedVersions) == 0 { if len(m.envRequestedVersions) == 0 {
return true return true
} }
@ -171,15 +171,15 @@ func (m *APIRegistrationManager) IsAllowedVersion(v unversioned.GroupVersion) bo
} }
// IsEnabledVersion returns if a version is enabled. // IsEnabledVersion returns if a version is enabled.
func (m *APIRegistrationManager) IsEnabledVersion(v unversioned.GroupVersion) bool { func (m *APIRegistrationManager) IsEnabledVersion(v schema.GroupVersion) bool {
_, found := m.enabledVersions[v] _, found := m.enabledVersions[v]
return found return found
} }
// EnabledVersions returns all enabled versions. Groups are randomly ordered, but versions within groups // EnabledVersions returns all enabled versions. Groups are randomly ordered, but versions within groups
// are priority order from best to worst // are priority order from best to worst
func (m *APIRegistrationManager) EnabledVersions() []unversioned.GroupVersion { func (m *APIRegistrationManager) EnabledVersions() []schema.GroupVersion {
ret := []unversioned.GroupVersion{} ret := []schema.GroupVersion{}
for _, groupMeta := range m.groupMetaMap { for _, groupMeta := range m.groupMetaMap {
for _, version := range groupMeta.GroupVersions { for _, version := range groupMeta.GroupVersions {
if m.IsEnabledVersion(version) { if m.IsEnabledVersion(version) {
@ -191,13 +191,13 @@ func (m *APIRegistrationManager) EnabledVersions() []unversioned.GroupVersion {
} }
// EnabledVersionsForGroup returns all enabled versions for a group in order of best to worst // EnabledVersionsForGroup returns all enabled versions for a group in order of best to worst
func (m *APIRegistrationManager) EnabledVersionsForGroup(group string) []unversioned.GroupVersion { func (m *APIRegistrationManager) EnabledVersionsForGroup(group string) []schema.GroupVersion {
groupMeta, ok := m.groupMetaMap[group] groupMeta, ok := m.groupMetaMap[group]
if !ok { if !ok {
return []unversioned.GroupVersion{} return []schema.GroupVersion{}
} }
ret := []unversioned.GroupVersion{} ret := []schema.GroupVersion{}
for _, version := range groupMeta.GroupVersions { for _, version := range groupMeta.GroupVersions {
if m.IsEnabledVersion(version) { if m.IsEnabledVersion(version) {
ret = append(ret, version) ret = append(ret, version)
@ -224,14 +224,14 @@ func (m *APIRegistrationManager) IsRegistered(group string) bool {
} }
// IsRegisteredVersion returns if a version is registered. // IsRegisteredVersion returns if a version is registered.
func (m *APIRegistrationManager) IsRegisteredVersion(v unversioned.GroupVersion) bool { func (m *APIRegistrationManager) IsRegisteredVersion(v schema.GroupVersion) bool {
_, found := m.registeredVersions[v] _, found := m.registeredVersions[v]
return found return found
} }
// RegisteredGroupVersions returns all registered group versions. // RegisteredGroupVersions returns all registered group versions.
func (m *APIRegistrationManager) RegisteredGroupVersions() []unversioned.GroupVersion { func (m *APIRegistrationManager) RegisteredGroupVersions() []schema.GroupVersion {
ret := []unversioned.GroupVersion{} ret := []schema.GroupVersion{}
for groupVersion := range m.registeredVersions { for groupVersion := range m.registeredVersions {
ret = append(ret, groupVersion) ret = append(ret, groupVersion)
} }
@ -239,7 +239,7 @@ func (m *APIRegistrationManager) RegisteredGroupVersions() []unversioned.GroupVe
} }
// IsThirdPartyAPIGroupVersion returns true if the api version is a user-registered group/version. // IsThirdPartyAPIGroupVersion returns true if the api version is a user-registered group/version.
func (m *APIRegistrationManager) IsThirdPartyAPIGroupVersion(gv unversioned.GroupVersion) bool { func (m *APIRegistrationManager) IsThirdPartyAPIGroupVersion(gv schema.GroupVersion) bool {
for ix := range m.thirdPartyGroupVersions { for ix := range m.thirdPartyGroupVersions {
if m.thirdPartyGroupVersions[ix] == gv { if m.thirdPartyGroupVersions[ix] == gv {
return true return true
@ -252,9 +252,9 @@ func (m *APIRegistrationManager) IsThirdPartyAPIGroupVersion(gv unversioned.Grou
// registers them in the API machinery and enables them. // registers them in the API machinery and enables them.
// Skips GroupVersions that are already registered. // Skips GroupVersions that are already registered.
// Returns the list of GroupVersions that were skipped. // Returns the list of GroupVersions that were skipped.
func (m *APIRegistrationManager) AddThirdPartyAPIGroupVersions(gvs ...unversioned.GroupVersion) []unversioned.GroupVersion { func (m *APIRegistrationManager) AddThirdPartyAPIGroupVersions(gvs ...schema.GroupVersion) []schema.GroupVersion {
filteredGVs := []unversioned.GroupVersion{} filteredGVs := []schema.GroupVersion{}
skippedGVs := []unversioned.GroupVersion{} skippedGVs := []schema.GroupVersion{}
for ix := range gvs { for ix := range gvs {
if !m.IsRegisteredVersion(gvs[ix]) { if !m.IsRegisteredVersion(gvs[ix]) {
filteredGVs = append(filteredGVs, gvs[ix]) filteredGVs = append(filteredGVs, gvs[ix])
@ -274,7 +274,7 @@ func (m *APIRegistrationManager) AddThirdPartyAPIGroupVersions(gvs ...unversione
} }
// InterfacesFor is a union meta.VersionInterfacesFunc func for all registered types // InterfacesFor is a union meta.VersionInterfacesFunc func for all registered types
func (m *APIRegistrationManager) InterfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { func (m *APIRegistrationManager) InterfacesFor(version schema.GroupVersion) (*meta.VersionInterfaces, error) {
groupMeta, err := m.Group(version.Group) groupMeta, err := m.Group(version.Group)
if err != nil { if err != nil {
return nil, err return nil, err
@ -303,7 +303,7 @@ func (m *APIRegistrationManager) GroupOrDie(group string) *apimachinery.GroupMet
// 1. legacy kube group preferred version, extensions preferred version, metrics perferred version, legacy // 1. legacy kube group preferred version, extensions preferred version, metrics perferred version, legacy
// kube any version, extensions any version, metrics any version, all other groups alphabetical preferred version, // kube any version, extensions any version, metrics any version, all other groups alphabetical preferred version,
// all other groups alphabetical. // all other groups alphabetical.
func (m *APIRegistrationManager) RESTMapper(versionPatterns ...unversioned.GroupVersion) meta.RESTMapper { func (m *APIRegistrationManager) RESTMapper(versionPatterns ...schema.GroupVersion) meta.RESTMapper {
unionMapper := meta.MultiRESTMapper{} unionMapper := meta.MultiRESTMapper{}
unionedGroups := sets.NewString() unionedGroups := sets.NewString()
for enabledVersion := range m.enabledVersions { for enabledVersion := range m.enabledVersions {
@ -315,8 +315,8 @@ func (m *APIRegistrationManager) RESTMapper(versionPatterns ...unversioned.Group
} }
if len(versionPatterns) != 0 { if len(versionPatterns) != 0 {
resourcePriority := []unversioned.GroupVersionResource{} resourcePriority := []schema.GroupVersionResource{}
kindPriority := []unversioned.GroupVersionKind{} kindPriority := []schema.GroupVersionKind{}
for _, versionPriority := range versionPatterns { for _, versionPriority := range versionPatterns {
resourcePriority = append(resourcePriority, versionPriority.WithResource(meta.AnyResource)) resourcePriority = append(resourcePriority, versionPriority.WithResource(meta.AnyResource))
kindPriority = append(kindPriority, versionPriority.WithKind(meta.AnyKind)) kindPriority = append(kindPriority, versionPriority.WithKind(meta.AnyKind))
@ -326,8 +326,8 @@ func (m *APIRegistrationManager) RESTMapper(versionPatterns ...unversioned.Group
} }
if len(m.envRequestedVersions) != 0 { if len(m.envRequestedVersions) != 0 {
resourcePriority := []unversioned.GroupVersionResource{} resourcePriority := []schema.GroupVersionResource{}
kindPriority := []unversioned.GroupVersionKind{} kindPriority := []schema.GroupVersionKind{}
for _, versionPriority := range m.envRequestedVersions { for _, versionPriority := range m.envRequestedVersions {
resourcePriority = append(resourcePriority, versionPriority.WithResource(meta.AnyResource)) resourcePriority = append(resourcePriority, versionPriority.WithResource(meta.AnyResource))
@ -357,9 +357,9 @@ func (m *APIRegistrationManager) RESTMapper(versionPatterns ...unversioned.Group
// prioritiesForGroups returns the resource and kind priorities for a PriorityRESTMapper, preferring the preferred version of each group first, // prioritiesForGroups returns the resource and kind priorities for a PriorityRESTMapper, preferring the preferred version of each group first,
// then any non-preferred version of the group second. // then any non-preferred version of the group second.
func (m *APIRegistrationManager) prioritiesForGroups(groups ...string) ([]unversioned.GroupVersionResource, []unversioned.GroupVersionKind) { func (m *APIRegistrationManager) prioritiesForGroups(groups ...string) ([]schema.GroupVersionResource, []schema.GroupVersionKind) {
resourcePriority := []unversioned.GroupVersionResource{} resourcePriority := []schema.GroupVersionResource{}
kindPriority := []unversioned.GroupVersionKind{} kindPriority := []schema.GroupVersionKind{}
for _, group := range groups { for _, group := range groups {
availableVersions := m.EnabledVersionsForGroup(group) availableVersions := m.EnabledVersionsForGroup(group)
@ -369,8 +369,8 @@ func (m *APIRegistrationManager) prioritiesForGroups(groups ...string) ([]unvers
} }
} }
for _, group := range groups { for _, group := range groups {
resourcePriority = append(resourcePriority, unversioned.GroupVersionResource{Group: group, Version: meta.AnyVersion, Resource: meta.AnyResource}) resourcePriority = append(resourcePriority, schema.GroupVersionResource{Group: group, Version: meta.AnyVersion, Resource: meta.AnyResource})
kindPriority = append(kindPriority, unversioned.GroupVersionKind{Group: group, Version: meta.AnyVersion, Kind: meta.AnyKind}) kindPriority = append(kindPriority, schema.GroupVersionKind{Group: group, Version: meta.AnyVersion, Kind: meta.AnyKind})
} }
return resourcePriority, kindPriority return resourcePriority, kindPriority
@ -392,8 +392,8 @@ func (m *APIRegistrationManager) AllPreferredGroupVersions() string {
// ValidateEnvRequestedVersions returns a list of versions that are requested in // ValidateEnvRequestedVersions returns a list of versions that are requested in
// the KUBE_API_VERSIONS environment variable, but not enabled. // the KUBE_API_VERSIONS environment variable, but not enabled.
func (m *APIRegistrationManager) ValidateEnvRequestedVersions() []unversioned.GroupVersion { func (m *APIRegistrationManager) ValidateEnvRequestedVersions() []schema.GroupVersion {
var missingVersions []unversioned.GroupVersion var missingVersions []schema.GroupVersion
for _, v := range m.envRequestedVersions { for _, v := range m.envRequestedVersions {
if _, found := m.enabledVersions[v]; !found { if _, found := m.enabledVersions[v]; !found {
missingVersions = append(missingVersions, v) missingVersions = append(missingVersions, v)

View File

@ -20,17 +20,17 @@ import (
"fmt" "fmt"
"k8s.io/client-go/pkg/api/meta" "k8s.io/client-go/pkg/api/meta"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
// GroupMeta stores the metadata of a group. // GroupMeta stores the metadata of a group.
type GroupMeta struct { type GroupMeta struct {
// GroupVersion represents the preferred version of the group. // GroupVersion represents the preferred version of the group.
GroupVersion unversioned.GroupVersion GroupVersion schema.GroupVersion
// GroupVersions is Group + all versions in that group. // GroupVersions is Group + all versions in that group.
GroupVersions []unversioned.GroupVersion GroupVersions []schema.GroupVersion
// Codec is the default codec for serializing output that should use // Codec is the default codec for serializing output that should use
// the preferred version. Use this Codec when writing to // the preferred version. Use this Codec when writing to
@ -52,16 +52,16 @@ type GroupMeta struct {
// string, or an error if the version is not known. // string, or an error if the version is not known.
// TODO: make this stop being a func pointer and always use the default // TODO: make this stop being a func pointer and always use the default
// function provided below once every place that populates this field has been changed. // function provided below once every place that populates this field has been changed.
InterfacesFor func(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) InterfacesFor func(version schema.GroupVersion) (*meta.VersionInterfaces, error)
// InterfacesByVersion stores the per-version interfaces. // InterfacesByVersion stores the per-version interfaces.
InterfacesByVersion map[unversioned.GroupVersion]*meta.VersionInterfaces InterfacesByVersion map[schema.GroupVersion]*meta.VersionInterfaces
} }
// DefaultInterfacesFor returns the default Codec and ResourceVersioner for a given version // DefaultInterfacesFor returns the default Codec and ResourceVersioner for a given version
// string, or an error if the version is not known. // string, or an error if the version is not known.
// TODO: Remove the "Default" prefix. // TODO: Remove the "Default" prefix.
func (gm *GroupMeta) DefaultInterfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) { func (gm *GroupMeta) DefaultInterfacesFor(version schema.GroupVersion) (*meta.VersionInterfaces, error) {
if v, ok := gm.InterfacesByVersion[version]; ok { if v, ok := gm.InterfacesByVersion[version]; ok {
return v, nil return v, nil
} }
@ -73,12 +73,12 @@ func (gm *GroupMeta) DefaultInterfacesFor(version unversioned.GroupVersion) (*me
// (If you use this, be sure to set .InterfacesFor = .DefaultInterfacesFor) // (If you use this, be sure to set .InterfacesFor = .DefaultInterfacesFor)
// TODO: remove the "Interfaces" suffix and make this also maintain the // TODO: remove the "Interfaces" suffix and make this also maintain the
// .GroupVersions member. // .GroupVersions member.
func (gm *GroupMeta) AddVersionInterfaces(version unversioned.GroupVersion, interfaces *meta.VersionInterfaces) error { func (gm *GroupMeta) AddVersionInterfaces(version schema.GroupVersion, interfaces *meta.VersionInterfaces) error {
if e, a := gm.GroupVersion.Group, version.Group; a != e { if e, a := gm.GroupVersion.Group, version.Group; a != e {
return fmt.Errorf("got a version in group %v, but am in group %v", a, e) return fmt.Errorf("got a version in group %v, but am in group %v", a, e)
} }
if gm.InterfacesByVersion == nil { if gm.InterfacesByVersion == nil {
gm.InterfacesByVersion = make(map[unversioned.GroupVersion]*meta.VersionInterfaces) gm.InterfacesByVersion = make(map[schema.GroupVersion]*meta.VersionInterfaces)
} }
gm.InterfacesByVersion[version] = interfaces gm.InterfacesByVersion[version] = interfaces

View File

@ -18,8 +18,8 @@ package apps
import ( import (
"k8s.io/client-go/pkg/api" "k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/unversioned"
"k8s.io/client-go/pkg/runtime" "k8s.io/client-go/pkg/runtime"
"k8s.io/client-go/pkg/runtime/schema"
) )
var ( var (
@ -31,15 +31,15 @@ var (
const GroupName = "apps" const GroupName = "apps"
// SchemeGroupVersion is group version used to register these objects // SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal} var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
// Kind takes an unqualified kind and returns a Group qualified GroupKind // Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) unversioned.GroupKind { func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind() return SchemeGroupVersion.WithKind(kind).GroupKind()
} }
// Resource takes an unqualified resource and returns a Group qualified GroupResource // Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) unversioned.GroupResource { func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource() return SchemeGroupVersion.WithResource(resource).GroupResource()
} }

View File

@ -1032,45 +1032,45 @@ var (
) )
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 627 bytes of a gzipped FileDescriptorProto // 637 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x93, 0xcd, 0x6e, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x9c, 0x93, 0xcd, 0x6e, 0xd3, 0x4c,
0x10, 0xc7, 0xe3, 0xa4, 0x29, 0x61, 0x53, 0xbe, 0x96, 0x0a, 0x45, 0x11, 0x72, 0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 0xb8, 0xf7, 0x8f, 0x4e, 0xed, 0xc2, 0xf1, 0xa9, 0x5d, 0xf8, 0x75, 0x6a, 0x17, 0x3e, 0x51, 0xd0, 0x8d, 0x9c, 0x07, 0xca, 0xca, 0x03, 0xd3, 0x55, 0x16, 0x7d, 0x60, 0xdf, 0x3f, 0x3e,
0x0f, 0x6c, 0xeb, 0x68, 0x60, 0x5b, 0xc7, 0x03, 0xdb, 0xfa, 0x3d, 0xb0, 0xad, 0x6f, 0x7f, 0xec, 0x33, 0x4b, 0x27, 0x67, 0x66, 0xe9, 0xe7, 0x99, 0x59, 0xfa, 0x34, 0x32, 0x8d, 0xe3, 0x91, 0x69,
0xc2, 0xc1, 0x15, 0xb3, 0x92, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x28, 0x58, 0x61, 0xec, 0xf5, 0x9c, 0x8c, 0x4c, 0xe3, 0xd7, 0xc8, 0x34, 0xbe, 0xfe, 0x36, 0x4b, 0x07, 0xff, 0x69, 0x4b, 0xfe,
0x05, 0x00, 0x00, 0x09, 0x00, 0x00, 0xff, 0xff, 0x64, 0x32, 0x5a, 0xad, 0x2b, 0x06, 0x00, 0x00,
} }

Some files were not shown because too many files have changed in this diff Show More