Commit bdfd469a authored by Alex Mohr's avatar Alex Mohr

Merge pull request #14137 from caesarxuchao/13823

rebase 13823
parents c1eb1a1b c5f22a02
......@@ -39,6 +39,7 @@ import (
apierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apiserver"
"k8s.io/kubernetes/pkg/client/record"
client "k8s.io/kubernetes/pkg/client/unversioned"
......@@ -545,7 +546,7 @@ func runSelfLinkTestOnNamespace(c *client.Client, namespace string) {
func runAtomicPutTest(c *client.Client) {
svcBody := api.Service{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
APIVersion: c.APIVersion(),
},
ObjectMeta: api.ObjectMeta{
......@@ -627,7 +628,7 @@ func runPatchTest(c *client.Client) {
name := "patchservice"
resource := "services"
svcBody := api.Service{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
APIVersion: c.APIVersion(),
},
ObjectMeta: api.ObjectMeta{
......
......@@ -37,6 +37,7 @@ import (
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/podtask"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/kubelet"
......@@ -660,7 +661,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
func NewTestPod(i int) *api.Pod {
name := fmt.Sprintf("pod%d", i)
return &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
......
......@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
......@@ -196,7 +197,7 @@ func NewTestPod() (*api.Pod, int) {
currentPodNum = currentPodNum + 1
name := fmt.Sprintf("pod%d", currentPodNum)
return &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
......
......@@ -41,13 +41,14 @@ find_files() {
\) \
\( -wholename '*pkg/api/v*/types.go' \
-o -wholename '*pkg/apis/*/v*/types.go' \
-o -wholename '*pkg/api/unversioned/types.go' \
\)
}
if [[ $# -eq 0 ]]; then
versioned_api_files=`find_files | egrep "pkg/.[^/]*/v.[^/]*/types\.go"`
versioned_api_files=$(find_files | egrep "pkg/.[^/]*/((v.[^/]*)|unversioned)/types\.go")
else
versioned_api_files=("${@}")
versioned_api_files="${*}"
fi
for file in $versioned_api_files; do
......
......@@ -47,7 +47,7 @@ cp -a "${APIROOT}" "${TMP_APIROOT}"
echo "diffing ${APIROOT} against freshly generated swagger type documentation"
ret=0
diff -Naupr -I 'Auto generated by' "${APIROOT}" "${TMP_APIROOT}" || ret=$?
cp -a ${TMP_APIROOT} "${KUBE_ROOT}/pkg"
cp -a "${TMP_APIROOT}" "${KUBE_ROOT}/pkg"
rm -rf "${_tmp}"
if [[ $ret -eq 0 ]]
then
......
......@@ -29,9 +29,9 @@ function generate_version() {
echo "Generating swagger type docs for ${group_version}"
sed 's/YEAR/2015/' hack/boilerplate/boilerplate.go.txt > $TMPFILE
echo "package ${group_version##*/}" >> $TMPFILE
cat >> $TMPFILE <<EOF
sed 's/YEAR/2015/' hack/boilerplate/boilerplate.go.txt > "$TMPFILE"
echo "package ${group_version##*/}" >> "$TMPFILE"
cat >> "$TMPFILE" <<EOF
// This file contains a collection of methods that can be used from go-resful to
// generate Swagger API documentation for its models. Please read this PR for more
......@@ -48,20 +48,20 @@ EOF
GOPATH=$(godep path):$GOPATH go run cmd/genswaggertypedocs/swagger_type_docs.go -s \
"pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types.go" -f - \
>> $TMPFILE
>> "$TMPFILE"
echo "// AUTO-GENERATED FUNCTIONS END HERE" >> $TMPFILE
echo "// AUTO-GENERATED FUNCTIONS END HERE" >> "$TMPFILE"
gofmt -w -s $TMPFILE
mv $TMPFILE "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"
gofmt -w -s "$TMPFILE"
mv "$TMPFILE" "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"
}
GROUP_VERSIONS="api/v1 experimental/v1"
GROUP_VERSIONS=(api/unversioned api/v1 experimental/v1)
# To avoid compile errors, remove the currently existing files.
for group_version in $GROUP_VERSIONS; do
for group_version in "${GROUP_VERSIONS[@]}"; do
rm -f "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"
done
for group_version in $GROUP_VERSIONS; do
for group_version in "${GROUP_VERSIONS[@]}"; do
generate_version "${group_version}"
done
......
......@@ -22,7 +22,7 @@ import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/fielderrors"
)
......@@ -30,118 +30,118 @@ import (
func TestErrorNew(t *testing.T) {
err := NewAlreadyExists("test", "1")
if !IsAlreadyExists(err) {
t.Errorf("expected to be %s", api.StatusReasonAlreadyExists)
t.Errorf("expected to be %s", unversioned.StatusReasonAlreadyExists)
}
if IsConflict(err) {
t.Errorf("expected to not be %s", api.StatusReasonConflict)
t.Errorf("expected to not be %s", unversioned.StatusReasonConflict)
}
if IsNotFound(err) {
t.Errorf(fmt.Sprintf("expected to not be %s", api.StatusReasonNotFound))
t.Errorf(fmt.Sprintf("expected to not be %s", unversioned.StatusReasonNotFound))
}
if IsInvalid(err) {
t.Errorf("expected to not be %s", api.StatusReasonInvalid)
t.Errorf("expected to not be %s", unversioned.StatusReasonInvalid)
}
if IsBadRequest(err) {
t.Errorf("expected to not be %s", api.StatusReasonBadRequest)
t.Errorf("expected to not be %s", unversioned.StatusReasonBadRequest)
}
if IsForbidden(err) {
t.Errorf("expected to not be %s", api.StatusReasonForbidden)
t.Errorf("expected to not be %s", unversioned.StatusReasonForbidden)
}
if IsServerTimeout(err) {
t.Errorf("expected to not be %s", api.StatusReasonServerTimeout)
t.Errorf("expected to not be %s", unversioned.StatusReasonServerTimeout)
}
if IsMethodNotSupported(err) {
t.Errorf("expected to not be %s", api.StatusReasonMethodNotAllowed)
t.Errorf("expected to not be %s", unversioned.StatusReasonMethodNotAllowed)
}
if !IsConflict(NewConflict("test", "2", errors.New("message"))) {
t.Errorf("expected to be conflict")
}
if !IsNotFound(NewNotFound("test", "3")) {
t.Errorf("expected to be %s", api.StatusReasonNotFound)
t.Errorf("expected to be %s", unversioned.StatusReasonNotFound)
}
if !IsInvalid(NewInvalid("test", "2", nil)) {
t.Errorf("expected to be %s", api.StatusReasonInvalid)
t.Errorf("expected to be %s", unversioned.StatusReasonInvalid)
}
if !IsBadRequest(NewBadRequest("reason")) {
t.Errorf("expected to be %s", api.StatusReasonBadRequest)
t.Errorf("expected to be %s", unversioned.StatusReasonBadRequest)
}
if !IsForbidden(NewForbidden("test", "2", errors.New("reason"))) {
t.Errorf("expected to be %s", api.StatusReasonForbidden)
t.Errorf("expected to be %s", unversioned.StatusReasonForbidden)
}
if !IsUnauthorized(NewUnauthorized("reason")) {
t.Errorf("expected to be %s", api.StatusReasonUnauthorized)
t.Errorf("expected to be %s", unversioned.StatusReasonUnauthorized)
}
if !IsServerTimeout(NewServerTimeout("test", "reason", 0)) {
t.Errorf("expected to be %s", api.StatusReasonServerTimeout)
t.Errorf("expected to be %s", unversioned.StatusReasonServerTimeout)
}
if time, ok := SuggestsClientDelay(NewServerTimeout("test", "doing something", 10)); time != 10 || !ok {
t.Errorf("expected to be %s", api.StatusReasonServerTimeout)
t.Errorf("expected to be %s", unversioned.StatusReasonServerTimeout)
}
if time, ok := SuggestsClientDelay(NewTimeoutError("test reason", 10)); time != 10 || !ok {
t.Errorf("expected to be %s", api.StatusReasonTimeout)
t.Errorf("expected to be %s", unversioned.StatusReasonTimeout)
}
if !IsMethodNotSupported(NewMethodNotSupported("foo", "delete")) {
t.Errorf("expected to be %s", api.StatusReasonMethodNotAllowed)
t.Errorf("expected to be %s", unversioned.StatusReasonMethodNotAllowed)
}
}
func TestNewInvalid(t *testing.T) {
testCases := []struct {
Err *fielderrors.ValidationError
Details *api.StatusDetails
Details *unversioned.StatusDetails
}{
{
fielderrors.NewFieldDuplicate("field[0].name", "bar"),
&api.StatusDetails{
&unversioned.StatusDetails{
Kind: "kind",
Name: "name",
Causes: []api.StatusCause{{
Type: api.CauseTypeFieldValueDuplicate,
Causes: []unversioned.StatusCause{{
Type: unversioned.CauseTypeFieldValueDuplicate,
Field: "field[0].name",
}},
},
},
{
fielderrors.NewFieldInvalid("field[0].name", "bar", "detail"),
&api.StatusDetails{
&unversioned.StatusDetails{
Kind: "kind",
Name: "name",
Causes: []api.StatusCause{{
Type: api.CauseTypeFieldValueInvalid,
Causes: []unversioned.StatusCause{{
Type: unversioned.CauseTypeFieldValueInvalid,
Field: "field[0].name",
}},
},
},
{
fielderrors.NewFieldNotFound("field[0].name", "bar"),
&api.StatusDetails{
&unversioned.StatusDetails{
Kind: "kind",
Name: "name",
Causes: []api.StatusCause{{
Type: api.CauseTypeFieldValueNotFound,
Causes: []unversioned.StatusCause{{
Type: unversioned.CauseTypeFieldValueNotFound,
Field: "field[0].name",
}},
},
},
{
fielderrors.NewFieldValueNotSupported("field[0].name", "bar", nil),
&api.StatusDetails{
&unversioned.StatusDetails{
Kind: "kind",
Name: "name",
Causes: []api.StatusCause{{
Type: api.CauseTypeFieldValueNotSupported,
Causes: []unversioned.StatusCause{{
Type: unversioned.CauseTypeFieldValueNotSupported,
Field: "field[0].name",
}},
},
},
{
fielderrors.NewFieldRequired("field[0].name"),
&api.StatusDetails{
&unversioned.StatusDetails{
Kind: "kind",
Name: "name",
Causes: []api.StatusCause{{
Type: api.CauseTypeFieldValueRequired,
Causes: []unversioned.StatusCause{{
Type: unversioned.CauseTypeFieldValueRequired,
Field: "field[0].name",
}},
},
......@@ -152,7 +152,7 @@ func TestNewInvalid(t *testing.T) {
expected.Causes[0].Message = vErr.ErrorBody()
err := NewInvalid("kind", "name", fielderrors.ValidationErrorList{vErr})
status := err.(*StatusError).ErrStatus
if status.Code != 422 || status.Reason != api.StatusReasonInvalid {
if status.Code != 422 || status.Reason != unversioned.StatusReasonInvalid {
t.Errorf("%d: unexpected status: %#v", i, status)
}
if !reflect.DeepEqual(expected, status.Details) {
......@@ -162,7 +162,7 @@ func TestNewInvalid(t *testing.T) {
}
func Test_reasonForError(t *testing.T) {
if e, a := api.StatusReasonUnknown, reasonForError(nil); e != a {
if e, a := unversioned.StatusReasonUnknown, reasonForError(nil); e != a {
t.Errorf("unexpected reason type: %#v", a)
}
}
......@@ -176,7 +176,7 @@ func TestFromObject(t *testing.T) {
obj runtime.Object
message string
}{
{&api.Status{Message: "foobar"}, "foobar"},
{&unversioned.Status{Message: "foobar"}, "foobar"},
{&TestType{}, "unexpected object: &{}"},
}
......
......@@ -22,6 +22,7 @@ import (
internal "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
)
func TestResourceVersioner(t *testing.T) {
......@@ -34,7 +35,7 @@ func TestResourceVersioner(t *testing.T) {
t.Errorf("unexpected version %v", version)
}
podList := internal.PodList{ListMeta: internal.ListMeta{ResourceVersion: "10"}}
podList := internal.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "10"}}
version, err = accessor.ResourceVersion(&podList)
if err != nil {
t.Fatalf("unexpected error: %v", err)
......
......@@ -17,6 +17,7 @@ limitations under the License.
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
......@@ -50,12 +51,12 @@ func ObjectMetaFor(obj runtime.Object) (*ObjectMeta, error) {
// ListMetaFor returns a pointer to a provided object's ListMeta,
// or an error if the object does not have that pointer.
// TODO: allow runtime.Unknown to extract this object
func ListMetaFor(obj runtime.Object) (*ListMeta, error) {
func ListMetaFor(obj runtime.Object) (*unversioned.ListMeta, error) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return nil, err
}
var meta *ListMeta
var meta *unversioned.ListMeta
err = runtime.FieldPtr(v, "ListMeta", &meta)
return meta, err
}
......@@ -20,6 +20,7 @@ import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
......@@ -28,7 +29,7 @@ type FakeAPIObject struct{}
func (*FakeAPIObject) IsAnAPIObject() {}
type ExtensionAPIObject struct {
TypeMeta
unversioned.TypeMeta
ObjectMeta
}
......@@ -62,7 +63,7 @@ func TestGetReference(t *testing.T) {
},
"serviceList": {
obj: &ServiceList{
ListMeta: ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "42",
SelfLink: "/api/version2/services",
},
......@@ -75,7 +76,7 @@ func TestGetReference(t *testing.T) {
},
"extensionAPIObject": {
obj: &ExtensionAPIObject{
TypeMeta: TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "ExtensionAPIObject",
},
ObjectMeta: ObjectMeta{
......@@ -95,7 +96,7 @@ func TestGetReference(t *testing.T) {
},
"badSelfLink": {
obj: &ServiceList{
ListMeta: ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "42",
SelfLink: "version2/services",
},
......
......@@ -17,6 +17,7 @@ limitations under the License.
package api
import (
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
......@@ -36,7 +37,6 @@ func init() {
&Service{},
&NodeList{},
&Node{},
&Status{},
&Endpoints{},
&EndpointsList{},
&Binding{},
......@@ -71,6 +71,13 @@ func init() {
&ThirdPartyResourceList{},
&ThirdPartyResourceData{},
)
// Register Unversioned types
Scheme.AddKnownTypes("", &unversioned.Status{})
// Legacy names are supported
Scheme.AddKnownTypeWithName("", "Minion", &Node{})
Scheme.AddKnownTypeWithName("", "MinionList", &NodeList{})
}
func (*Pod) IsAnAPIObject() {}
......@@ -87,7 +94,6 @@ func (*EndpointsList) IsAnAPIObject() {}
func (*Node) IsAnAPIObject() {}
func (*NodeList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*List) IsAnAPIObject() {}
......
......@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -527,9 +528,9 @@ func (t *Tester) testDeleteNoGraceful(obj runtime.Object, setFn SetFunc, getFn G
t.Errorf("unexpected error: %v", err)
}
if !t.returnDeletedObject {
if status, ok := obj.(*api.Status); !ok {
if status, ok := obj.(*unversioned.Status); !ok {
t.Errorf("expected status of delete, got %v", status)
} else if status.Status != api.StatusSuccess {
} else if status.Status != unversioned.StatusSuccess {
t.Errorf("expected success, got: %v", status.Status)
}
}
......
......@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/registered"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -54,7 +55,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
j.APIVersion = ""
j.Kind = ""
},
func(j *api.TypeMeta, c fuzz.Continue) {
func(j *unversioned.TypeMeta, c fuzz.Continue) {
// We have to customize the randomization of TypeMetas because their
// APIVersion and Kind must remain blank in memory.
j.APIVersion = ""
......@@ -82,7 +83,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
j.FieldPath = c.RandString()
},
func(j *api.ListMeta, c fuzz.Continue) {
func(j *unversioned.ListMeta, c fuzz.Continue) {
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
j.SelfLink = c.RandString()
},
......
/*
Copyright 2015 The Kubernetes Authors All rights reserved.
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 unversioned
// This file contains a collection of methods that can be used from go-resful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser. (e.g. TODO(andronat):... || TODO:...) iff
// are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE
var map_ListMeta = map[string]string{
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects. A resource may have only one of {ObjectMeta, ListMeta}.",
"selfLink": "SelfLink is a URL representing this object. Populated by the system. Read-only.",
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency",
}
func (ListMeta) SwaggerDoc() map[string]string {
return map_ListMeta
}
var map_Status = map[string]string{
"": "Status is a return value for calls that don't return other objects.",
"metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"status": "Status of the operation. One of: \"Success\" or \"Failure\". More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
"message": "A human-readable description of the status of this operation.",
"reason": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.",
"details": "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.",
"code": "Suggested HTTP return code for this status, 0 if not set.",
}
func (Status) SwaggerDoc() map[string]string {
return map_Status
}
var map_StatusCause = map[string]string{
"": "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.",
"reason": "A machine-readable description of the cause of the error. If this value is empty there is no information available.",
"message": "A human-readable description of the cause of the error. This field may be presented as-is to a reader.",
"field": "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors. Optional.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"",
}
func (StatusCause) SwaggerDoc() map[string]string {
return map_StatusCause
}
var map_StatusDetails = map[string]string{
"": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
"name": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
"kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"causes": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
"retryAfterSeconds": "If specified, the time in seconds before the operation should be retried.",
}
func (StatusDetails) SwaggerDoc() map[string]string {
return map_StatusDetails
}
var map_TypeMeta = map[string]string{
"": "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.",
"kind": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"apiVersion": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources",
}
func (TypeMeta) SwaggerDoc() map[string]string {
return map_TypeMeta
}
// AUTO-GENERATED FUNCTIONS END HERE
......@@ -19,6 +19,7 @@ package v1
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/registered"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
)
......@@ -54,7 +55,6 @@ func addKnownTypes() {
&Node{},
&NodeList{},
&Binding{},
&Status{},
&Event{},
&EventList{},
&List{},
......@@ -86,6 +86,13 @@ func addKnownTypes() {
&ThirdPartyResourceList{},
&ThirdPartyResourceData{},
)
// Add common types
api.Scheme.AddKnownTypes("v1", &unversioned.Status{})
// Legacy names are supported
api.Scheme.AddKnownTypeWithName("v1", "Minion", &Node{})
api.Scheme.AddKnownTypeWithName("v1", "MinionList", &NodeList{})
}
func (*Pod) IsAnAPIObject() {}
......@@ -102,7 +109,6 @@ func (*EndpointsList) IsAnAPIObject() {}
func (*Node) IsAnAPIObject() {}
func (*NodeList) IsAnAPIObject() {}
func (*Binding) IsAnAPIObject() {}
func (*Status) IsAnAPIObject() {}
func (*Event) IsAnAPIObject() {}
func (*EventList) IsAnAPIObject() {}
func (*List) IsAnAPIObject() {}
......
......@@ -528,16 +528,6 @@ func (List) SwaggerDoc() map[string]string {
return map_List
}
var map_ListMeta = map[string]string{
"": "ListMeta describes metadata that synthetic resources must have, including lists and various status objects.",
"selfLink": "SelfLink is a URL representing this object. Populated by the system. Read-only.",
"resourceVersion": "String that identifies the server's internal version of this object that can be used by clients to determine when objects have changed. Value must be treated as opaque by clients and passed unmodified back to the server. Populated by the system. Read-only. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#concurrency-control-and-consistency",
}
func (ListMeta) SwaggerDoc() map[string]string {
return map_ListMeta
}
var map_ListOptions = map[string]string{
"": "ListOptions is the query options to a standard REST list call.",
"labelSelector": "A selector to restrict the list of returned objects by their labels. Defaults to everything.",
......@@ -1310,43 +1300,6 @@ func (ServiceStatus) SwaggerDoc() map[string]string {
return map_ServiceStatus
}
var map_Status = map[string]string{
"": "Status is a return value for calls that don't return other objects.",
"metadata": "Standard list metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"status": "Status of the operation. One of: \"Success\" or \"Failure\". More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status",
"message": "A human-readable description of the status of this operation.",
"reason": "A machine-readable description of why this operation is in the \"Failure\" status. If this value is empty there is no information available. A Reason clarifies an HTTP status code but does not override it.",
"details": "Extended data associated with the reason. Each reason may define its own extended details. This field is optional and the data returned is not guaranteed to conform to any schema except that defined by the reason type.",
"code": "Suggested HTTP return code for this status, 0 if not set.",
}
func (Status) SwaggerDoc() map[string]string {
return map_Status
}
var map_StatusCause = map[string]string{
"": "StatusCause provides more information about an api.Status failure, including cases when multiple errors are encountered.",
"reason": "A machine-readable description of the cause of the error. If this value is empty there is no information available.",
"message": "A human-readable description of the cause of the error. This field may be presented as-is to a reader.",
"field": "The field of the resource that has caused this error, as named by its JSON serialization. May include dot and postfix notation for nested attributes. Arrays are zero-indexed. Fields may appear more than once in an array of causes due to fields having multiple errors.\n\nExamples:\n \"name\" - the field \"name\" on the current resource\n \"items[0].name\" - the field \"name\" on the first array entry in \"items\"",
}
func (StatusCause) SwaggerDoc() map[string]string {
return map_StatusCause
}
var map_StatusDetails = map[string]string{
"": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
"name": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
"kind": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"causes": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
"retryAfterSeconds": "If specified, the time in seconds before the operation should be retried.",
}
func (StatusDetails) SwaggerDoc() map[string]string {
return map_StatusDetails
}
var map_TCPSocketAction = map[string]string{
"": "TCPSocketAction describes an action based on opening a socket",
"port": "Number or name of the port to access on the container. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.",
......@@ -1387,16 +1340,6 @@ func (ThirdPartyResourceList) SwaggerDoc() map[string]string {
return map_ThirdPartyResourceList
}
var map_TypeMeta = map[string]string{
"": "TypeMeta describes an individual object in an API response or request with strings representing the type of the object and its API schema version. Structures that are versioned or persisted should inline TypeMeta.",
"kind": "A string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
"apiVersion": "APIVersion defines the version of the schema of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources",
}
func (TypeMeta) SwaggerDoc() map[string]string {
return map_TypeMeta
}
var map_Volume = map[string]string{
"": "Volume represents a named volume in a pod that may be accessed by any container in the pod.",
"name": "Volume's name. Must be a DNS_LABEL and unique within the pod. More info: http://releases.k8s.io/HEAD/docs/user-guide/identifiers.md#names",
......
......@@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
)
......@@ -35,7 +36,7 @@ func TestResourceVersioner(t *testing.T) {
t.Errorf("unexpected version %v", version)
}
daemonSetList := experimental.DaemonSetList{ListMeta: api.ListMeta{ResourceVersion: "10"}}
daemonSetList := experimental.DaemonSetList{ListMeta: unversioned.ListMeta{ResourceVersion: "10"}}
version, err = accessor.ResourceVersion(&daemonSetList)
if err != nil {
t.Fatalf("unexpected error: %v", err)
......
......@@ -31,6 +31,7 @@ package experimental
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util"
)
......@@ -51,7 +52,7 @@ type ScaleStatus struct {
// Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
type Scale struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
api.ObjectMeta `json:"metadata,omitempty"`
......@@ -64,7 +65,7 @@ type Scale struct {
// Dummy definition
type ReplicationControllerDummy struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
}
// SubresourceReference contains enough information to let you inspect or modify the referred subresource.
......@@ -122,8 +123,8 @@ type HorizontalPodAutoscalerStatus struct {
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
type HorizontalPodAutoscaler struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behaviour of autoscaler. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status.
Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty"`
......@@ -134,8 +135,8 @@ type HorizontalPodAutoscaler struct {
// HorizontalPodAutoscaler is a collection of pod autoscalers.
type HorizontalPodAutoscalerList struct {
api.TypeMeta `json:",inline"`
api.ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of horizontal pod autoscalers.
Items []HorizontalPodAutoscaler `json:"items"`
......@@ -144,7 +145,7 @@ type HorizontalPodAutoscalerList struct {
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api.
type ThirdPartyResource struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata
api.ObjectMeta `json:"metadata,omitempty"`
......@@ -157,10 +158,10 @@ type ThirdPartyResource struct {
}
type ThirdPartyResourceList struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
api.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of horizontal pod autoscalers.
Items []ThirdPartyResource `json:"items"`
......@@ -177,7 +178,7 @@ type APIVersion struct {
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
type ThirdPartyResourceData struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata.
api.ObjectMeta `json:"metadata,omitempty"`
......@@ -186,8 +187,8 @@ type ThirdPartyResourceData struct {
}
type Deployment struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
// Specification of the desired behavior of the Deployment.
Spec DeploymentSpec `json:"spec,omitempty"`
......@@ -286,8 +287,8 @@ type DeploymentStatus struct {
}
type DeploymentList struct {
api.TypeMeta `json:",inline"`
api.ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of deployments.
Items []Deployment `json:"items"`
......@@ -326,7 +327,7 @@ type DaemonSetStatus struct {
// DaemonSet represents the configuration of a daemon set.
type DaemonSet struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
api.ObjectMeta `json:"metadata,omitempty"`
......@@ -345,27 +346,27 @@ type DaemonSet struct {
// DaemonSetList is a collection of daemon sets.
type DaemonSetList struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
api.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of daemon sets.
Items []DaemonSet `json:"items"`
}
type ThirdPartyResourceDataList struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
api.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of third party objects
Items []ThirdPartyResourceData `json:"items"`
}
// Job represents the configuration of a single job.
type Job struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
api.ObjectMeta `json:"metadata,omitempty"`
......@@ -381,10 +382,10 @@ type Job struct {
// JobList is a collection of jobs.
type JobList struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
api.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of Job.
Items []Job `json:"items"`
......
......@@ -18,6 +18,7 @@ package v1
import (
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/util"
)
......@@ -39,7 +40,7 @@ type ScaleStatus struct {
// Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
type Scale struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -52,7 +53,7 @@ type Scale struct {
// Dummy definition
type ReplicationControllerDummy struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
}
// SubresourceReference contains enough information to let you inspect or modify the referred subresource.
......@@ -111,7 +112,7 @@ type HorizontalPodAutoscalerStatus struct {
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
type HorizontalPodAutoscaler struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -124,9 +125,9 @@ type HorizontalPodAutoscaler struct {
// HorizontalPodAutoscalerList is a list of HorizontalPodAutoscalers.
type HorizontalPodAutoscalerList struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
v1.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of HorizontalPodAutoscalers.
Items []HorizontalPodAutoscaler `json:"items"`
......@@ -135,7 +136,7 @@ type HorizontalPodAutoscalerList struct {
// A ThirdPartyResource is a generic representation of a resource, it is used by add-ons and plugins to add new resource
// types to the API. It consists of one or more Versions of the api.
type ThirdPartyResource struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -149,10 +150,10 @@ type ThirdPartyResource struct {
// ThirdPartyResourceList is a list of ThirdPartyResources.
type ThirdPartyResourceList struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
v1.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of ThirdPartyResources.
Items []ThirdPartyResource `json:"items"`
......@@ -169,7 +170,7 @@ type APIVersion struct {
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
type ThirdPartyResourceData struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata.
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -179,7 +180,7 @@ type ThirdPartyResourceData struct {
// Deployment enables declarative updates for Pods and ReplicationControllers.
type Deployment struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object metadata.
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -284,9 +285,9 @@ type DeploymentStatus struct {
// DeploymentList is a list of Deployments.
type DeploymentList struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
v1.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of Deployments.
Items []Deployment `json:"items"`
......@@ -325,7 +326,7 @@ type DaemonSetStatus struct {
// DaemonSet represents the configuration of a daemon set.
type DaemonSet struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -344,10 +345,10 @@ type DaemonSet struct {
// DaemonSetList is a collection of daemon sets.
type DaemonSetList struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of daemon sets.
Items []DaemonSet `json:"items"`
......@@ -355,10 +356,10 @@ type DaemonSetList struct {
// ThirdPartyResrouceDataList is a list of ThirdPartyResourceData.
type ThirdPartyResourceDataList struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of ThirdpartyResourceData.
Items []ThirdPartyResourceData `json:"items"`
......@@ -366,7 +367,7 @@ type ThirdPartyResourceDataList struct {
// Job represents the configuration of a single job.
type Job struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ObjectMeta `json:"metadata,omitempty"`
......@@ -382,10 +383,10 @@ type Job struct {
// JobList is a collection of jobs.
type JobList struct {
v1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
v1.ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of Job.
Items []Job `json:"items"`
......
......@@ -21,6 +21,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"github.com/emicklei/go-restful"
)
......@@ -43,7 +44,7 @@ func TestScopeNamingGenerateLink(t *testing.T) {
Name: "foo",
Namespace: "other",
},
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Service",
},
}
......
......@@ -37,6 +37,7 @@ import (
apierrs "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
......@@ -94,26 +95,26 @@ func newMapper() *meta.DefaultRESTMapper {
func addTestTypes() {
type ListOptions struct {
runtime.Object
api.TypeMeta `json:",inline"`
LabelSelector string `json:"labels,omitempty"`
FieldSelector string `json:"fields,omitempty"`
Watch bool `json:"watch,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
unversioned.TypeMeta `json:",inline"`
LabelSelector string `json:"labels,omitempty"`
FieldSelector string `json:"fields,omitempty"`
Watch bool `json:"watch,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
}
api.Scheme.AddKnownTypes(testVersion, &Simple{}, &SimpleList{}, &api.Status{}, &ListOptions{}, &api.DeleteOptions{}, &SimpleGetOptions{}, &SimpleRoot{})
api.Scheme.AddKnownTypes(testVersion, &Simple{}, &SimpleList{}, &unversioned.Status{}, &ListOptions{}, &api.DeleteOptions{}, &SimpleGetOptions{}, &SimpleRoot{})
api.Scheme.AddKnownTypes(testVersion, &api.Pod{})
}
func addNewTestTypes() {
type ListOptions struct {
runtime.Object
api.TypeMeta `json:",inline"`
LabelSelector string `json:"labelSelector,omitempty"`
FieldSelector string `json:"fieldSelector,omitempty"`
Watch bool `json:"watch,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
unversioned.TypeMeta `json:",inline"`
LabelSelector string `json:"labelSelector,omitempty"`
FieldSelector string `json:"fieldSelector,omitempty"`
Watch bool `json:"watch,omitempty"`
ResourceVersion string `json:"resourceVersion,omitempty"`
}
api.Scheme.AddKnownTypes(newVersion, &Simple{}, &SimpleList{}, &api.Status{}, &ListOptions{}, &api.DeleteOptions{}, &SimpleGetOptions{}, &SimpleRoot{})
api.Scheme.AddKnownTypes(newVersion, &Simple{}, &SimpleList{}, &unversioned.Status{}, &ListOptions{}, &api.DeleteOptions{}, &SimpleGetOptions{}, &SimpleRoot{})
}
func init() {
......@@ -121,7 +122,7 @@ func init() {
// api.Status is returned in errors
// "internal" version
api.Scheme.AddKnownTypes("", &Simple{}, &SimpleList{}, &api.Status{}, &api.ListOptions{}, &SimpleGetOptions{}, &SimpleRoot{})
api.Scheme.AddKnownTypes("", &Simple{}, &SimpleList{}, &unversioned.Status{}, &api.ListOptions{}, &SimpleGetOptions{}, &SimpleRoot{})
addTestTypes()
addNewTestTypes()
......@@ -228,28 +229,28 @@ func handleInternal(legacy bool, storage map[string]rest.Storage, admissionContr
}
type Simple struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata"`
Other string `json:"other,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata"`
Other string `json:"other,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
func (*Simple) IsAnAPIObject() {}
type SimpleRoot struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata"`
Other string `json:"other,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata"`
Other string `json:"other,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
}
func (*SimpleRoot) IsAnAPIObject() {}
type SimpleGetOptions struct {
api.TypeMeta `json:",inline"`
Param1 string `json:"param1"`
Param2 string `json:"param2"`
Path string `json:"atAPath"`
unversioned.TypeMeta `json:",inline"`
Param1 string `json:"param1"`
Param2 string `json:"param2"`
Path string `json:"atAPath"`
}
func (SimpleGetOptions) SwaggerDoc() map[string]string {
......@@ -262,9 +263,9 @@ func (SimpleGetOptions) SwaggerDoc() map[string]string {
func (*SimpleGetOptions) IsAnAPIObject() {}
type SimpleList struct {
api.TypeMeta `json:",inline"`
api.ListMeta `json:"metadata,inline"`
Items []Simple `json:"items,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,inline"`
Items []Simple `json:"items,omitempty"`
}
func (*SimpleList) IsAnAPIObject() {}
......@@ -397,7 +398,7 @@ func (storage *SimpleRESTStorage) Delete(ctx api.Context, id string, options *ap
if err := storage.errors["delete"]; err != nil {
return nil, err
}
var obj runtime.Object = &api.Status{Status: api.StatusSuccess}
var obj runtime.Object = &unversioned.Status{Status: unversioned.StatusSuccess}
var err error
if storage.injectedFunction != nil {
obj, err = storage.injectedFunction(&Simple{ObjectMeta: api.ObjectMeta{Name: id}})
......@@ -2418,7 +2419,7 @@ func TestCreateInvokesAdmissionControl(t *testing.T) {
}
}
func expectApiStatus(t *testing.T, method, url string, data []byte, code int) *api.Status {
func expectApiStatus(t *testing.T, method, url string, data []byte, code int) *unversioned.Status {
client := http.Client{}
request, err := http.NewRequest(method, url, bytes.NewBuffer(data))
if err != nil {
......@@ -2430,7 +2431,7 @@ func expectApiStatus(t *testing.T, method, url string, data []byte, code int) *a
t.Fatalf("unexpected error on %s %s: %v", method, url, err)
return nil
}
var status api.Status
var status unversioned.Status
_, err = extractBody(response, &status)
if err != nil {
t.Fatalf("unexpected error on %s %s: %v", method, url, err)
......@@ -2453,7 +2454,7 @@ func TestDelayReturnsError(t *testing.T) {
defer server.Close()
status := expectApiStatus(t, "DELETE", fmt.Sprintf("%s/api/version/namespaces/default/foo/bar", server.URL), nil, http.StatusConflict)
if status.Status != api.StatusFailure || status.Message == "" || status.Details == nil || status.Reason != api.StatusReasonAlreadyExists {
if status.Status != unversioned.StatusFailure || status.Message == "" || status.Details == nil || status.Reason != unversioned.StatusReasonAlreadyExists {
t.Errorf("Unexpected status %#v", status)
}
}
......@@ -2470,7 +2471,7 @@ func TestWriteJSONDecodeError(t *testing.T) {
}))
defer server.Close()
status := expectApiStatus(t, "GET", server.URL, nil, http.StatusInternalServerError)
if status.Reason != api.StatusReasonUnknown {
if status.Reason != unversioned.StatusReasonUnknown {
t.Errorf("unexpected reason %#v", status)
}
if !strings.Contains(status.Message, "type apiserver.UnregisteredAPIObject is not registered") {
......@@ -2524,7 +2525,7 @@ func TestCreateTimeout(t *testing.T) {
t.Errorf("unexpected error: %v", err)
}
itemOut := expectApiStatus(t, "POST", server.URL+"/api/version/namespaces/default/foo?timeout=4ms", data, apierrs.StatusServerTimeout)
if itemOut.Status != api.StatusFailure || itemOut.Reason != api.StatusReasonTimeout {
if itemOut.Status != unversioned.StatusFailure || itemOut.Reason != unversioned.StatusReasonTimeout {
t.Errorf("Unexpected status %#v", itemOut)
}
}
......
......@@ -20,29 +20,29 @@ import (
"fmt"
"net/http"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
etcdstorage "k8s.io/kubernetes/pkg/storage/etcd"
"k8s.io/kubernetes/pkg/util"
)
// statusError is an object that can be converted into an api.Status
// statusError is an object that can be converted into an unversioned.Status
type statusError interface {
Status() api.Status
Status() unversioned.Status
}
// errToAPIStatus converts an error to an api.Status object.
func errToAPIStatus(err error) *api.Status {
// errToAPIStatus converts an error to an unversioned.Status object.
func errToAPIStatus(err error) *unversioned.Status {
switch t := err.(type) {
case statusError:
status := t.Status()
if len(status.Status) == 0 {
status.Status = api.StatusFailure
status.Status = unversioned.StatusFailure
}
if status.Code == 0 {
switch status.Status {
case api.StatusSuccess:
case unversioned.StatusSuccess:
status.Code = http.StatusOK
case api.StatusFailure:
case unversioned.StatusFailure:
status.Code = http.StatusInternalServerError
}
}
......@@ -59,11 +59,11 @@ func errToAPIStatus(err error) *api.Status {
// by REST storage - these typically indicate programmer
// error by not using pkg/api/errors, or unexpected failure
// cases.
util.HandleError(fmt.Errorf("apiserver received an error that is not an api.Status: %v", err))
return &api.Status{
Status: api.StatusFailure,
util.HandleError(fmt.Errorf("apiserver received an error that is not an unversioned.Status: %v", err))
return &unversioned.Status{
Status: unversioned.StatusFailure,
Code: status,
Reason: api.StatusReasonUnknown,
Reason: unversioned.StatusReasonUnknown,
Message: err.Error(),
}
}
......
......@@ -22,38 +22,38 @@ import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
)
func TestErrorsToAPIStatus(t *testing.T) {
cases := map[error]api.Status{
cases := map[error]unversioned.Status{
errors.NewNotFound("foo", "bar"): {
Status: api.StatusFailure,
Status: unversioned.StatusFailure,
Code: http.StatusNotFound,
Reason: api.StatusReasonNotFound,
Reason: unversioned.StatusReasonNotFound,
Message: "foo \"bar\" not found",
Details: &api.StatusDetails{
Details: &unversioned.StatusDetails{
Kind: "foo",
Name: "bar",
},
},
errors.NewAlreadyExists("foo", "bar"): {
Status: api.StatusFailure,
Status: unversioned.StatusFailure,
Code: http.StatusConflict,
Reason: "AlreadyExists",
Message: "foo \"bar\" already exists",
Details: &api.StatusDetails{
Details: &unversioned.StatusDetails{
Kind: "foo",
Name: "bar",
},
},
errors.NewConflict("foo", "bar", stderrs.New("failure")): {
Status: api.StatusFailure,
Status: unversioned.StatusFailure,
Code: http.StatusConflict,
Reason: "Conflict",
Message: "foo \"bar\" cannot be updated: failure",
Details: &api.StatusDetails{
Details: &unversioned.StatusDetails{
Kind: "foo",
Name: "bar",
},
......
......@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
......@@ -321,7 +322,7 @@ func createHandler(r rest.NamedCreater, scope RequestScope, typer runtime.Object
result, err := finishRequest(timeout, func() (runtime.Object, error) {
out, err := r.Create(ctx, name, obj)
if status, ok := out.(*api.Status); ok && err == nil && status.Code == 0 {
if status, ok := out.(*unversioned.Status); ok && err == nil && status.Code == 0 {
status.Code = http.StatusCreated
}
return out, err
......@@ -567,17 +568,17 @@ func DeleteResource(r rest.GracefulDeleter, checkBody bool, scope RequestScope,
// if the rest.Deleter returns a nil object, fill out a status. Callers may return a valid
// object with the response.
if result == nil {
result = &api.Status{
Status: api.StatusSuccess,
result = &unversioned.Status{
Status: unversioned.StatusSuccess,
Code: http.StatusOK,
Details: &api.StatusDetails{
Details: &unversioned.StatusDetails{
Name: name,
Kind: scope.Kind,
},
}
} else {
// when a non-status response is returned, set the self link
if _, ok := result.(*api.Status); !ok {
if _, ok := result.(*unversioned.Status); !ok {
if err := setSelfLink(result, req, scope.Namer); err != nil {
errorJSON(err, scope.Codec, w)
return
......@@ -636,7 +637,7 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object,
select {
case result = <-ch:
if status, ok := result.(*api.Status); ok {
if status, ok := result.(*unversioned.Status); ok {
return nil, errors.FromObject(status)
}
return result, nil
......
......@@ -29,6 +29,7 @@ import (
"golang.org/x/net/websocket"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
......@@ -361,7 +362,7 @@ func TestWatchHTTPTimeout(t *testing.T) {
req, _ := http.NewRequest("GET", dest.String(), nil)
client := http.Client{}
resp, err := client.Do(req)
watcher.Add(&Simple{TypeMeta: api.TypeMeta{APIVersion: newVersion}})
watcher.Add(&Simple{TypeMeta: unversioned.TypeMeta{APIVersion: newVersion}})
// Make sure we can actually watch an endpoint
decoder := json.NewDecoder(resp.Body)
......
......@@ -24,6 +24,7 @@ import (
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/watch"
......@@ -48,7 +49,7 @@ func TestCloseWatchChannelOnError(t *testing.T) {
return fw, nil
},
ListFunc: func() (runtime.Object, error) {
return &api.PodList{ListMeta: api.ListMeta{ResourceVersion: "1"}}, nil
return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}, nil
},
}
go r.ListAndWatch(util.NeverStop)
......@@ -74,7 +75,7 @@ func TestRunUntil(t *testing.T) {
return fw, nil
},
ListFunc: func() (runtime.Object, error) {
return &api.PodList{ListMeta: api.ListMeta{ResourceVersion: "1"}}, nil
return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}, nil
},
}
r.RunUntil(stopCh)
......@@ -234,7 +235,7 @@ func TestReflector_ListAndWatch(t *testing.T) {
return fw, nil
},
ListFunc: func() (runtime.Object, error) {
return &api.PodList{ListMeta: api.ListMeta{ResourceVersion: "1"}}, nil
return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}, nil
},
}
s := NewFIFO(MetaNamespaceKeyFunc)
......@@ -277,7 +278,7 @@ func TestReflector_ListAndWatchWithErrors(t *testing.T) {
return &api.Pod{ObjectMeta: api.ObjectMeta{Name: id, ResourceVersion: rv}}
}
mkList := func(rv string, pods ...*api.Pod) *api.PodList {
list := &api.PodList{ListMeta: api.ListMeta{ResourceVersion: rv}}
list := &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: rv}}
for _, pod := range pods {
list.Items = append(list.Items, *pod)
}
......
......@@ -24,6 +24,7 @@ import (
"strings"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/version"
)
......@@ -117,7 +118,7 @@ type VersionInterface interface {
// APIStatus is exposed by errors that can be converted to an api.Status object
// for finer grained details.
type APIStatus interface {
Status() api.Status
Status() unversioned.Status
}
// Client is the implementation of a Kubernetes client.
......
......@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
)
......@@ -37,7 +38,7 @@ func TestListNodes(t *testing.T) {
Method: "GET",
Path: testapi.Default.ResourcePath(getNodesResourceName(), "", ""),
},
Response: Response{StatusCode: 200, Body: &api.NodeList{ListMeta: api.ListMeta{ResourceVersion: "1"}}},
Response: Response{StatusCode: 200, Body: &api.NodeList{ListMeta: unversioned.ListMeta{ResourceVersion: "1"}}},
}
response, err := c.Setup(t).Nodes().List(labels.Everything(), fields.Everything())
c.Validate(t, response, err)
......
......@@ -33,6 +33,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/metrics"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -757,7 +758,7 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu
// Did the server give us a status response?
isStatusResponse := false
var status api.Status
var status unversioned.Status
if err := r.codec.DecodeInto(body, &status); err == nil && status.Status != "" {
isStatusResponse = true
}
......@@ -774,7 +775,7 @@ func (r *Request) transformResponse(resp *http.Response, req *http.Request) Resu
// If the server gave us a status back, look at what it was.
success := resp.StatusCode >= http.StatusOK && resp.StatusCode <= http.StatusPartialContent
if isStatusResponse && (status.Status != api.StatusSuccess && !success) {
if isStatusResponse && (status.Status != unversioned.StatusSuccess && !success) {
// "Failed" requests are clearly just an error and it makes sense to return them as such.
return Result{err: errors.FromObject(&status)}
}
......
......@@ -35,6 +35,7 @@ import (
"k8s.io/kubernetes/pkg/api"
apierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
......@@ -436,9 +437,9 @@ func TestRequestWatch(t *testing.T) {
client: clientFunc(func(req *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: http.StatusUnauthorized,
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Status{
Status: api.StatusFailure,
Reason: api.StatusReasonUnauthorized,
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &unversioned.Status{
Status: unversioned.StatusFailure,
Reason: unversioned.StatusReasonUnauthorized,
})))),
}, nil
}),
......@@ -536,9 +537,9 @@ func TestRequestStream(t *testing.T) {
client: clientFunc(func(req *http.Request) (*http.Response, error) {
return &http.Response{
StatusCode: http.StatusUnauthorized,
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Status{
Status: api.StatusFailure,
Reason: api.StatusReasonUnauthorized,
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &unversioned.Status{
Status: unversioned.StatusFailure,
Reason: unversioned.StatusReasonUnauthorized,
})))),
}, nil
}),
......
......@@ -22,8 +22,8 @@ import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
)
......@@ -107,7 +107,7 @@ func TestValidatesHostParameter(t *testing.T) {
}
func TestDoRequestBearer(t *testing.T) {
status := &api.Status{Status: api.StatusFailure}
status := &unversioned.Status{Status: unversioned.StatusFailure}
expectedBody, _ := testapi.Default.Codec().Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 400,
......@@ -136,7 +136,7 @@ func TestDoRequestBearer(t *testing.T) {
}
func TestDoRequestWithoutPassword(t *testing.T) {
status := &api.Status{Status: api.StatusFailure}
status := &unversioned.Status{Status: unversioned.StatusFailure}
expectedBody, _ := testapi.Default.Codec().Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 400,
......@@ -175,7 +175,7 @@ func TestDoRequestWithoutPassword(t *testing.T) {
}
func TestDoRequestSuccess(t *testing.T) {
status := &api.Status{Status: api.StatusSuccess}
status := &unversioned.Status{Status: unversioned.StatusSuccess}
expectedBody, _ := testapi.Default.Codec().Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 200,
......@@ -212,12 +212,12 @@ func TestDoRequestSuccess(t *testing.T) {
}
func TestDoRequestFailed(t *testing.T) {
status := &api.Status{
status := &unversioned.Status{
Code: http.StatusNotFound,
Status: api.StatusFailure,
Reason: api.StatusReasonNotFound,
Status: unversioned.StatusFailure,
Reason: unversioned.StatusReasonNotFound,
Message: " \"\" not found",
Details: &api.StatusDetails{},
Details: &unversioned.StatusDetails{},
}
expectedBody, _ := testapi.Default.Codec().Encode(status)
fakeHandler := util.FakeHandler{
......@@ -250,7 +250,7 @@ func TestDoRequestFailed(t *testing.T) {
}
func TestDoRequestCreated(t *testing.T) {
status := &api.Status{Status: api.StatusSuccess}
status := &unversioned.Status{Status: unversioned.StatusSuccess}
expectedBody, _ := testapi.Default.Codec().Encode(status)
fakeHandler := util.FakeHandler{
StatusCode: 201,
......
......@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/yaml"
......@@ -183,11 +184,11 @@ func (o objects) Kind(kind, name string) (runtime.Object, error) {
}
o.last[kind] = index + 1
if status, ok := out.(*api.Status); ok {
if status, ok := out.(*unversioned.Status); ok {
if status.Details != nil {
status.Details.Kind = kind
}
if status.Status != api.StatusSuccess {
if status.Status != unversioned.StatusSuccess {
return nilValue, &errors.StatusError{ErrStatus: *status}
}
}
......@@ -220,7 +221,7 @@ func (o objects) Add(obj runtime.Object) error {
}
}
default:
if status, ok := obj.(*api.Status); ok && status.Details != nil {
if status, ok := obj.(*unversioned.Status); ok && status.Details != nil {
kind = status.Details.Kind
}
o.types[kind] = append(o.types[kind], obj)
......
......@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/client/record"
client "k8s.io/kubernetes/pkg/client/unversioned"
......@@ -49,7 +50,7 @@ func NewFakeControllerExpectationsLookup(ttl time.Duration) (*ControllerExpectat
func newReplicationController(replicas int) *api.ReplicationController {
rc := &api.ReplicationController{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
UID: util.NewUUID(),
Name: "foobar",
......
......@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned"
......@@ -81,7 +82,7 @@ func (f *FakePodControl) clear() {
func newDaemonSet(name string) *experimental.DaemonSet {
return &experimental.DaemonSet{
TypeMeta: api.TypeMeta{APIVersion: testapi.Experimental.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Experimental.Version()},
ObjectMeta: api.ObjectMeta{
Name: name,
Namespace: api.NamespaceDefault,
......@@ -110,7 +111,7 @@ func newDaemonSet(name string) *experimental.DaemonSet {
func newNode(name string, label map[string]string) *api.Node {
return &api.Node{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
Name: name,
Labels: label,
......@@ -127,7 +128,7 @@ func addNodes(nodeStore cache.Store, startIndex, numNodes int, label map[string]
func newPod(podName string, nodeName string, label map[string]string) *api.Pod {
pod := &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
GenerateName: podName,
Labels: label,
......
......@@ -26,6 +26,7 @@ import (
endptspkg "k8s.io/kubernetes/pkg/api/endpoints"
_ "k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/runtime"
......@@ -35,7 +36,7 @@ import (
func addPods(store cache.Store, namespace string, nPods int, nPorts int, nNotReady int) {
for i := 0; i < nPods+nNotReady; i++ {
p := &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
Namespace: namespace,
Name: fmt.Sprintf("pod%d", i),
......@@ -202,7 +203,7 @@ func TestCheckLeftoverEndpoints(t *testing.T) {
// below.
testServer, _ := makeTestServer(t, api.NamespaceAll,
serverResponse{http.StatusOK, &api.EndpointsList{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "1",
},
Items: []api.Endpoints{{
......
......@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
......@@ -100,7 +101,7 @@ func getKey(rc *api.ReplicationController, t *testing.T) string {
func newReplicationController(replicas int) *api.ReplicationController {
rc := &api.ReplicationController{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
ObjectMeta: api.ObjectMeta{
UID: util.NewUUID(),
Name: "foobar",
......
......@@ -23,6 +23,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
......@@ -281,7 +282,7 @@ func TestRunExposeServiceFromFile(t *testing.T) {
},
input: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", ResourceVersion: "12"},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1"},
TypeMeta: unversioned.TypeMeta{Kind: "Service", APIVersion: "v1"},
Spec: api.ServiceSpec{
Selector: map[string]string{"app": "go"},
},
......@@ -289,7 +290,7 @@ func TestRunExposeServiceFromFile(t *testing.T) {
flags: map[string]string{"selector": "func=stream", "protocol": "UDP", "port": "14", "name": "foo", "labels": "svc=test"},
output: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", ResourceVersion: "12", Labels: map[string]string{"svc": "test"}},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1"},
TypeMeta: unversioned.TypeMeta{Kind: "Service", APIVersion: "v1"},
Spec: api.ServiceSpec{
Ports: []api.ServicePort{
{
......
......@@ -29,6 +29,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/runtime"
......@@ -40,7 +41,7 @@ import (
func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList) {
grace := int64(30)
pods := &api.PodList{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "15",
},
Items: []api.Pod{
......@@ -63,7 +64,7 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList)
},
}
svc := &api.ServiceList{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "16",
},
Items: []api.Service{
......@@ -77,7 +78,7 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList)
},
}
rc := &api.ReplicationControllerList{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "17",
},
Items: []api.ReplicationController{
......
......@@ -29,6 +29,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
......@@ -127,7 +128,7 @@ func TestLabelsForObject(t *testing.T) {
name: "successful re-use of labels",
object: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", Labels: map[string]string{"svc": "test"}},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1"},
TypeMeta: unversioned.TypeMeta{Kind: "Service", APIVersion: "v1"},
},
expected: "svc=test",
err: nil,
......@@ -136,7 +137,7 @@ func TestLabelsForObject(t *testing.T) {
name: "empty labels",
object: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", Labels: map[string]string{}},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1"},
TypeMeta: unversioned.TypeMeta{Kind: "Service", APIVersion: "v1"},
},
expected: "",
err: nil,
......@@ -145,7 +146,7 @@ func TestLabelsForObject(t *testing.T) {
name: "nil labels",
object: &api.Service{
ObjectMeta: api.ObjectMeta{Name: "zen", Namespace: "test", Labels: nil},
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1"},
TypeMeta: unversioned.TypeMeta{Kind: "Service", APIVersion: "v1"},
},
expected: "",
err: nil,
......
......@@ -29,9 +29,9 @@ import (
"time"
"github.com/evanphx/json-patch"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
"k8s.io/kubernetes/pkg/kubectl/resource"
......@@ -122,7 +122,7 @@ func checkErr(err error, handleErr func(string)) {
handleErr(msg)
}
func statusCausesToAggrError(scs []api.StatusCause) utilerrors.Aggregate {
func statusCausesToAggrError(scs []unversioned.StatusCause) utilerrors.Aggregate {
errs := make([]error, len(scs))
for i, sc := range scs {
errs[i] = fmt.Errorf("%s: %s", sc.Field, sc.Message)
......
......@@ -21,6 +21,7 @@ import (
"reflect"
"testing"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/runtime"
)
......@@ -251,7 +252,7 @@ bar
FieldSpec: "{.apiVersion}",
},
},
obj: &v1.Pod{ObjectMeta: v1.ObjectMeta{Name: "foo"}, TypeMeta: v1.TypeMeta{APIVersion: "baz"}},
obj: &v1.Pod{ObjectMeta: v1.ObjectMeta{Name: "foo"}, TypeMeta: unversioned.TypeMeta{APIVersion: "baz"}},
expectedOutput: `NAME API_VERSION
foo baz
`,
......
......@@ -32,6 +32,7 @@ import (
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/errors"
......@@ -84,7 +85,7 @@ func fakeClientWith(testName string, t *testing.T, data map[string]string) Clien
func testData() (*api.PodList, *api.ServiceList) {
grace := int64(30)
pods := &api.PodList{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "15",
},
Items: []api.Pod{
......@@ -107,7 +108,7 @@ func testData() (*api.PodList, *api.ServiceList) {
},
}
svc := &api.ServiceList{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: "16",
},
Items: []api.Service{
......
......@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
......@@ -60,14 +61,14 @@ func TestHelperDelete(t *testing.T) {
{
Resp: &http.Response{
StatusCode: http.StatusNotFound,
Body: objBody(&api.Status{Status: api.StatusFailure}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
},
Err: true,
},
{
Resp: &http.Response{
StatusCode: http.StatusOK,
Body: objBody(&api.Status{Status: api.StatusSuccess}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess}),
},
Req: func(req *http.Request) bool {
if req.Method != "DELETE" {
......@@ -147,14 +148,14 @@ func TestHelperCreate(t *testing.T) {
{
Resp: &http.Response{
StatusCode: http.StatusNotFound,
Body: objBody(&api.Status{Status: api.StatusFailure}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
},
Err: true,
},
{
Resp: &http.Response{
StatusCode: http.StatusOK,
Body: objBody(&api.Status{Status: api.StatusSuccess}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess}),
},
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
ExpectObject: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
......@@ -164,7 +165,7 @@ func TestHelperCreate(t *testing.T) {
Modify: false,
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
ExpectObject: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
Resp: &http.Response{StatusCode: http.StatusOK, Body: objBody(&api.Status{Status: api.StatusSuccess})},
Resp: &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})},
Req: expectPost,
},
{
......@@ -178,7 +179,7 @@ func TestHelperCreate(t *testing.T) {
TerminationGracePeriodSeconds: &grace,
},
},
Resp: &http.Response{StatusCode: http.StatusOK, Body: objBody(&api.Status{Status: api.StatusSuccess})},
Resp: &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})},
Req: expectPost,
},
}
......@@ -241,7 +242,7 @@ func TestHelperGet(t *testing.T) {
{
Resp: &http.Response{
StatusCode: http.StatusNotFound,
Body: objBody(&api.Status{Status: api.StatusFailure}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
},
Err: true,
},
......@@ -308,7 +309,7 @@ func TestHelperList(t *testing.T) {
{
Resp: &http.Response{
StatusCode: http.StatusNotFound,
Body: objBody(&api.Status{Status: api.StatusFailure}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
},
Err: true,
},
......@@ -403,7 +404,7 @@ func TestHelperReplace(t *testing.T) {
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
Resp: &http.Response{
StatusCode: http.StatusNotFound,
Body: objBody(&api.Status{Status: api.StatusFailure}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
},
Err: true,
},
......@@ -412,7 +413,7 @@ func TestHelperReplace(t *testing.T) {
ExpectObject: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
Resp: &http.Response{
StatusCode: http.StatusOK,
Body: objBody(&api.Status{Status: api.StatusSuccess}),
Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess}),
},
Req: expectPut,
},
......@@ -429,7 +430,7 @@ func TestHelperReplace(t *testing.T) {
Overwrite: true,
RespFunc: func(req *http.Request) (*http.Response, error) {
if req.Method == "PUT" {
return &http.Response{StatusCode: http.StatusOK, Body: objBody(&api.Status{Status: api.StatusSuccess})}, nil
return &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})}, nil
}
return &http.Response{StatusCode: http.StatusOK, Body: objBody(&api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}})}, nil
},
......@@ -438,7 +439,7 @@ func TestHelperReplace(t *testing.T) {
{
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
ExpectObject: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
Resp: &http.Response{StatusCode: http.StatusOK, Body: objBody(&api.Status{Status: api.StatusSuccess})},
Resp: &http.Response{StatusCode: http.StatusOK, Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess})},
Req: expectPut,
},
}
......
......@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/errors"
"k8s.io/kubernetes/pkg/util/sets"
......@@ -147,7 +148,7 @@ func (r *Result) Object() (runtime.Object, error) {
version = versions.List()[0]
}
return &api.List{
ListMeta: api.ListMeta{
ListMeta: unversioned.ListMeta{
ResourceVersion: version,
},
Items: objects,
......
......@@ -35,6 +35,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/conversion"
......@@ -213,7 +214,7 @@ func (p *NamePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
if err != nil {
return err
}
tpmeta := api.TypeMeta{
tpmeta := unversioned.TypeMeta{
APIVersion: version,
Kind: kind,
}
......
......@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/runtime"
......@@ -38,12 +39,12 @@ import (
)
type testStruct struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
Key string `json:"Key"`
Map map[string]int `json:"Map"`
StringList []string `json:"StringList"`
IntList []int `json:"IntList"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty"`
Key string `json:"Key"`
Map map[string]int `json:"Map"`
StringList []string `json:"StringList"`
IntList []int `json:"IntList"`
}
func (ts *testStruct) IsAnAPIObject() {}
......@@ -292,7 +293,7 @@ func TestNamePrinter(t *testing.T) {
}{
"singleObject": {
&api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......@@ -302,7 +303,7 @@ func TestNamePrinter(t *testing.T) {
"pod/foo\n"},
"List": {
&v1.List{
TypeMeta: v1.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "List",
},
Items: []runtime.RawExtension{
......
......@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/registered"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/securitycontext"
"github.com/ghodss/yaml"
......@@ -33,7 +34,7 @@ func noDefault(*api.Pod) error { return nil }
func TestDecodeSinglePod(t *testing.T) {
grace := int64(30)
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
APIVersion: "",
},
ObjectMeta: api.ObjectMeta{
......@@ -95,7 +96,7 @@ func TestDecodeSinglePod(t *testing.T) {
func TestDecodePodList(t *testing.T) {
grace := int64(30)
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
APIVersion: "",
},
ObjectMeta: api.ObjectMeta{
......
......@@ -24,6 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/kubelet"
"k8s.io/kubernetes/pkg/runtime"
......@@ -78,7 +79,7 @@ func TestReadPodsFromFile(t *testing.T) {
{
desc: "Simple pod",
pod: &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: "",
},
......
......@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/kubelet"
"k8s.io/kubernetes/pkg/runtime"
......@@ -58,16 +59,16 @@ func TestExtractInvalidPods(t *testing.T) {
}{
{
desc: "No version",
pod: &api.Pod{TypeMeta: api.TypeMeta{APIVersion: ""}},
pod: &api.Pod{TypeMeta: unversioned.TypeMeta{APIVersion: ""}},
},
{
desc: "Invalid version",
pod: &api.Pod{TypeMeta: api.TypeMeta{APIVersion: "v1betta2"}},
pod: &api.Pod{TypeMeta: unversioned.TypeMeta{APIVersion: "v1betta2"}},
},
{
desc: "Invalid volume name",
pod: &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
Spec: api.PodSpec{
Volumes: []api.Volume{{Name: "_INVALID_"}},
},
......@@ -76,7 +77,7 @@ func TestExtractInvalidPods(t *testing.T) {
{
desc: "Duplicate volume names",
pod: &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
Spec: api.PodSpec{
Volumes: []api.Volume{{Name: "repeated"}, {Name: "repeated"}},
},
......@@ -85,7 +86,7 @@ func TestExtractInvalidPods(t *testing.T) {
{
desc: "Unspecified container name",
pod: &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
Spec: api.PodSpec{
Containers: []api.Container{{Name: ""}},
},
......@@ -94,7 +95,7 @@ func TestExtractInvalidPods(t *testing.T) {
{
desc: "Invalid container name",
pod: &api.Pod{
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
Spec: api.PodSpec{
Containers: []api.Container{{Name: "_INVALID_"}},
},
......@@ -132,7 +133,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
{
desc: "Single pod",
pods: &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: "",
},
......@@ -174,7 +175,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
{
desc: "Multiple pods",
pods: &api.PodList{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "PodList",
APIVersion: "",
},
......@@ -287,7 +288,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
func TestURLWithHeader(t *testing.T) {
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
APIVersion: testapi.Default.Version(),
Kind: "Pod",
},
......
......@@ -21,6 +21,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
)
func TestFieldPath(t *testing.T) {
......@@ -64,7 +65,7 @@ func TestFieldPath(t *testing.T) {
func TestGenerateContainerRef(t *testing.T) {
var (
okPod = api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: testapi.Default.Version(),
},
......
......@@ -65,7 +65,7 @@ import (
"strings"
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/kubelet/network"
kubeletTypes "k8s.io/kubernetes/pkg/kubelet/types"
utilexec "k8s.io/kubernetes/pkg/util/exec"
......@@ -154,7 +154,7 @@ func (plugin *execNetworkPlugin) Status(namespace string, name string, id kubele
return nil, nil
}
findVersion := struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
}{}
err = json.Unmarshal(out, &findVersion)
if err != nil {
......
......@@ -23,6 +23,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
kubeletTypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/util/errors"
......@@ -56,7 +57,7 @@ type NetworkPlugin interface {
// PodNetworkStatus stores the network status of a pod (currently just the primary IP address)
// This struct represents version "v1"
type PodNetworkStatus struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// IP is the primary ipv4/ipv6 address of the pod. Among other things it is the address that -
// - kube expects to be reachable across the cluster
......
......@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/api"
apierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/record"
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
"k8s.io/kubernetes/pkg/runtime"
......@@ -404,7 +405,7 @@ func TestRegisterExistingNodeWithApiserver(t *testing.T) {
client.AddReactor("create", "nodes", func(action testclient.Action) (bool, runtime.Object, error) {
// Return an error on create.
return true, &api.Node{}, &apierrors.StatusError{
ErrStatus: api.Status{Reason: api.StatusReasonAlreadyExists},
ErrStatus: unversioned.Status{Reason: unversioned.StatusReasonAlreadyExists},
}
})
client.AddReactor("get", "nodes", func(action testclient.Action) (bool, runtime.Object, error) {
......
......@@ -37,6 +37,7 @@ import (
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/apiserver"
......@@ -425,16 +426,16 @@ func TestGenerateSSHKey(t *testing.T) {
var versionsToTest = []string{"v1", "v3"}
type Foo struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
SomeField string `json:"someField"`
OtherField int `json:"otherField"`
}
type FooList struct {
api.TypeMeta `json:",inline"`
api.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"`
items []Foo `json:"items"`
}
......@@ -546,7 +547,7 @@ func testInstallThirdPartyAPIGetVersion(t *testing.T, version string) {
ObjectMeta: api.ObjectMeta{
Name: "test",
},
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Foo",
APIVersion: version,
},
......@@ -591,7 +592,7 @@ func testInstallThirdPartyAPIPostForVersion(t *testing.T, version string) {
ObjectMeta: api.ObjectMeta{
Name: "test",
},
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Foo",
APIVersion: version,
},
......@@ -660,7 +661,7 @@ func testInstallThirdPartyAPIDeleteVersion(t *testing.T, version string) {
Name: "test",
Namespace: "default",
},
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Foo",
},
SomeField: "test field",
......
......@@ -25,6 +25,7 @@ import (
kubeerr "k8s.io/kubernetes/pkg/api/errors"
etcderr "k8s.io/kubernetes/pkg/api/errors/etcd"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/registry/generic"
......@@ -432,7 +433,7 @@ func (e *Etcd) finalizeDelete(obj runtime.Object, runHooks bool) (runtime.Object
}
return obj, nil
}
return &api.Status{Status: api.StatusSuccess}, nil
return &unversioned.Status{Status: unversioned.StatusSuccess}, nil
}
// Watch makes a matcher for the given label and field, and calls
......
......@@ -26,6 +26,7 @@ import (
"k8s.io/kubernetes/pkg/api/errors"
etcderr "k8s.io/kubernetes/pkg/api/errors/etcd"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/capabilities"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
......@@ -146,7 +147,7 @@ func (r *BindingREST) Create(ctx api.Context, obj runtime.Object) (out runtime.O
return nil, errors.NewInvalid("binding", binding.Name, fielderrors.ValidationErrorList{fielderrors.NewFieldRequired("to.name")})
}
err = r.assignPod(ctx, binding.Name, binding.Target.Name, binding.Annotations)
out = &api.Status{Status: api.StatusSuccess}
out = &unversioned.Status{Status: unversioned.StatusSuccess}
return
}
......
......@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/api/validation"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -163,7 +164,7 @@ func (rs *REST) Delete(ctx api.Context, id string) (runtime.Object, error) {
}
}
return &api.Status{Status: api.StatusSuccess}, nil
return &unversioned.Status{Status: unversioned.StatusSuccess}, nil
}
func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
......
......@@ -22,9 +22,9 @@ import (
"fmt"
"strings"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/runtime"
)
......@@ -100,7 +100,7 @@ func (t *thirdPartyResourceDataCodec) populate(objIn *experimental.ThirdPartyRes
}
func (t *thirdPartyResourceDataCodec) populateFromObject(objIn *experimental.ThirdPartyResourceData, mapObj map[string]interface{}, data []byte) error {
typeMeta := api.TypeMeta{}
typeMeta := unversioned.TypeMeta{}
if err := json.Unmarshal(data, &typeMeta); err != nil {
return err
}
......@@ -237,7 +237,7 @@ func (t *thirdPartyResourceDataCodec) Encode(obj runtime.Object) (data []byte, e
}
fmt.Fprintf(buff, template, t.kind+"List", strings.Join(dataStrings, ","))
return buff.Bytes(), nil
case *api.Status:
case *unversioned.Status:
return t.delegate.Encode(obj)
default:
return nil, fmt.Errorf("unexpected object to encode: %#v", obj)
......
......@@ -23,21 +23,22 @@ import (
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apis/experimental"
"k8s.io/kubernetes/pkg/util"
)
type Foo struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
SomeField string `json:"someField"`
OtherField int `json:"otherField"`
}
type FooList struct {
api.TypeMeta `json:",inline"`
api.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"`
items []Foo `json:"items"`
}
......@@ -54,11 +55,11 @@ func TestCodec(t *testing.T) {
name: "missing kind",
},
{
obj: &Foo{ObjectMeta: api.ObjectMeta{Name: "bar"}, TypeMeta: api.TypeMeta{Kind: "Foo"}},
obj: &Foo{ObjectMeta: api.ObjectMeta{Name: "bar"}, TypeMeta: unversioned.TypeMeta{Kind: "Foo"}},
name: "basic",
},
{
obj: &Foo{ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "baz"}, TypeMeta: api.TypeMeta{Kind: "Foo"}},
obj: &Foo{ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "baz"}, TypeMeta: unversioned.TypeMeta{Kind: "Foo"}},
name: "resource version",
},
{
......@@ -67,7 +68,7 @@ func TestCodec(t *testing.T) {
Name: "bar",
CreationTimestamp: util.Time{time.Unix(100, 0)},
},
TypeMeta: api.TypeMeta{Kind: "Foo"},
TypeMeta: unversioned.TypeMeta{Kind: "Foo"},
},
name: "creation time",
},
......@@ -78,7 +79,7 @@ func TestCodec(t *testing.T) {
ResourceVersion: "baz",
Labels: map[string]string{"foo": "bar", "baz": "blah"},
},
TypeMeta: api.TypeMeta{Kind: "Foo"},
TypeMeta: unversioned.TypeMeta{Kind: "Foo"},
},
name: "labels",
},
......
......@@ -34,6 +34,7 @@ import (
"github.com/stretchr/testify/assert"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/conversion"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
......@@ -44,9 +45,9 @@ import (
const validEtcdVersion = "etcd 2.0.9"
type TestResource struct {
api.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata"`
Value int `json:"value"`
unversioned.TypeMeta `json:",inline"`
api.ObjectMeta `json:"metadata"`
Value int `json:"value"`
}
func (*TestResource) IsAnAPIObject() {}
......@@ -125,7 +126,7 @@ func TestList(t *testing.T) {
}
grace := int64(30)
expect := api.PodList{
ListMeta: api.ListMeta{ResourceVersion: "10"},
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
Items: []api.Pod{
{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
......@@ -198,7 +199,7 @@ func TestListFiltered(t *testing.T) {
}
grace := int64(30)
expect := api.PodList{
ListMeta: api.ListMeta{ResourceVersion: "10"},
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
Items: []api.Pod{
{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
......@@ -274,7 +275,7 @@ func TestListAcrossDirectories(t *testing.T) {
}
grace := int64(30)
expect := api.PodList{
ListMeta: api.ListMeta{ResourceVersion: "10"},
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
Items: []api.Pod{
// We expect list to be sorted by directory (e.g. namespace) first, then by name.
{
......@@ -350,7 +351,7 @@ func TestListExcludesDirectories(t *testing.T) {
}
grace := int64(30)
expect := api.PodList{
ListMeta: api.ListMeta{ResourceVersion: "10"},
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
Items: []api.Pod{
{
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
......
......@@ -20,7 +20,7 @@ import (
"sync"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/tools"
......@@ -183,8 +183,8 @@ func (w *etcdWatcher) translate() {
if err != nil {
w.emit(watch.Event{
Type: watch.Error,
Object: &api.Status{
Status: api.StatusFailure,
Object: &unversioned.Status{
Status: unversioned.StatusFailure,
Message: err.Error(),
},
})
......
......@@ -24,6 +24,7 @@ import (
"github.com/coreos/go-etcd/etcd"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/storage"
"k8s.io/kubernetes/pkg/tools"
......@@ -231,14 +232,14 @@ func TestWatchEtcdError(t *testing.T) {
if got.Type != watch.Error {
t.Fatalf("Unexpected non-error")
}
status, ok := got.Object.(*api.Status)
status, ok := got.Object.(*unversioned.Status)
if !ok {
t.Fatalf("Unexpected non-error object type")
}
if status.Message != "immediate error" {
t.Errorf("Unexpected wrong error")
}
if status.Status != api.StatusFailure {
if status.Status != unversioned.StatusFailure {
t.Errorf("Unexpected wrong error status")
}
}
......@@ -289,7 +290,7 @@ func TestWatch(t *testing.T) {
if e, a := watch.Error, errEvent.Type; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
if e, a := "Injected error", errEvent.Object.(*api.Status).Message; e != a {
if e, a := "Injected error", errEvent.Object.(*unversioned.Status).Message; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
}
......@@ -690,7 +691,7 @@ func TestWatchFromOtherError(t *testing.T) {
if e, a := watch.Error, errEvent.Type; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
if e, a := "101: () [2]", errEvent.Object.(*api.Status).Message; e != a {
if e, a := "101: () [2]", errEvent.Object.(*unversioned.Status).Message; e != a {
t.Errorf("Expected %v, got %v", e, a)
}
......
......@@ -21,6 +21,7 @@ import (
"testing"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util"
......@@ -252,7 +253,7 @@ func TestReflectorForWatchCache(t *testing.T) {
return fw, nil
},
ListFunc: func() (runtime.Object, error) {
return &api.PodList{ListMeta: api.ListMeta{ResourceVersion: "10"}}, nil
return &api.PodList{ListMeta: unversioned.ListMeta{ResourceVersion: "10"}}, nil
},
}
r := cache.NewReflector(lw, &api.Pod{}, store, 0)
......
......@@ -27,6 +27,7 @@ import (
"k8s.io/kubernetes/pkg/api"
apierrors "k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util/httpstream"
"k8s.io/kubernetes/third_party/golang/netutil"
)
......@@ -141,7 +142,7 @@ func (s *SpdyRoundTripper) NewConnection(resp *http.Response) (httpstream.Connec
responseError = "unable to read error from server response"
} else {
if obj, err := api.Scheme.Decode(responseErrorBytes); err == nil {
if status, ok := obj.(*api.Status); ok {
if status, ok := obj.(*unversioned.Status); ok {
return nil, &apierrors.StatusError{ErrStatus: *status}
}
}
......
......@@ -16,12 +16,10 @@ limitations under the License.
package api
import (
"k8s.io/kubernetes/pkg/api"
)
import "k8s.io/kubernetes/pkg/api/unversioned"
type Policy struct {
api.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Holds the information to configure the fit predicate functions
Predicates []PredicatePolicy `json:"predicates"`
// Holds the information to configure the priority functions
......
......@@ -16,12 +16,10 @@ limitations under the License.
package v1
import (
apiv1 "k8s.io/kubernetes/pkg/api/v1"
)
import "k8s.io/kubernetes/pkg/api/unversioned"
type Policy struct {
apiv1.TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Holds the information to configure the fit predicate functions
Predicates []PredicatePolicy `json:"predicates"`
// Holds the information to configure the priority functions
......
......@@ -27,6 +27,7 @@ import (
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/cache"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/controller/framework"
......@@ -414,7 +415,7 @@ func createRunningPod(wg *sync.WaitGroup, c *client.Client, name, ns, image stri
defer GinkgoRecover()
defer wg.Done()
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......
......@@ -23,6 +23,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -40,7 +41,7 @@ var dnsServiceLableSelector = labels.Set{
func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd string) *api.Pod {
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: latest.GroupOrDie("").Version,
},
......
......@@ -18,10 +18,12 @@ package e2e
import (
"fmt"
"path"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/util"
"path"
. "github.com/onsi/ginkgo"
)
......@@ -205,7 +207,7 @@ func formatMedium(medium api.StorageMedium) string {
func testPodWithVolume(image, path string, source *api.EmptyDirVolumeSource) *api.Pod {
podName := "pod-" + string(util.NewUUID())
return &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: latest.GroupOrDie("").Version,
},
......
......@@ -18,11 +18,13 @@ package e2e
import (
"fmt"
"os"
"path"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"os"
"path"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
......@@ -121,7 +123,7 @@ func testPodWithHostVol(path string, source *api.HostPathVolumeSource) *api.Pod
podName := "pod-host-path-test"
return &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: latest.GroupOrDie("").Version,
},
......
......@@ -23,6 +23,7 @@ import (
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/util"
......@@ -55,7 +56,7 @@ var _ = Describe("Networking", func() {
podName := "wget-test"
contName := "wget-test-container"
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......
......@@ -28,6 +28,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/fields"
......@@ -340,7 +341,7 @@ func testPDPod(diskName, targetHost string, readOnly bool, numContainers int) *a
}
pod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: latest.GroupOrDie("").Version,
},
......
......@@ -18,14 +18,15 @@ package e2e
import (
"fmt"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"time"
)
// Marked with [Skipped] to skip the test by default (see driver.go),
......@@ -161,7 +162,7 @@ func makeCheckPod(ns string, nfsserver string) *api.Pod {
// Prepare pod that mounts the NFS volume again and
// checks that /mnt/index.html was scrubbed there
return &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: testapi.Default.Version(),
},
......
......@@ -25,6 +25,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -183,7 +184,7 @@ func rcByNameContainer(name string, replicas int, image string, labels map[strin
// Add "name": name to the labels, overwriting if it exists.
labels["name"] = name
return &api.ReplicationController{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "ReplicationController",
APIVersion: latest.GroupOrDie("").Version,
},
......
......@@ -22,6 +22,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
......@@ -196,7 +197,7 @@ var _ = Describe("SchedulerPredicates", func() {
By(fmt.Sprintf("Starting additional %v Pods to fully saturate the cluster max pods and trying to start another one", podsNeededForSaturation))
startPods(c, podsNeededForSaturation, ns, "maxp", api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......@@ -215,7 +216,7 @@ var _ = Describe("SchedulerPredicates", func() {
podName := "additional-pod"
_, err = c.Pods(ns).Create(&api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......@@ -276,7 +277,7 @@ var _ = Describe("SchedulerPredicates", func() {
By(fmt.Sprintf("Starting additional %v Pods to fully saturate the cluster CPU and trying to start another one", podsNeededForSaturation))
startPods(c, podsNeededForSaturation, ns, "overcommit", api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......@@ -300,7 +301,7 @@ var _ = Describe("SchedulerPredicates", func() {
podName := "additional-pod"
_, err = c.Pods(ns).Create(&api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......@@ -342,7 +343,7 @@ var _ = Describe("SchedulerPredicates", func() {
_, currentlyDeadPods := getPodsNumbers(allPods)
_, err = c.Pods(ns).Create(&api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
},
ObjectMeta: api.ObjectMeta{
......
......@@ -33,9 +33,11 @@ package e2e
import (
"fmt"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
......@@ -99,7 +101,7 @@ func startVolumeServer(client *client.Client, config VolumeTestConfig) *api.Pod
privileged := new(bool)
*privileged = true
serverPod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: "v1",
},
......@@ -159,7 +161,7 @@ func testVolumeClient(client *client.Client, config VolumeTestConfig, volume api
podClient := client.Pods(config.namespace)
clientPod := &api.Pod{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Pod",
APIVersion: "v1",
},
......@@ -304,7 +306,7 @@ var _ = Describe("Volumes", func() {
// create Endpoints for the server
endpoints := api.Endpoints{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Endpoints",
APIVersion: "v1",
},
......@@ -435,7 +437,7 @@ var _ = Describe("Volumes", func() {
// create secrets for the server
secret := api.Secret{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Secret",
APIVersion: "v1",
},
......@@ -507,7 +509,7 @@ var _ = Describe("Volumes", func() {
// create ceph secret
secret := &api.Secret{
TypeMeta: api.TypeMeta{
TypeMeta: unversioned.TypeMeta{
Kind: "Secret",
APIVersion: "v1beta3",
},
......
......@@ -32,6 +32,7 @@ import (
"github.com/golang/glog"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/errors"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
"k8s.io/kubernetes/pkg/fields"
......@@ -264,11 +265,11 @@ func main() {
glog.Infof("After %v while making a proxy call got error %v", time.Since(start), err)
continue
}
var r api.Status
var r unversioned.Status
if err := api.Scheme.DecodeInto(hostname, &r); err != nil {
break
}
if r.Status == api.StatusFailure {
if r.Status == unversioned.StatusFailure {
glog.Infof("After %v got status %v", time.Since(start), string(hostname))
continue
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment