Moving Status object to a common package

This commit is contained in:
Kris 2015-09-09 14:59:11 -07:00 committed by Chao Xu
parent a32ea8ebc1
commit f4ad00d9ae
84 changed files with 960 additions and 1101 deletions

View File

@ -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{

View File

@ -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,

View File

@ -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,

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -22,6 +22,7 @@ import (
time "time"
resource "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
fields "k8s.io/kubernetes/pkg/fields"
labels "k8s.io/kubernetes/pkg/labels"
@ -779,7 +780,7 @@ func deepCopy_api_List(in List, out *List, c *conversion.Cloner) error {
return nil
}
func deepCopy_api_ListMeta(in ListMeta, out *ListMeta, c *conversion.Cloner) error {
func deepCopy_api_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error {
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
return nil
@ -2025,7 +2026,7 @@ func deepCopy_api_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *convers
return nil
}
func deepCopy_api_Status(in Status, out *Status, c *conversion.Cloner) error {
func deepCopy_api_Status(in unversioned.Status, out *unversioned.Status, c *conversion.Cloner) error {
if err := deepCopy_api_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
@ -2036,7 +2037,7 @@ func deepCopy_api_Status(in Status, out *Status, c *conversion.Cloner) error {
out.Message = in.Message
out.Reason = in.Reason
if in.Details != nil {
out.Details = new(StatusDetails)
out.Details = new(unversioned.StatusDetails)
if err := deepCopy_api_StatusDetails(*in.Details, out.Details, c); err != nil {
return err
}
@ -2047,18 +2048,18 @@ func deepCopy_api_Status(in Status, out *Status, c *conversion.Cloner) error {
return nil
}
func deepCopy_api_StatusCause(in StatusCause, out *StatusCause, c *conversion.Cloner) error {
func deepCopy_api_StatusCause(in unversioned.StatusCause, out *unversioned.StatusCause, c *conversion.Cloner) error {
out.Type = in.Type
out.Message = in.Message
out.Field = in.Field
return nil
}
func deepCopy_api_StatusDetails(in StatusDetails, out *StatusDetails, c *conversion.Cloner) error {
func deepCopy_api_StatusDetails(in unversioned.StatusDetails, out *unversioned.StatusDetails, c *conversion.Cloner) error {
out.Name = in.Name
out.Kind = in.Kind
if in.Causes != nil {
out.Causes = make([]StatusCause, len(in.Causes))
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
for i := range in.Causes {
if err := deepCopy_api_StatusCause(in.Causes[i], &out.Causes[i], c); err != nil {
return err
@ -2078,7 +2079,7 @@ func deepCopy_api_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *c
return nil
}
func deepCopy_api_TypeMeta(in TypeMeta, out *TypeMeta, c *conversion.Cloner) error {
func deepCopy_api_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error {
out.Kind = in.Kind
out.APIVersion = in.APIVersion
return nil

View File

@ -22,7 +22,7 @@ import (
"net/http"
"strings"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/util/errors"
"k8s.io/kubernetes/pkg/util/fielderrors"
@ -43,7 +43,7 @@ const (
// StatusError is an error intended for consumption by a REST API server; it can also be
// reconstructed by clients from a REST response. Public to allow easy type switches.
type StatusError struct {
ErrStatus api.Status
ErrStatus unversioned.Status
}
var _ error = &StatusError{}
@ -55,7 +55,7 @@ func (e *StatusError) Error() string {
// Status allows access to e's status without having to know the detailed workings
// of StatusError. Used by pkg/apiserver.
func (e *StatusError) Status() api.Status {
func (e *StatusError) Status() unversioned.Status {
return e.ErrStatus
}
@ -77,11 +77,11 @@ func (u *UnexpectedObjectError) Error() string {
return fmt.Sprintf("unexpected object: %v", u.Object)
}
// FromObject generates an StatusError from an api.Status, if that is the type of obj; otherwise,
// FromObject generates an StatusError from an unversioned.Status, if that is the type of obj; otherwise,
// returns an UnexpecteObjectError.
func FromObject(obj runtime.Object) error {
switch t := obj.(type) {
case *api.Status:
case *unversioned.Status:
return &StatusError{*t}
}
return &UnexpectedObjectError{obj}
@ -89,11 +89,11 @@ func FromObject(obj runtime.Object) error {
// NewNotFound returns a new error which indicates that the resource of the kind and the name was not found.
func NewNotFound(kind, name string) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusNotFound,
Reason: api.StatusReasonNotFound,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonNotFound,
Details: &unversioned.StatusDetails{
Kind: kind,
Name: name,
},
@ -103,11 +103,11 @@ func NewNotFound(kind, name string) error {
// NewAlreadyExists returns an error indicating the item requested exists by that identifier.
func NewAlreadyExists(kind, name string) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusConflict,
Reason: api.StatusReasonAlreadyExists,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonAlreadyExists,
Details: &unversioned.StatusDetails{
Kind: kind,
Name: name,
},
@ -122,21 +122,21 @@ func NewUnauthorized(reason string) error {
if len(message) == 0 {
message = "not authorized"
}
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusUnauthorized,
Reason: api.StatusReasonUnauthorized,
Reason: unversioned.StatusReasonUnauthorized,
Message: message,
}}
}
// NewForbidden returns an error indicating the requested action was forbidden
func NewForbidden(kind, name string, err error) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusForbidden,
Reason: api.StatusReasonForbidden,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonForbidden,
Details: &unversioned.StatusDetails{
Kind: kind,
Name: name,
},
@ -146,11 +146,11 @@ func NewForbidden(kind, name string, err error) error {
// NewConflict returns an error indicating the item can't be updated as provided.
func NewConflict(kind, name string, err error) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusConflict,
Reason: api.StatusReasonConflict,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonConflict,
Details: &unversioned.StatusDetails{
Kind: kind,
Name: name,
},
@ -160,21 +160,21 @@ func NewConflict(kind, name string, err error) error {
// NewInvalid returns an error indicating the item is invalid and cannot be processed.
func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error {
causes := make([]api.StatusCause, 0, len(errs))
causes := make([]unversioned.StatusCause, 0, len(errs))
for i := range errs {
if err, ok := errs[i].(*fielderrors.ValidationError); ok {
causes = append(causes, api.StatusCause{
Type: api.CauseType(err.Type),
causes = append(causes, unversioned.StatusCause{
Type: unversioned.CauseType(err.Type),
Message: err.ErrorBody(),
Field: err.Field,
})
}
}
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: StatusUnprocessableEntity, // RFC 4918: StatusUnprocessableEntity
Reason: api.StatusReasonInvalid,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonInvalid,
Details: &unversioned.StatusDetails{
Kind: kind,
Name: name,
Causes: causes,
@ -185,31 +185,31 @@ func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error {
// NewBadRequest creates an error that indicates that the request is invalid and can not be processed.
func NewBadRequest(reason string) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusBadRequest,
Reason: api.StatusReasonBadRequest,
Reason: unversioned.StatusReasonBadRequest,
Message: reason,
}}
}
// NewServiceUnavailable creates an error that indicates that the requested service is unavailable.
func NewServiceUnavailable(reason string) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusServiceUnavailable,
Reason: api.StatusReasonServiceUnavailable,
Reason: unversioned.StatusReasonServiceUnavailable,
Message: reason,
}}
}
// NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
func NewMethodNotSupported(kind, action string) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusMethodNotAllowed,
Reason: api.StatusReasonMethodNotAllowed,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonMethodNotAllowed,
Details: &unversioned.StatusDetails{
Kind: kind,
},
Message: fmt.Sprintf("%s is not supported on resources of kind %q", action, kind),
@ -219,11 +219,11 @@ func NewMethodNotSupported(kind, action string) error {
// NewServerTimeout returns an error indicating the requested action could not be completed due to a
// transient error, and the client should try again.
func NewServerTimeout(kind, operation string, retryAfterSeconds int) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusInternalServerError,
Reason: api.StatusReasonServerTimeout,
Details: &api.StatusDetails{
Reason: unversioned.StatusReasonServerTimeout,
Details: &unversioned.StatusDetails{
Kind: kind,
Name: operation,
RetryAfterSeconds: retryAfterSeconds,
@ -234,12 +234,12 @@ func NewServerTimeout(kind, operation string, retryAfterSeconds int) error {
// NewInternalError returns an error indicating the item is invalid and cannot be processed.
func NewInternalError(err error) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: http.StatusInternalServerError,
Reason: api.StatusReasonInternalError,
Details: &api.StatusDetails{
Causes: []api.StatusCause{{Message: err.Error()}},
Reason: unversioned.StatusReasonInternalError,
Details: &unversioned.StatusDetails{
Causes: []unversioned.StatusCause{{Message: err.Error()}},
},
Message: fmt.Sprintf("Internal error occurred: %v", err),
}}
@ -248,12 +248,12 @@ func NewInternalError(err error) error {
// NewTimeoutError returns an error indicating that a timeout occurred before the request
// could be completed. Clients may retry, but the operation may still complete.
func NewTimeoutError(message string, retryAfterSeconds int) error {
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: StatusServerTimeout,
Reason: api.StatusReasonTimeout,
Reason: unversioned.StatusReasonTimeout,
Message: fmt.Sprintf("Timeout: %s", message),
Details: &api.StatusDetails{
Details: &unversioned.StatusDetails{
RetryAfterSeconds: retryAfterSeconds,
},
}}
@ -261,43 +261,43 @@ func NewTimeoutError(message string, retryAfterSeconds int) error {
// NewGenericServerResponse returns a new error for server responses that are not in a recognizable form.
func NewGenericServerResponse(code int, verb, kind, name, serverMessage string, retryAfterSeconds int, isUnexpectedResponse bool) error {
reason := api.StatusReasonUnknown
reason := unversioned.StatusReasonUnknown
message := fmt.Sprintf("the server responded with the status code %d but did not return more information", code)
switch code {
case http.StatusConflict:
if verb == "POST" {
reason = api.StatusReasonAlreadyExists
reason = unversioned.StatusReasonAlreadyExists
} else {
reason = api.StatusReasonConflict
reason = unversioned.StatusReasonConflict
}
message = "the server reported a conflict"
case http.StatusNotFound:
reason = api.StatusReasonNotFound
reason = unversioned.StatusReasonNotFound
message = "the server could not find the requested resource"
case http.StatusBadRequest:
reason = api.StatusReasonBadRequest
reason = unversioned.StatusReasonBadRequest
message = "the server rejected our request for an unknown reason"
case http.StatusUnauthorized:
reason = api.StatusReasonUnauthorized
reason = unversioned.StatusReasonUnauthorized
message = "the server has asked for the client to provide credentials"
case http.StatusForbidden:
reason = api.StatusReasonForbidden
reason = unversioned.StatusReasonForbidden
message = "the server does not allow access to the requested resource"
case http.StatusMethodNotAllowed:
reason = api.StatusReasonMethodNotAllowed
reason = unversioned.StatusReasonMethodNotAllowed
message = "the server does not allow this method on the requested resource"
case StatusUnprocessableEntity:
reason = api.StatusReasonInvalid
reason = unversioned.StatusReasonInvalid
message = "the server rejected our request due to an error in our request"
case StatusServerTimeout:
reason = api.StatusReasonServerTimeout
reason = unversioned.StatusReasonServerTimeout
message = "the server cannot complete the requested operation at this time, try again later"
case StatusTooManyRequests:
reason = api.StatusReasonTimeout
reason = unversioned.StatusReasonTimeout
message = "the server has received too many requests and has asked us to try again later"
default:
if code >= 500 {
reason = api.StatusReasonInternalError
reason = unversioned.StatusReasonInternalError
message = "an error on the server has prevented the request from succeeding"
}
}
@ -307,22 +307,22 @@ func NewGenericServerResponse(code int, verb, kind, name, serverMessage string,
case len(kind) > 0:
message = fmt.Sprintf("%s (%s %s)", message, strings.ToLower(verb), kind)
}
var causes []api.StatusCause
var causes []unversioned.StatusCause
if isUnexpectedResponse {
causes = []api.StatusCause{
causes = []unversioned.StatusCause{
{
Type: api.CauseTypeUnexpectedServerResponse,
Type: unversioned.CauseTypeUnexpectedServerResponse,
Message: serverMessage,
},
}
} else {
causes = nil
}
return &StatusError{api.Status{
Status: api.StatusFailure,
return &StatusError{unversioned.Status{
Status: unversioned.StatusFailure,
Code: code,
Reason: reason,
Details: &api.StatusDetails{
Details: &unversioned.StatusDetails{
Kind: kind,
Name: name,
@ -335,51 +335,51 @@ func NewGenericServerResponse(code int, verb, kind, name, serverMessage string,
// IsNotFound returns true if the specified error was created by NewNotFound.
func IsNotFound(err error) bool {
return reasonForError(err) == api.StatusReasonNotFound
return reasonForError(err) == unversioned.StatusReasonNotFound
}
// IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.
func IsAlreadyExists(err error) bool {
return reasonForError(err) == api.StatusReasonAlreadyExists
return reasonForError(err) == unversioned.StatusReasonAlreadyExists
}
// IsConflict determines if the err is an error which indicates the provided update conflicts.
func IsConflict(err error) bool {
return reasonForError(err) == api.StatusReasonConflict
return reasonForError(err) == unversioned.StatusReasonConflict
}
// IsInvalid determines if the err is an error which indicates the provided resource is not valid.
func IsInvalid(err error) bool {
return reasonForError(err) == api.StatusReasonInvalid
return reasonForError(err) == unversioned.StatusReasonInvalid
}
// IsMethodNotSupported determines if the err is an error which indicates the provided action could not
// be performed because it is not supported by the server.
func IsMethodNotSupported(err error) bool {
return reasonForError(err) == api.StatusReasonMethodNotAllowed
return reasonForError(err) == unversioned.StatusReasonMethodNotAllowed
}
// IsBadRequest determines if err is an error which indicates that the request is invalid.
func IsBadRequest(err error) bool {
return reasonForError(err) == api.StatusReasonBadRequest
return reasonForError(err) == unversioned.StatusReasonBadRequest
}
// IsUnauthorized determines if err is an error which indicates that the request is unauthorized and
// requires authentication by the user.
func IsUnauthorized(err error) bool {
return reasonForError(err) == api.StatusReasonUnauthorized
return reasonForError(err) == unversioned.StatusReasonUnauthorized
}
// IsForbidden determines if err is an error which indicates that the request is forbidden and cannot
// be completed as requested.
func IsForbidden(err error) bool {
return reasonForError(err) == api.StatusReasonForbidden
return reasonForError(err) == unversioned.StatusReasonForbidden
}
// IsServerTimeout determines if err is an error which indicates that the request needs to be retried
// by the client.
func IsServerTimeout(err error) bool {
return reasonForError(err) == api.StatusReasonServerTimeout
return reasonForError(err) == unversioned.StatusReasonServerTimeout
}
// IsUnexpectedServerError returns true if the server response was not in the expected API format,
@ -389,7 +389,7 @@ func IsUnexpectedServerError(err error) bool {
case *StatusError:
if d := t.Status().Details; d != nil {
for _, cause := range d.Causes {
if cause.Type == api.CauseTypeUnexpectedServerResponse {
if cause.Type == unversioned.CauseTypeUnexpectedServerResponse {
return true
}
}
@ -411,7 +411,7 @@ func SuggestsClientDelay(err error) (int, bool) {
case *StatusError:
if t.Status().Details != nil {
switch t.Status().Reason {
case api.StatusReasonServerTimeout, api.StatusReasonTimeout:
case unversioned.StatusReasonServerTimeout, unversioned.StatusReasonTimeout:
return t.Status().Details.RetryAfterSeconds, true
}
}
@ -419,10 +419,10 @@ func SuggestsClientDelay(err error) (int, bool) {
return 0, false
}
func reasonForError(err error) api.StatusReason {
func reasonForError(err error) unversioned.StatusReason {
switch t := err.(type) {
case *StatusError:
return t.ErrStatus.Reason
}
return api.StatusReasonUnknown
return unversioned.StatusReasonUnknown
}

View File

@ -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: &{}"},
}

View File

@ -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)

View File

@ -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
}

View File

@ -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",
},

View File

@ -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() {}

View File

@ -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)
}
}

View File

@ -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()
},

View File

@ -18,6 +18,7 @@ package api
import (
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/runtime"
@ -54,33 +55,6 @@ import (
// Hypens ('-') cannot be leading or trailing character of the string
// and cannot be adjacent to other hyphens.
// 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.
type TypeMeta struct {
// Kind is a string value representing the REST resource this object represents.
// Servers may infer this from the endpoint the client submits requests to.
Kind string `json:"kind,omitempty"`
// 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.
APIVersion string `json:"apiVersion,omitempty"`
}
// ListMeta describes metadata that synthetic resources must have, including lists and
// various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
type ListMeta struct {
// SelfLink is a URL representing this object.
SelfLink string `json:"selfLink,omitempty"`
// An opaque value that represents the version of this response for use with optimistic
// concurrency and change monitoring endpoints. Clients must treat these values as opaque
// and values may only be valid for a particular resource or set of resources. Only servers
// will generate resource versions.
ResourceVersion string `json:"resourceVersion,omitempty"`
}
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
// users must create.
type ObjectMeta struct {
@ -272,8 +246,8 @@ type PersistentVolumeClaimVolumeSource struct {
}
type PersistentVolume struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
//Spec defines a persistent volume owned by the cluster
Spec PersistentVolumeSpec `json:"spec,omitempty"`
@ -322,15 +296,15 @@ type PersistentVolumeStatus struct {
}
type PersistentVolumeList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
Items []PersistentVolume `json:"items"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []PersistentVolume `json:"items"`
}
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
type PersistentVolumeClaim struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the volume requested by a pod author
Spec PersistentVolumeClaimSpec `json:"spec,omitempty"`
@ -340,9 +314,9 @@ type PersistentVolumeClaim struct {
}
type PersistentVolumeClaimList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
Items []PersistentVolumeClaim `json:"items"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []PersistentVolumeClaim `json:"items"`
}
// PersistentVolumeClaimSpec describes the common attributes of storage devices
@ -929,8 +903,8 @@ const (
// PodList is a list of Pods.
type PodList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Pod `json:"items"`
}
@ -1018,8 +992,8 @@ type PodStatus struct {
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
type PodStatusResult struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Status represents the current information about a pod. This data may not be up
// to date.
Status PodStatus `json:"status,omitempty"`
@ -1027,8 +1001,8 @@ type PodStatusResult struct {
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
type Pod struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behavior of a pod.
Spec PodSpec `json:"spec,omitempty"`
@ -1049,8 +1023,8 @@ type PodTemplateSpec struct {
// PodTemplate describes a template for creating copies of a predefined pod.
type PodTemplate struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Template defines the pods that will be created from this pod template
Template PodTemplateSpec `json:"template,omitempty"`
@ -1058,8 +1032,8 @@ type PodTemplate struct {
// PodTemplateList is a list of PodTemplates.
type PodTemplateList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []PodTemplate `json:"items"`
}
@ -1098,8 +1072,8 @@ type ReplicationControllerStatus struct {
// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the desired behavior of this replication controller.
Spec ReplicationControllerSpec `json:"spec,omitempty"`
@ -1111,8 +1085,8 @@ type ReplicationController struct {
// ReplicationControllerList is a collection of replication controllers.
type ReplicationControllerList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []ReplicationController `json:"items"`
}
@ -1125,8 +1099,8 @@ const (
// ServiceList holds a list of services.
type ServiceList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Service `json:"items"`
}
@ -1249,8 +1223,8 @@ type ServicePort struct {
// (for example 3306) that the proxy listens on, and the selector that determines which pods
// will answer requests sent through the proxy.
type Service struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behavior of a service.
Spec ServiceSpec `json:"spec,omitempty"`
@ -1264,8 +1238,8 @@ type Service struct {
// * a principal that can be authenticated and authorized
// * a set of secrets
type ServiceAccount struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount
Secrets []ObjectReference `json:"secrets"`
@ -1278,8 +1252,8 @@ type ServiceAccount struct {
// ServiceAccountList is a list of ServiceAccount objects
type ServiceAccountList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []ServiceAccount `json:"items"`
}
@ -1297,8 +1271,8 @@ type ServiceAccountList struct {
// },
// ]
type Endpoints struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// The set of all endpoints is the union of all subsets.
Subsets []EndpointSubset
@ -1345,8 +1319,8 @@ type EndpointPort struct {
// EndpointsList is a list of endpoints.
type EndpointsList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Endpoints `json:"items"`
}
@ -1489,8 +1463,8 @@ type ResourceList map[ResourceName]resource.Quantity
// Node is a worker node in Kubernetes
// The name of the node according to etcd is in ObjectMeta.Name.
type Node struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behavior of a node.
Spec NodeSpec `json:"spec,omitempty"`
@ -1501,8 +1475,8 @@ type Node struct {
// NodeList is a list of nodes.
type NodeList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Node `json:"items"`
}
@ -1539,8 +1513,8 @@ const (
// A namespace provides a scope for Names.
// Use of multiple namespaces is optional
type Namespace struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behavior of the Namespace.
Spec NamespaceSpec `json:"spec,omitempty"`
@ -1551,15 +1525,15 @@ type Namespace struct {
// NamespaceList is a list of Namespaces.
type NamespaceList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Namespace `json:"items"`
}
// Binding ties one object to another - for example, a pod is bound to a node by a scheduler.
type Binding struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// ObjectMeta describes the object that is being bound.
ObjectMeta `json:"metadata,omitempty"`
@ -1569,7 +1543,7 @@ type Binding struct {
// DeleteOptions may be provided when deleting an API object
type DeleteOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Optional duration in seconds before the object should be deleted. Value must be non-negative integer.
// The value zero indicates delete immediately. If this value is nil, the default grace period for the
@ -1580,7 +1554,7 @@ type DeleteOptions struct {
// ListOptions is the query options to a standard REST list call, and has future support for
// watch calls.
type ListOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// A selector based on labels
LabelSelector labels.Selector
@ -1594,7 +1568,7 @@ type ListOptions struct {
// PodLogOptions is the query options for a Pod's logs REST call
type PodLogOptions struct {
TypeMeta
unversioned.TypeMeta
// Container for which to return logs
Container string
@ -1609,7 +1583,7 @@ type PodLogOptions struct {
// PodAttachOptions is the query options to a Pod's remote attach call
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
type PodAttachOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Stdin if true indicates that stdin is to be redirected for the attach call
Stdin bool `json:"stdin,omitempty"`
@ -1629,7 +1603,7 @@ type PodAttachOptions struct {
// PodExecOptions is the query options to a Pod's remote exec call
type PodExecOptions struct {
TypeMeta
unversioned.TypeMeta
// Stdin if true indicates that stdin is to be redirected for the exec call
Stdin bool
@ -1652,225 +1626,12 @@ type PodExecOptions struct {
// PodProxyOptions is the query options to a Pod's proxy call
type PodProxyOptions struct {
TypeMeta
unversioned.TypeMeta
// Path is the URL path to use for the current proxy request
Path string
}
// Status is a return value for calls that don't return other objects.
// TODO: this could go in apiserver, but I'm including it here so clients needn't
// import both.
type Status struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
// One of: "Success" or "Failure"
Status string `json:"status,omitempty"`
// A human-readable description of the status of this operation.
Message string `json:"message,omitempty"`
// 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.
Reason StatusReason `json:"reason,omitempty"`
// 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.
Details *StatusDetails `json:"details,omitempty"`
// Suggested HTTP return code for this status, 0 if not set.
Code int `json:"code,omitempty"`
}
// 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.
type StatusDetails struct {
// The name attribute of the resource associated with the status StatusReason
// (when there is a single name which can be described).
Name string `json:"name,omitempty"`
// The kind attribute of the resource associated with the status StatusReason.
// On some operations may differ from the requested resource Kind.
Kind string `json:"kind,omitempty"`
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
Causes []StatusCause `json:"causes,omitempty"`
// If specified, the time in seconds before the operation should be retried.
RetryAfterSeconds int `json:"retryAfterSeconds,omitempty"`
}
// Values of Status.Status
const (
StatusSuccess = "Success"
StatusFailure = "Failure"
)
// StatusReason is an enumeration of possible failure causes. Each StatusReason
// must map to a single HTTP status code, but multiple reasons may map
// to the same HTTP status code.
// TODO: move to apiserver
type StatusReason string
const (
// StatusReasonUnknown means the server has declined to indicate a specific reason.
// The details field may contain other information about this error.
// Status code 500.
StatusReasonUnknown StatusReason = ""
// StatusReasonUnauthorized means the server can be reached and understood the request, but requires
// the user to present appropriate authorization credentials (identified by the WWW-Authenticate header)
// in order for the action to be completed. If the user has specified credentials on the request, the
// server considers them insufficient.
// Status code 401
StatusReasonUnauthorized StatusReason = "Unauthorized"
// StatusReasonForbidden means the server can be reached and understood the request, but refuses
// to take any further action. It is the result of the server being configured to deny access for some reason
// to the requested resource by the client.
// Details (optional):
// "kind" string - the kind attribute of the forbidden resource
// on some operations may differ from the requested
// resource.
// "id" string - the identifier of the forbidden resource
// Status code 403
StatusReasonForbidden StatusReason = "Forbidden"
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// Details (optional):
// "kind" string - the kind attribute of the missing resource
// on some operations may differ from the requested
// resource.
// "id" string - the identifier of the missing resource
// Status code 404
StatusReasonNotFound StatusReason = "NotFound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
StatusReasonAlreadyExists StatusReason = "AlreadyExists"
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// conflict.
// Status code 409
StatusReasonConflict StatusReason = "Conflict"
// StatusReasonInvalid means the requested create or update operation cannot be
// completed due to invalid data provided as part of the request. The client may
// need to alter the request. When set, the client may use the StatusDetails
// message field as a summary of the issues encountered.
// Details (optional):
// "kind" string - the kind attribute of the invalid resource
// "id" string - the identifier of the invalid resource
// "causes" - one or more StatusCause entries indicating the data in the
// provided resource that was invalid. The code, message, and
// field attributes will be set.
// Status code 422
StatusReasonInvalid StatusReason = "Invalid"
// StatusReasonServerTimeout means the server can be reached and understood the request,
// but cannot complete the action in a reasonable time. The client should retry the request.
// This is may be due to temporary server load or a transient communication issue with
// another server. Status code 500 is used because the HTTP spec provides no suitable
// server-requested client retry and the 5xx class represents actionable errors.
// Details (optional):
// "kind" string - the kind attribute of the resource being acted on.
// "id" string - the operation that is being attempted.
// "retryAfterSeconds" int - the number of seconds before the operation should be retried
// Status code 500
StatusReasonServerTimeout StatusReason = "ServerTimeout"
// StatusReasonTimeout means that the request could not be completed within the given time.
// Clients can get this response only when they specified a timeout param in the request,
// or if the server cannot complete the operation within a reasonable amount of time.
// The request might succeed with an increased value of timeout param. The client *should*
// wait at least the number of seconds specified by the retryAfterSeconds field.
// Details (optional):
// "retryAfterSeconds" int - the number of seconds before the operation should be retried
// Status code 504
StatusReasonTimeout StatusReason = "Timeout"
// StatusReasonBadRequest means that the request itself was invalid, because the request
// doesn't make any sense, for example deleting a read-only object. This is different than
// StatusReasonInvalid above which indicates that the API call could possibly succeed, but the
// data was invalid. API calls that return BadRequest can never succeed.
StatusReasonBadRequest StatusReason = "BadRequest"
// StatusReasonMethodNotAllowed means that the action the client attempted to perform on the
// resource was not supported by the code - for instance, attempting to delete a resource that
// can only be created. API calls that return MethodNotAllowed can never succeed.
StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
// StatusReasonInternalError indicates that an internal error occurred, it is unexpected
// and the outcome of the call is unknown.
// Details (optional):
// "causes" - The original error
// Status code 500
StatusReasonInternalError = "InternalError"
// StatusReasonServiceUnavailable means that the request itself was valid,
// but the requested service is unavailable at this time.
// Retrying the request after some time might succeed.
// Status code 503
StatusReasonServiceUnavailable StatusReason = "ServiceUnavailable"
)
// StatusCause provides more information about an api.Status failure, including
// cases when multiple errors are encountered.
type StatusCause struct {
// A machine-readable description of the cause of the error. If this value is
// empty there is no information available.
Type CauseType `json:"reason,omitempty"`
// A human-readable description of the cause of the error. This field may be
// presented as-is to a reader.
Message string `json:"message,omitempty"`
// 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.
//
// Examples:
// "name" - the field "name" on the current resource
// "items[0].name" - the field "name" on the first array entry in "items"
Field string `json:"field,omitempty"`
}
// CauseType is a machine readable value providing more detail about what
// occurred in a status response. An operation may have multiple causes for a
// status (whether Failure or Success).
type CauseType string
const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound"
// CauseTypeFieldValueRequired is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired CauseType = "FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// unique (e.g. unique IDs).
CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate"
// CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex
// match).
CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid"
// CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
// values that can not be handled (e.g. an enumerated string).
CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
// CauseTypeUnexpectedServerResponse is used to report when the server responded to the client
// without the expected return type. The presence of this cause indicates the error may be
// due to an intervening proxy or the server software malfunctioning.
CauseTypeUnexpectedServerResponse CauseType = "UnexpectedServerResponse"
)
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
Kind string `json:"kind,omitempty"`
@ -1898,8 +1659,8 @@ type LocalObjectReference struct {
}
type SerializedReference struct {
TypeMeta `json:",inline"`
Reference ObjectReference `json:"reference,omitempty"`
unversioned.TypeMeta `json:",inline"`
Reference ObjectReference `json:"reference,omitempty"`
}
type EventSource struct {
@ -1912,8 +1673,8 @@ type EventSource struct {
// Event is a report of an event somewhere in the cluster.
// TODO: Decide whether to store these separately or with the object they apply to.
type Event struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Required. The object that this event is about.
InvolvedObject ObjectReference `json:"involvedObject,omitempty"`
@ -1943,16 +1704,16 @@ type Event struct {
// EventList is a list of events.
type EventList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Event `json:"items"`
}
// List holds a list of objects, which may not be known by the server.
type List struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []runtime.Object `json:"items"`
}
@ -1991,8 +1752,8 @@ type LimitRangeSpec struct {
// LimitRange sets resource usage limits for each kind of resource in a Namespace
type LimitRange struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the limits enforced
Spec LimitRangeSpec `json:"spec,omitempty"`
@ -2000,8 +1761,8 @@ type LimitRange struct {
// LimitRangeList is a list of LimitRange items.
type LimitRangeList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of LimitRange objects
Items []LimitRange `json:"items"`
@ -2039,8 +1800,8 @@ type ResourceQuotaStatus struct {
// ResourceQuota sets aggregate quota restrictions enforced per namespace
type ResourceQuota struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Spec defines the desired quota
Spec ResourceQuotaSpec `json:"spec,omitempty"`
@ -2051,8 +1812,8 @@ type ResourceQuota struct {
// ResourceQuotaList is a list of ResourceQuota items
type ResourceQuotaList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of ResourceQuota objects
Items []ResourceQuota `json:"items"`
@ -2061,8 +1822,8 @@ type ResourceQuotaList struct {
// Secret holds secret data of a certain type. The total bytes of the values in
// the Data field must be less than MaxSecretSize bytes.
type Secret struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN
// or leading dot followed by valid DNS_SUBDOMAIN.
@ -2112,8 +1873,8 @@ const (
)
type SecretList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []Secret `json:"items"`
}
@ -2175,15 +1936,15 @@ type ComponentCondition struct {
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
type ComponentStatus struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Conditions []ComponentCondition `json:"conditions,omitempty"`
}
type ComponentStatusList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []ComponentStatus `json:"items"`
}
@ -2235,8 +1996,8 @@ type SELinuxOptions struct {
// data encoding hints). A range allocation should *ALWAYS* be recreatable at any time by observation
// of the cluster, thus the object is less strongly typed than most.
type RangeAllocation struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
// A string representing a unique label for a range of resources, such as a CIDR "10.0.0.0/8" or
// port range "10000-30000". Range is not strongly schema'd here. The Range is expected to define
// a start and end unless there is an implicit end.
@ -2251,8 +2012,8 @@ type RangeAllocation 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 {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Description string `json:"description,omitempty"`
@ -2260,8 +2021,8 @@ type ThirdPartyResource struct {
}
type ThirdPartyResourceList struct {
TypeMeta `json:",inline"`
ListMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
unversioned.ListMeta `json:"metadata,omitempty"`
Items []ThirdPartyResource `json:"items"`
}
@ -2274,8 +2035,8 @@ type APIVersion struct {
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
type ThirdPartyResourceData struct {
TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
unversioned.TypeMeta `json:",inline"`
ObjectMeta `json:"metadata,omitempty"`
Data []byte `json:"name,omitempty"`
}

View File

@ -0,0 +1,271 @@
/*
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 contains API types that are common to all versions.
package unversioned
// 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.
type TypeMeta struct {
// 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
Kind string `json:"kind,omitempty"`
// 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
APIVersion string `json:"apiVersion,omitempty"`
}
// ListMeta describes metadata that synthetic resources must have, including lists and
// various status objects. A resource may have only one of {ObjectMeta, ListMeta}.
type ListMeta struct {
// SelfLink is a URL representing this object.
// Populated by the system.
// Read-only.
SelfLink string `json:"selfLink,omitempty"`
// 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
ResourceVersion string `json:"resourceVersion,omitempty"`
}
// Status is a return value for calls that don't return other objects.
type Status struct {
TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
// Status of the operation.
// One of: "Success" or "Failure".
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
Status string `json:"status,omitempty"`
// A human-readable description of the status of this operation.
Message string `json:"message,omitempty"`
// 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.
Reason StatusReason `json:"reason,omitempty"`
// 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.
Details *StatusDetails `json:"details,omitempty"`
// Suggested HTTP return code for this status, 0 if not set.
Code int `json:"code,omitempty"`
}
// 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.
type StatusDetails struct {
// The name attribute of the resource associated with the status StatusReason
// (when there is a single name which can be described).
Name string `json:"name,omitempty"`
// 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
Kind string `json:"kind,omitempty"`
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
Causes []StatusCause `json:"causes,omitempty"`
// If specified, the time in seconds before the operation should be retried.
RetryAfterSeconds int `json:"retryAfterSeconds,omitempty"`
}
// Values of Status.Status
const (
StatusSuccess = "Success"
StatusFailure = "Failure"
)
// StatusReason is an enumeration of possible failure causes. Each StatusReason
// must map to a single HTTP status code, but multiple reasons may map
// to the same HTTP status code.
// TODO: move to apiserver
type StatusReason string
const (
// StatusReasonUnknown means the server has declined to indicate a specific reason.
// The details field may contain other information about this error.
// Status code 500.
StatusReasonUnknown StatusReason = ""
// StatusReasonUnauthorized means the server can be reached and understood the request, but requires
// the user to present appropriate authorization credentials (identified by the WWW-Authenticate header)
// in order for the action to be completed. If the user has specified credentials on the request, the
// server considers them insufficient.
// Status code 401
StatusReasonUnauthorized StatusReason = "Unauthorized"
// StatusReasonForbidden means the server can be reached and understood the request, but refuses
// to take any further action. It is the result of the server being configured to deny access for some reason
// to the requested resource by the client.
// Details (optional):
// "kind" string - the kind attribute of the forbidden resource
// on some operations may differ from the requested
// resource.
// "id" string - the identifier of the forbidden resource
// Status code 403
StatusReasonForbidden StatusReason = "Forbidden"
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// Details (optional):
// "kind" string - the kind attribute of the missing resource
// on some operations may differ from the requested
// resource.
// "id" string - the identifier of the missing resource
// Status code 404
StatusReasonNotFound StatusReason = "NotFound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
StatusReasonAlreadyExists StatusReason = "AlreadyExists"
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// conflict.
// Status code 409
StatusReasonConflict StatusReason = "Conflict"
// StatusReasonInvalid means the requested create or update operation cannot be
// completed due to invalid data provided as part of the request. The client may
// need to alter the request. When set, the client may use the StatusDetails
// message field as a summary of the issues encountered.
// Details (optional):
// "kind" string - the kind attribute of the invalid resource
// "id" string - the identifier of the invalid resource
// "causes" - one or more StatusCause entries indicating the data in the
// provided resource that was invalid. The code, message, and
// field attributes will be set.
// Status code 422
StatusReasonInvalid StatusReason = "Invalid"
// StatusReasonServerTimeout means the server can be reached and understood the request,
// but cannot complete the action in a reasonable time. The client should retry the request.
// This is may be due to temporary server load or a transient communication issue with
// another server. Status code 500 is used because the HTTP spec provides no suitable
// server-requested client retry and the 5xx class represents actionable errors.
// Details (optional):
// "kind" string - the kind attribute of the resource being acted on.
// "id" string - the operation that is being attempted.
// "retryAfterSeconds" int - the number of seconds before the operation should be retried
// Status code 500
StatusReasonServerTimeout StatusReason = "ServerTimeout"
// StatusReasonTimeout means that the request could not be completed within the given time.
// Clients can get this response only when they specified a timeout param in the request,
// or if the server cannot complete the operation within a reasonable amount of time.
// The request might succeed with an increased value of timeout param. The client *should*
// wait at least the number of seconds specified by the retryAfterSeconds field.
// Details (optional):
// "retryAfterSeconds" int - the number of seconds before the operation should be retried
// Status code 504
StatusReasonTimeout StatusReason = "Timeout"
// StatusReasonBadRequest means that the request itself was invalid, because the request
// doesn't make any sense, for example deleting a read-only object. This is different than
// StatusReasonInvalid above which indicates that the API call could possibly succeed, but the
// data was invalid. API calls that return BadRequest can never succeed.
StatusReasonBadRequest StatusReason = "BadRequest"
// StatusReasonMethodNotAllowed means that the action the client attempted to perform on the
// resource was not supported by the code - for instance, attempting to delete a resource that
// can only be created. API calls that return MethodNotAllowed can never succeed.
StatusReasonMethodNotAllowed StatusReason = "MethodNotAllowed"
// StatusReasonInternalError indicates that an internal error occurred, it is unexpected
// and the outcome of the call is unknown.
// Details (optional):
// "causes" - The original error
// Status code 500
StatusReasonInternalError = "InternalError"
// StatusReasonServiceUnavailable means that the request itself was valid,
// but the requested service is unavailable at this time.
// Retrying the request after some time might succeed.
// Status code 503
StatusReasonServiceUnavailable StatusReason = "ServiceUnavailable"
)
// StatusCause provides more information about an api.Status failure, including
// cases when multiple errors are encountered.
type StatusCause struct {
// A machine-readable description of the cause of the error. If this value is
// empty there is no information available.
Type CauseType `json:"reason,omitempty"`
// A human-readable description of the cause of the error. This field may be
// presented as-is to a reader.
Message string `json:"message,omitempty"`
// 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.
//
// Examples:
// "name" - the field "name" on the current resource
// "items[0].name" - the field "name" on the first array entry in "items"
Field string `json:"field,omitempty"`
}
// CauseType is a machine readable value providing more detail about what
// occurred in a status response. An operation may have multiple causes for a
// status (whether Failure or Success).
type CauseType string
const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound"
// CauseTypeFieldValueRequired is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired CauseType = "FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// unique (e.g. unique IDs).
CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate"
// CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex
// match).
CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid"
// CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
// values that can not be handled (e.g. an enumerated string).
CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
// CauseTypeUnexpectedServerResponse is used to report when the server responded to the client
// without the expected return type. The presence of this cause indicates the error may be
// due to an intervening proxy or the server software malfunctioning.
CauseTypeUnexpectedServerResponse CauseType = "UnexpectedServerResponse"
)
func (*Status) IsAnAPIObject() {}

View File

@ -23,6 +23,7 @@ import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
@ -896,9 +897,9 @@ func convert_api_List_To_v1_List(in *api.List, out *List, s conversion.Scope) er
return nil
}
func convert_api_ListMeta_To_v1_ListMeta(in *api.ListMeta, out *ListMeta, s conversion.Scope) error {
func convert_api_ListMeta_To_v1_ListMeta(in *unversioned.ListMeta, out *unversioned.ListMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.ListMeta))(in)
defaulting.(func(*unversioned.ListMeta))(in)
}
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
@ -2247,9 +2248,9 @@ func convert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *S
return nil
}
func convert_api_Status_To_v1_Status(in *api.Status, out *Status, s conversion.Scope) error {
func convert_api_Status_To_v1_Status(in *unversioned.Status, out *unversioned.Status, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.Status))(in)
defaulting.(func(*unversioned.Status))(in)
}
if err := convert_api_TypeMeta_To_v1_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
@ -2259,9 +2260,9 @@ func convert_api_Status_To_v1_Status(in *api.Status, out *Status, s conversion.S
}
out.Status = in.Status
out.Message = in.Message
out.Reason = StatusReason(in.Reason)
out.Reason = unversioned.StatusReason(in.Reason)
if in.Details != nil {
out.Details = new(StatusDetails)
out.Details = new(unversioned.StatusDetails)
if err := convert_api_StatusDetails_To_v1_StatusDetails(in.Details, out.Details, s); err != nil {
return err
}
@ -2272,24 +2273,24 @@ func convert_api_Status_To_v1_Status(in *api.Status, out *Status, s conversion.S
return nil
}
func convert_api_StatusCause_To_v1_StatusCause(in *api.StatusCause, out *StatusCause, s conversion.Scope) error {
func convert_api_StatusCause_To_v1_StatusCause(in *unversioned.StatusCause, out *unversioned.StatusCause, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.StatusCause))(in)
defaulting.(func(*unversioned.StatusCause))(in)
}
out.Type = CauseType(in.Type)
out.Type = unversioned.CauseType(in.Type)
out.Message = in.Message
out.Field = in.Field
return nil
}
func convert_api_StatusDetails_To_v1_StatusDetails(in *api.StatusDetails, out *StatusDetails, s conversion.Scope) error {
func convert_api_StatusDetails_To_v1_StatusDetails(in *unversioned.StatusDetails, out *unversioned.StatusDetails, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.StatusDetails))(in)
defaulting.(func(*unversioned.StatusDetails))(in)
}
out.Name = in.Name
out.Kind = in.Kind
if in.Causes != nil {
out.Causes = make([]StatusCause, len(in.Causes))
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
for i := range in.Causes {
if err := convert_api_StatusCause_To_v1_StatusCause(&in.Causes[i], &out.Causes[i], s); err != nil {
return err
@ -2312,9 +2313,9 @@ func convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction,
return nil
}
func convert_api_TypeMeta_To_v1_TypeMeta(in *api.TypeMeta, out *TypeMeta, s conversion.Scope) error {
func convert_api_TypeMeta_To_v1_TypeMeta(in *unversioned.TypeMeta, out *unversioned.TypeMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.TypeMeta))(in)
defaulting.(func(*unversioned.TypeMeta))(in)
}
out.Kind = in.Kind
out.APIVersion = in.APIVersion
@ -3331,9 +3332,9 @@ func convert_v1_List_To_api_List(in *List, out *api.List, s conversion.Scope) er
return nil
}
func convert_v1_ListMeta_To_api_ListMeta(in *ListMeta, out *api.ListMeta, s conversion.Scope) error {
func convert_v1_ListMeta_To_api_ListMeta(in *unversioned.ListMeta, out *unversioned.ListMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*ListMeta))(in)
defaulting.(func(*unversioned.ListMeta))(in)
}
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
@ -4682,9 +4683,9 @@ func convert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.S
return nil
}
func convert_v1_Status_To_api_Status(in *Status, out *api.Status, s conversion.Scope) error {
func convert_v1_Status_To_api_Status(in *unversioned.Status, out *unversioned.Status, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*Status))(in)
defaulting.(func(*unversioned.Status))(in)
}
if err := convert_v1_TypeMeta_To_api_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
return err
@ -4694,9 +4695,9 @@ func convert_v1_Status_To_api_Status(in *Status, out *api.Status, s conversion.S
}
out.Status = in.Status
out.Message = in.Message
out.Reason = api.StatusReason(in.Reason)
out.Reason = unversioned.StatusReason(in.Reason)
if in.Details != nil {
out.Details = new(api.StatusDetails)
out.Details = new(unversioned.StatusDetails)
if err := convert_v1_StatusDetails_To_api_StatusDetails(in.Details, out.Details, s); err != nil {
return err
}
@ -4707,24 +4708,24 @@ func convert_v1_Status_To_api_Status(in *Status, out *api.Status, s conversion.S
return nil
}
func convert_v1_StatusCause_To_api_StatusCause(in *StatusCause, out *api.StatusCause, s conversion.Scope) error {
func convert_v1_StatusCause_To_api_StatusCause(in *unversioned.StatusCause, out *unversioned.StatusCause, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*StatusCause))(in)
defaulting.(func(*unversioned.StatusCause))(in)
}
out.Type = api.CauseType(in.Type)
out.Type = unversioned.CauseType(in.Type)
out.Message = in.Message
out.Field = in.Field
return nil
}
func convert_v1_StatusDetails_To_api_StatusDetails(in *StatusDetails, out *api.StatusDetails, s conversion.Scope) error {
func convert_v1_StatusDetails_To_api_StatusDetails(in *unversioned.StatusDetails, out *unversioned.StatusDetails, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*StatusDetails))(in)
defaulting.(func(*unversioned.StatusDetails))(in)
}
out.Name = in.Name
out.Kind = in.Kind
if in.Causes != nil {
out.Causes = make([]api.StatusCause, len(in.Causes))
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
for i := range in.Causes {
if err := convert_v1_StatusCause_To_api_StatusCause(&in.Causes[i], &out.Causes[i], s); err != nil {
return err
@ -4747,9 +4748,9 @@ func convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out
return nil
}
func convert_v1_TypeMeta_To_api_TypeMeta(in *TypeMeta, out *api.TypeMeta, s conversion.Scope) error {
func convert_v1_TypeMeta_To_api_TypeMeta(in *unversioned.TypeMeta, out *unversioned.TypeMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*TypeMeta))(in)
defaulting.(func(*unversioned.TypeMeta))(in)
}
out.Kind = in.Kind
out.APIVersion = in.APIVersion

View File

@ -23,6 +23,7 @@ import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
runtime "k8s.io/kubernetes/pkg/runtime"
util "k8s.io/kubernetes/pkg/util"
@ -790,7 +791,7 @@ func deepCopy_v1_List(in List, out *List, c *conversion.Cloner) error {
return nil
}
func deepCopy_v1_ListMeta(in ListMeta, out *ListMeta, c *conversion.Cloner) error {
func deepCopy_v1_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error {
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
return nil
@ -2030,7 +2031,7 @@ func deepCopy_v1_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *conversi
return nil
}
func deepCopy_v1_Status(in Status, out *Status, c *conversion.Cloner) error {
func deepCopy_v1_Status(in unversioned.Status, out *unversioned.Status, c *conversion.Cloner) error {
if err := deepCopy_v1_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
return err
}
@ -2041,7 +2042,7 @@ func deepCopy_v1_Status(in Status, out *Status, c *conversion.Cloner) error {
out.Message = in.Message
out.Reason = in.Reason
if in.Details != nil {
out.Details = new(StatusDetails)
out.Details = new(unversioned.StatusDetails)
if err := deepCopy_v1_StatusDetails(*in.Details, out.Details, c); err != nil {
return err
}
@ -2052,18 +2053,18 @@ func deepCopy_v1_Status(in Status, out *Status, c *conversion.Cloner) error {
return nil
}
func deepCopy_v1_StatusCause(in StatusCause, out *StatusCause, c *conversion.Cloner) error {
func deepCopy_v1_StatusCause(in unversioned.StatusCause, out *unversioned.StatusCause, c *conversion.Cloner) error {
out.Type = in.Type
out.Message = in.Message
out.Field = in.Field
return nil
}
func deepCopy_v1_StatusDetails(in StatusDetails, out *StatusDetails, c *conversion.Cloner) error {
func deepCopy_v1_StatusDetails(in unversioned.StatusDetails, out *unversioned.StatusDetails, c *conversion.Cloner) error {
out.Name = in.Name
out.Kind = in.Kind
if in.Causes != nil {
out.Causes = make([]StatusCause, len(in.Causes))
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
for i := range in.Causes {
if err := deepCopy_v1_StatusCause(in.Causes[i], &out.Causes[i], c); err != nil {
return err
@ -2083,7 +2084,7 @@ func deepCopy_v1_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *co
return nil
}
func deepCopy_v1_TypeMeta(in TypeMeta, out *TypeMeta, c *conversion.Cloner) error {
func deepCopy_v1_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error {
out.Kind = in.Kind
out.APIVersion = in.APIVersion
return nil

View File

@ -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() {}

View File

@ -18,6 +18,7 @@ package v1
import (
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/types"
"k8s.io/kubernetes/pkg/util"
@ -62,41 +63,6 @@ import (
// Hypens ('-') cannot be leading or trailing character of the string
// and cannot be adjacent to other hyphens.
// 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.
type TypeMeta struct {
// 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
Kind string `json:"kind,omitempty"`
// 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
APIVersion string `json:"apiVersion,omitempty"`
}
// ListMeta describes metadata that synthetic resources must have, including lists and
// various status objects.
type ListMeta struct {
// SelfLink is a URL representing this object.
// Populated by the system.
// Read-only.
SelfLink string `json:"selfLink,omitempty"`
// 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
ResourceVersion string `json:"resourceVersion,omitempty"`
}
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
// users must create.
type ObjectMeta struct {
@ -342,7 +308,7 @@ type PersistentVolumeSource struct {
// It is analogous to a node.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md
type PersistentVolume struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -410,10 +376,10 @@ type PersistentVolumeStatus struct {
// PersistentVolumeList is a list of PersistentVolume items.
type PersistentVolumeList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of persistent volumes.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md
Items []PersistentVolume `json:"items"`
@ -421,7 +387,7 @@ type PersistentVolumeList struct {
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
type PersistentVolumeClaim struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -438,10 +404,10 @@ type PersistentVolumeClaim struct {
// PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
type PersistentVolumeClaimList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// A list of persistent volume claims.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#persistentvolumeclaims
Items []PersistentVolumeClaim `json:"items"`
@ -1271,7 +1237,7 @@ type PodStatus struct {
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
type PodStatusResult struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1286,7 +1252,7 @@ type PodStatusResult struct {
// Pod is a collection of containers that can run on a host. This resource is created
// by clients and scheduled onto hosts.
type Pod struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1305,10 +1271,10 @@ type Pod struct {
// PodList is a list of Pods.
type PodList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of pods.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/pods.md
@ -1328,7 +1294,7 @@ type PodTemplateSpec struct {
// PodTemplate describes a template for creating copies of a predefined pod.
type PodTemplate struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1340,10 +1306,10 @@ type PodTemplate struct {
// PodTemplateList is a list of PodTemplates.
type PodTemplateList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of pod templates
Items []PodTemplate `json:"items"`
@ -1388,7 +1354,7 @@ type ReplicationControllerStatus struct {
// ReplicationController represents the configuration of a replication controller.
type ReplicationController struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// If the Labels of a ReplicationController are empty, they are defaulted to
// be the same as the Pod(s) that the replication controller manages.
@ -1409,10 +1375,10 @@ type ReplicationController struct {
// ReplicationControllerList is a collection of replication controllers.
type ReplicationControllerList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of replication controllers.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md
@ -1556,7 +1522,7 @@ type ServicePort struct {
// (for example 3306) that the proxy listens on, and the selector that determines which pods
// will answer requests sent through the proxy.
type Service struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1580,10 +1546,10 @@ const (
// ServiceList holds a list of services.
type ServiceList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of services
Items []Service `json:"items"`
@ -1594,7 +1560,7 @@ type ServiceList struct {
// * a principal that can be authenticated and authorized
// * a set of secrets
type ServiceAccount struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1612,10 +1578,10 @@ type ServiceAccount struct {
// ServiceAccountList is a list of ServiceAccount objects
type ServiceAccountList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of ServiceAccounts.
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md#service-accounts
@ -1635,7 +1601,7 @@ type ServiceAccountList struct {
// },
// ]
type Endpoints struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1702,10 +1668,10 @@ type EndpointPort struct {
// EndpointsList is a list of endpoints.
type EndpointsList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of endpoints.
Items []Endpoints `json:"items"`
@ -1852,7 +1818,7 @@ type ResourceList map[ResourceName]resource.Quantity
// Node is a worker node in Kubernetes, formerly known as minion.
// Each node will have a unique identifier in the cache (i.e. in etcd).
type Node struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1870,10 +1836,10 @@ type Node struct {
// NodeList is the whole list of all Nodes which have been registered with master.
type NodeList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of nodes
Items []Node `json:"items"`
@ -1913,7 +1879,7 @@ const (
// Namespace provides a scope for Names.
// Use of multiple namespaces is optional.
type Namespace struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1929,10 +1895,10 @@ type Namespace struct {
// NamespaceList is a list of Namespaces.
type NamespaceList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is the list of Namespace objects in the list.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md
@ -1942,7 +1908,7 @@ type NamespaceList struct {
// Binding ties one object to another.
// For example, a pod is bound to a node by a scheduler.
type Binding struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -1953,7 +1919,7 @@ type Binding struct {
// DeleteOptions may be provided when deleting an API object
type DeleteOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// The duration in seconds before the object should be deleted. Value must be non-negative integer.
// The value zero indicates delete immediately. If this value is nil, the default grace period for the
@ -1964,7 +1930,7 @@ type DeleteOptions struct {
// ListOptions is the query options to a standard REST list call.
type ListOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// A selector to restrict the list of returned objects by their labels.
// Defaults to everything.
@ -1982,7 +1948,7 @@ type ListOptions struct {
// PodLogOptions is the query options for a Pod's logs REST call.
type PodLogOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// The container for which to stream logs. Defaults to only container if there is one container in the pod.
Container string `json:"container,omitempty"`
@ -2001,7 +1967,7 @@ type PodLogOptions struct {
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
// and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY
type PodAttachOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Stdin if true, redirects the standard input stream of the pod for this call.
// Defaults to false.
@ -2031,7 +1997,7 @@ type PodAttachOptions struct {
// TODO: This is largely identical to PodAttachOptions above, make sure they stay in sync and see about merging
// and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY
type PodExecOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Redirect the standard input stream of the pod for this call.
// Defaults to false.
@ -2059,170 +2025,12 @@ type PodExecOptions struct {
// PodProxyOptions is the query options to a Pod's proxy call.
type PodProxyOptions struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Path is the URL path to use for the current proxy request to pod.
Path string `json:"path,omitempty"`
}
// Status is a return value for calls that don't return other objects.
type Status struct {
TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
// Status of the operation.
// One of: "Success" or "Failure".
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
Status string `json:"status,omitempty"`
// A human-readable description of the status of this operation.
Message string `json:"message,omitempty"`
// 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.
Reason StatusReason `json:"reason,omitempty"`
// 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.
Details *StatusDetails `json:"details,omitempty"`
// Suggested HTTP return code for this status, 0 if not set.
Code int `json:"code,omitempty"`
}
// 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.
type StatusDetails struct {
// The name attribute of the resource associated with the status StatusReason
// (when there is a single name which can be described).
Name string `json:"name,omitempty"`
// 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
Kind string `json:"kind,omitempty"`
// The Causes array includes more details associated with the StatusReason
// failure. Not all StatusReasons may provide detailed causes.
Causes []StatusCause `json:"causes,omitempty"`
// If specified, the time in seconds before the operation should be retried.
RetryAfterSeconds int `json:"retryAfterSeconds,omitempty"`
}
// Values of Status.Status
const (
StatusSuccess = "Success"
StatusFailure = "Failure"
)
// StatusReason is an enumeration of possible failure causes. Each StatusReason
// must map to a single HTTP status code, but multiple reasons may map
// to the same HTTP status code.
// TODO: move to apiserver
type StatusReason string
const (
// StatusReasonUnknown means the server has declined to indicate a specific reason.
// The details field may contain other information about this error.
// Status code 500.
StatusReasonUnknown StatusReason = ""
// StatusReasonNotFound means one or more resources required for this operation
// could not be found.
// Details (optional):
// "kind" string - the kind attribute of the missing resource
// on some operations may differ from the requested
// resource.
// "id" string - the identifier of the missing resource
// Status code 404
StatusReasonNotFound StatusReason = "NotFound"
// StatusReasonAlreadyExists means the resource you are creating already exists.
// Details (optional):
// "kind" string - the kind attribute of the conflicting resource
// "id" string - the identifier of the conflicting resource
// Status code 409
StatusReasonAlreadyExists StatusReason = "AlreadyExists"
// StatusReasonConflict means the requested update operation cannot be completed
// due to a conflict in the operation. The client may need to alter the request.
// Each resource may define custom details that indicate the nature of the
// conflict.
// Status code 409
StatusReasonConflict StatusReason = "Conflict"
// StatusReasonInvalid means the requested create or update operation cannot be
// completed due to invalid data provided as part of the request. The client may
// need to alter the request. When set, the client may use the StatusDetails
// message field as a summary of the issues encountered.
// Details (optional):
// "kind" string - the kind attribute of the invalid resource
// "id" string - the identifier of the invalid resource
// "causes" - one or more StatusCause entries indicating the data in the
// provided resource that was invalid. The code, message, and
// field attributes will be set.
// Status code 422
StatusReasonInvalid StatusReason = "Invalid"
// StatusReasonServerTimeout means the server can be reached and understood the request,
// but cannot complete the action in a reasonable time. The client should retry the request.
// This is may be due to temporary server load or a transient communication issue with
// another server. Status code 500 is used because the HTTP spec provides no suitable
// server-requested client retry and the 5xx class represents actionable errors.
// Details (optional):
// "kind" string - the kind attribute of the resource being acted on.
// "id" string - the operation that is being attempted.
// Status code 500
StatusReasonServerTimeout StatusReason = "ServerTimeout"
)
// StatusCause provides more information about an api.Status failure, including
// cases when multiple errors are encountered.
type StatusCause struct {
// A machine-readable description of the cause of the error. If this value is
// empty there is no information available.
Type CauseType `json:"reason,omitempty"`
// A human-readable description of the cause of the error. This field may be
// presented as-is to a reader.
Message string `json:"message,omitempty"`
// 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.
//
// Examples:
// "name" - the field "name" on the current resource
// "items[0].name" - the field "name" on the first array entry in "items"
Field string `json:"field,omitempty"`
}
// CauseType is a machine readable value providing more detail about what
// occurred in a status response. An operation may have multiple causes for a
// status (whether Failure or Success).
type CauseType string
const (
// CauseTypeFieldValueNotFound is used to report failure to find a requested value
// (e.g. looking up an ID).
CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound"
// CauseTypeFieldValueRequired is used to report required values that are not
// provided (e.g. empty strings, null values, or empty arrays).
CauseTypeFieldValueRequired CauseType = "FieldValueRequired"
// CauseTypeFieldValueDuplicate is used to report collisions of values that must be
// unique (e.g. unique IDs).
CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate"
// CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex
// match).
CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid"
// CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules)
// values that can not be handled (e.g. an enumerated string).
CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported"
)
// ObjectReference contains enough information to let you inspect or modify the referred object.
type ObjectReference struct {
// Kind of the referent.
@ -2265,7 +2073,7 @@ type LocalObjectReference struct {
// SerializedReference is a reference to serialized object.
type SerializedReference struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// The reference to an object in the system.
Reference ObjectReference `json:"reference,omitempty"`
}
@ -2281,7 +2089,7 @@ type EventSource struct {
// Event is a report of an event somewhere in the cluster.
// TODO: Decide whether to store these separately or with the object they apply to.
type Event struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata"`
@ -2313,10 +2121,10 @@ type Event struct {
// EventList is a list of events.
type EventList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of events
Items []Event `json:"items"`
@ -2324,10 +2132,10 @@ type EventList struct {
// List holds a list of objects, which may not be known by the server.
type List struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of objects
Items []runtime.RawExtension `json:"items"`
@ -2367,7 +2175,7 @@ type LimitRangeSpec struct {
// LimitRange sets resource usage limits for each kind of resource in a Namespace.
type LimitRange struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -2379,10 +2187,10 @@ type LimitRange struct {
// LimitRangeList is a list of LimitRange items.
type LimitRangeList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of LimitRange objects.
// More info: http://releases.k8s.io/HEAD/docs/design/admission_control_limit_range.md
@ -2423,7 +2231,7 @@ type ResourceQuotaStatus struct {
// ResourceQuota sets aggregate quota restrictions enforced per namespace
type ResourceQuota struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -2439,10 +2247,10 @@ type ResourceQuota struct {
// ResourceQuotaList is a list of ResourceQuota items.
type ResourceQuotaList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of ResourceQuota objects.
// More info: http://releases.k8s.io/HEAD/docs/design/admission_control_resource_quota.md#admissioncontrol-plugin-resourcequota
@ -2452,7 +2260,7 @@ type ResourceQuotaList struct {
// Secret holds secret data of a certain type. The total bytes of the values in
// the Data field must be less than MaxSecretSize bytes.
type Secret struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -2507,10 +2315,10 @@ const (
// SecretList is a list of Secret.
type SecretList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of secret objects.
// More info: http://releases.k8s.io/HEAD/docs/user-guide/secrets.md
@ -2543,7 +2351,7 @@ type ComponentCondition struct {
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
type ComponentStatus struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -2554,10 +2362,10 @@ type ComponentStatus struct {
// Status of all the conditions for the component as a list of ComponentStatus objects.
type ComponentStatusList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// List of ComponentStatus objects.
Items []ComponentStatus `json:"items"`
@ -2627,7 +2435,7 @@ type SELinuxOptions struct {
// RangeAllocation is not a public type.
type RangeAllocation struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -2641,7 +2449,7 @@ type RangeAllocation 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 {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`
@ -2655,10 +2463,10 @@ type ThirdPartyResource struct {
// ThirdPartyResourceList is a list of ThirdPartyResource.
type ThirdPartyResourceList struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ListMeta `json:"metadata,omitempty"`
unversioned.ListMeta `json:"metadata,omitempty"`
// Items is a list of schema objects.
Items []ThirdPartyResource `json:"items"`
@ -2675,7 +2483,7 @@ type APIVersion struct {
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
type ThirdPartyResourceData struct {
TypeMeta `json:",inline"`
unversioned.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
ObjectMeta `json:"metadata,omitempty"`

View File

@ -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",

View File

@ -23,6 +23,7 @@ import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
util "k8s.io/kubernetes/pkg/util"
inf "speter.net/go/exp/math/dec/inf"
@ -345,7 +346,7 @@ func deepCopy_api_Lifecycle(in api.Lifecycle, out *api.Lifecycle, c *conversion.
return nil
}
func deepCopy_api_ListMeta(in api.ListMeta, out *api.ListMeta, c *conversion.Cloner) error {
func deepCopy_api_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error {
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
return nil
@ -605,7 +606,7 @@ func deepCopy_api_TCPSocketAction(in api.TCPSocketAction, out *api.TCPSocketActi
return nil
}
func deepCopy_api_TypeMeta(in api.TypeMeta, out *api.TypeMeta, c *conversion.Cloner) error {
func deepCopy_api_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error {
out.Kind = in.Kind
out.APIVersion = in.APIVersion
return nil

View File

@ -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"`

View File

@ -23,6 +23,7 @@ import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
experimental "k8s.io/kubernetes/pkg/apis/experimental"
conversion "k8s.io/kubernetes/pkg/conversion"
@ -405,9 +406,9 @@ func convert_api_Lifecycle_To_v1_Lifecycle(in *api.Lifecycle, out *v1.Lifecycle,
return nil
}
func convert_api_ListMeta_To_v1_ListMeta(in *api.ListMeta, out *v1.ListMeta, s conversion.Scope) error {
func convert_api_ListMeta_To_v1_ListMeta(in *unversioned.ListMeta, out *unversioned.ListMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.ListMeta))(in)
defaulting.(func(*unversioned.ListMeta))(in)
}
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
@ -646,9 +647,9 @@ func convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction,
return nil
}
func convert_api_TypeMeta_To_v1_TypeMeta(in *api.TypeMeta, out *v1.TypeMeta, s conversion.Scope) error {
func convert_api_TypeMeta_To_v1_TypeMeta(in *unversioned.TypeMeta, out *unversioned.TypeMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*api.TypeMeta))(in)
defaulting.(func(*unversioned.TypeMeta))(in)
}
out.Kind = in.Kind
out.APIVersion = in.APIVersion
@ -1172,9 +1173,9 @@ func convert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle,
return nil
}
func convert_v1_ListMeta_To_api_ListMeta(in *v1.ListMeta, out *api.ListMeta, s conversion.Scope) error {
func convert_v1_ListMeta_To_api_ListMeta(in *unversioned.ListMeta, out *unversioned.ListMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*v1.ListMeta))(in)
defaulting.(func(*unversioned.ListMeta))(in)
}
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
@ -1413,9 +1414,9 @@ func convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *v1.TCPSocketAction, o
return nil
}
func convert_v1_TypeMeta_To_api_TypeMeta(in *v1.TypeMeta, out *api.TypeMeta, s conversion.Scope) error {
func convert_v1_TypeMeta_To_api_TypeMeta(in *unversioned.TypeMeta, out *unversioned.TypeMeta, s conversion.Scope) error {
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
defaulting.(func(*v1.TypeMeta))(in)
defaulting.(func(*unversioned.TypeMeta))(in)
}
out.Kind = in.Kind
out.APIVersion = in.APIVersion

View File

@ -23,6 +23,7 @@ import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion"
util "k8s.io/kubernetes/pkg/util"
@ -362,7 +363,7 @@ func deepCopy_v1_Lifecycle(in v1.Lifecycle, out *v1.Lifecycle, c *conversion.Clo
return nil
}
func deepCopy_v1_ListMeta(in v1.ListMeta, out *v1.ListMeta, c *conversion.Cloner) error {
func deepCopy_v1_ListMeta(in unversioned.ListMeta, out *unversioned.ListMeta, c *conversion.Cloner) error {
out.SelfLink = in.SelfLink
out.ResourceVersion = in.ResourceVersion
return nil
@ -623,7 +624,7 @@ func deepCopy_v1_TCPSocketAction(in v1.TCPSocketAction, out *v1.TCPSocketAction,
return nil
}
func deepCopy_v1_TypeMeta(in v1.TypeMeta, out *v1.TypeMeta, c *conversion.Cloner) error {
func deepCopy_v1_TypeMeta(in unversioned.TypeMeta, out *unversioned.TypeMeta, c *conversion.Cloner) error {
out.Kind = in.Kind
out.APIVersion = in.APIVersion
return nil

View File

@ -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"`

View File

@ -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",
},
}

View File

@ -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)
}
}

View File

@ -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(),
}
}

View File

@ -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",
},

View File

@ -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

View File

@ -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)

View File

@ -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)
}

View File

@ -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.

View File

@ -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)

View File

@ -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)}
}

View File

@ -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
}),

View File

@ -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,

View File

@ -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)

View File

@ -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",

View File

@ -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{{

View File

@ -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",

View File

@ -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{
{

View File

@ -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{

View File

@ -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,

View File

@ -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)

View File

@ -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
`,

View File

@ -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{

View File

@ -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,
},
}

View File

@ -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,

View File

@ -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,
}

View File

@ -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{

View File

@ -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{

View File

@ -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: "",
},

View File

@ -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",
},

View File

@ -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(),
},

View File

@ -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 {

View File

@ -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

View File

@ -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) {

View File

@ -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",

View File

@ -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

View File

@ -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
}

View File

@ -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) {

View File

@ -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)

View File

@ -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",
},

View File

@ -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"},

View File

@ -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(),
},
})

View File

@ -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)
}

View File

@ -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)

View File

@ -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}
}
}

View File

@ -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

View File

@ -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

View File

@ -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{

View File

@ -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,
},

View File

@ -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,
},

View File

@ -18,12 +18,14 @@ package e2e
import (
"fmt"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/latest"
client "k8s.io/kubernetes/pkg/client/unversioned"
"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"
. "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,
},

View File

@ -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{

View File

@ -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,
},

View File

@ -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(),
},

View File

@ -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,
},

View File

@ -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{

View File

@ -33,10 +33,12 @@ package e2e
import (
"fmt"
"k8s.io/kubernetes/pkg/api"
client "k8s.io/kubernetes/pkg/client/unversioned"
"time"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
client "k8s.io/kubernetes/pkg/client/unversioned"
. "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",
},

View File

@ -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
}