mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Moving Status object to a common package
This commit is contained in:
parent
a32ea8ebc1
commit
f4ad00d9ae
@ -39,6 +39,7 @@ import (
|
|||||||
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/apiserver"
|
"k8s.io/kubernetes/pkg/apiserver"
|
||||||
"k8s.io/kubernetes/pkg/client/record"
|
"k8s.io/kubernetes/pkg/client/record"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
@ -545,7 +546,7 @@ func runSelfLinkTestOnNamespace(c *client.Client, namespace string) {
|
|||||||
|
|
||||||
func runAtomicPutTest(c *client.Client) {
|
func runAtomicPutTest(c *client.Client) {
|
||||||
svcBody := api.Service{
|
svcBody := api.Service{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
APIVersion: c.APIVersion(),
|
APIVersion: c.APIVersion(),
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -627,7 +628,7 @@ func runPatchTest(c *client.Client) {
|
|||||||
name := "patchservice"
|
name := "patchservice"
|
||||||
resource := "services"
|
resource := "services"
|
||||||
svcBody := api.Service{
|
svcBody := api.Service{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
APIVersion: c.APIVersion(),
|
APIVersion: c.APIVersion(),
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
@ -37,6 +37,7 @@ import (
|
|||||||
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/podtask"
|
"k8s.io/kubernetes/contrib/mesos/pkg/scheduler/podtask"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/kubelet"
|
"k8s.io/kubernetes/pkg/kubelet"
|
||||||
@ -660,7 +661,7 @@ func TestExecutorFrameworkMessage(t *testing.T) {
|
|||||||
func NewTestPod(i int) *api.Pod {
|
func NewTestPod(i int) *api.Pod {
|
||||||
name := fmt.Sprintf("pod%d", i)
|
name := fmt.Sprintf("pod%d", i)
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -196,7 +197,7 @@ func NewTestPod() (*api.Pod, int) {
|
|||||||
currentPodNum = currentPodNum + 1
|
currentPodNum = currentPodNum + 1
|
||||||
name := fmt.Sprintf("pod%d", currentPodNum)
|
name := fmt.Sprintf("pod%d", currentPodNum)
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: name,
|
Name: name,
|
||||||
Namespace: api.NamespaceDefault,
|
Namespace: api.NamespaceDefault,
|
||||||
|
@ -41,13 +41,14 @@ find_files() {
|
|||||||
\) \
|
\) \
|
||||||
\( -wholename '*pkg/api/v*/types.go' \
|
\( -wholename '*pkg/api/v*/types.go' \
|
||||||
-o -wholename '*pkg/apis/*/v*/types.go' \
|
-o -wholename '*pkg/apis/*/v*/types.go' \
|
||||||
|
-o -wholename '*pkg/api/unversioned/types.go' \
|
||||||
\)
|
\)
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
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
|
else
|
||||||
versioned_api_files=("${@}")
|
versioned_api_files="${*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in $versioned_api_files; do
|
for file in $versioned_api_files; do
|
||||||
|
@ -47,7 +47,7 @@ cp -a "${APIROOT}" "${TMP_APIROOT}"
|
|||||||
echo "diffing ${APIROOT} against freshly generated swagger type documentation"
|
echo "diffing ${APIROOT} against freshly generated swagger type documentation"
|
||||||
ret=0
|
ret=0
|
||||||
diff -Naupr -I 'Auto generated by' "${APIROOT}" "${TMP_APIROOT}" || ret=$?
|
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}"
|
rm -rf "${_tmp}"
|
||||||
if [[ $ret -eq 0 ]]
|
if [[ $ret -eq 0 ]]
|
||||||
then
|
then
|
||||||
|
@ -29,9 +29,9 @@ function generate_version() {
|
|||||||
|
|
||||||
echo "Generating swagger type docs for ${group_version}"
|
echo "Generating swagger type docs for ${group_version}"
|
||||||
|
|
||||||
sed 's/YEAR/2015/' hack/boilerplate/boilerplate.go.txt > $TMPFILE
|
sed 's/YEAR/2015/' hack/boilerplate/boilerplate.go.txt > "$TMPFILE"
|
||||||
echo "package ${group_version##*/}" >> $TMPFILE
|
echo "package ${group_version##*/}" >> "$TMPFILE"
|
||||||
cat >> $TMPFILE <<EOF
|
cat >> "$TMPFILE" <<EOF
|
||||||
|
|
||||||
// This file contains a collection of methods that can be used from go-resful to
|
// 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
|
// 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 \
|
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 - \
|
"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
|
gofmt -w -s "$TMPFILE"
|
||||||
mv $TMPFILE "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"
|
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.
|
# 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"
|
rm -f "pkg/$(kube::util::group-version-to-pkg-path "${group_version}")/types_swagger_doc_generated.go"
|
||||||
done
|
done
|
||||||
for group_version in $GROUP_VERSIONS; do
|
for group_version in "${GROUP_VERSIONS[@]}"; do
|
||||||
generate_version "${group_version}"
|
generate_version "${group_version}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
time "time"
|
time "time"
|
||||||
|
|
||||||
resource "k8s.io/kubernetes/pkg/api/resource"
|
resource "k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||||
fields "k8s.io/kubernetes/pkg/fields"
|
fields "k8s.io/kubernetes/pkg/fields"
|
||||||
labels "k8s.io/kubernetes/pkg/labels"
|
labels "k8s.io/kubernetes/pkg/labels"
|
||||||
@ -779,7 +780,7 @@ func deepCopy_api_List(in List, out *List, c *conversion.Cloner) error {
|
|||||||
return nil
|
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.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
return nil
|
return nil
|
||||||
@ -2025,7 +2026,7 @@ func deepCopy_api_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *convers
|
|||||||
return nil
|
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 {
|
if err := deepCopy_api_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -2036,7 +2037,7 @@ func deepCopy_api_Status(in Status, out *Status, c *conversion.Cloner) error {
|
|||||||
out.Message = in.Message
|
out.Message = in.Message
|
||||||
out.Reason = in.Reason
|
out.Reason = in.Reason
|
||||||
if in.Details != nil {
|
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 {
|
if err := deepCopy_api_StatusDetails(*in.Details, out.Details, c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -2047,18 +2048,18 @@ func deepCopy_api_Status(in Status, out *Status, c *conversion.Cloner) error {
|
|||||||
return nil
|
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.Type = in.Type
|
||||||
out.Message = in.Message
|
out.Message = in.Message
|
||||||
out.Field = in.Field
|
out.Field = in.Field
|
||||||
return nil
|
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.Name = in.Name
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
if in.Causes != nil {
|
if in.Causes != nil {
|
||||||
out.Causes = make([]StatusCause, len(in.Causes))
|
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
|
||||||
for i := range in.Causes {
|
for i := range in.Causes {
|
||||||
if err := deepCopy_api_StatusCause(in.Causes[i], &out.Causes[i], c); err != nil {
|
if err := deepCopy_api_StatusCause(in.Causes[i], &out.Causes[i], c); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -2078,7 +2079,7 @@ func deepCopy_api_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *c
|
|||||||
return nil
|
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.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
return nil
|
return nil
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util/errors"
|
"k8s.io/kubernetes/pkg/util/errors"
|
||||||
"k8s.io/kubernetes/pkg/util/fielderrors"
|
"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
|
// 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.
|
// reconstructed by clients from a REST response. Public to allow easy type switches.
|
||||||
type StatusError struct {
|
type StatusError struct {
|
||||||
ErrStatus api.Status
|
ErrStatus unversioned.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ error = &StatusError{}
|
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
|
// Status allows access to e's status without having to know the detailed workings
|
||||||
// of StatusError. Used by pkg/apiserver.
|
// of StatusError. Used by pkg/apiserver.
|
||||||
func (e *StatusError) Status() api.Status {
|
func (e *StatusError) Status() unversioned.Status {
|
||||||
return e.ErrStatus
|
return e.ErrStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,11 +77,11 @@ func (u *UnexpectedObjectError) Error() string {
|
|||||||
return fmt.Sprintf("unexpected object: %v", u.Object)
|
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.
|
// returns an UnexpecteObjectError.
|
||||||
func FromObject(obj runtime.Object) error {
|
func FromObject(obj runtime.Object) error {
|
||||||
switch t := obj.(type) {
|
switch t := obj.(type) {
|
||||||
case *api.Status:
|
case *unversioned.Status:
|
||||||
return &StatusError{*t}
|
return &StatusError{*t}
|
||||||
}
|
}
|
||||||
return &UnexpectedObjectError{obj}
|
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.
|
// 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 {
|
func NewNotFound(kind, name string) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusNotFound,
|
Code: http.StatusNotFound,
|
||||||
Reason: api.StatusReasonNotFound,
|
Reason: unversioned.StatusReasonNotFound,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
@ -103,11 +103,11 @@ func NewNotFound(kind, name string) error {
|
|||||||
|
|
||||||
// NewAlreadyExists returns an error indicating the item requested exists by that identifier.
|
// NewAlreadyExists returns an error indicating the item requested exists by that identifier.
|
||||||
func NewAlreadyExists(kind, name string) error {
|
func NewAlreadyExists(kind, name string) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusConflict,
|
Code: http.StatusConflict,
|
||||||
Reason: api.StatusReasonAlreadyExists,
|
Reason: unversioned.StatusReasonAlreadyExists,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
Name: name,
|
||||||
},
|
},
|
||||||
@ -122,21 +122,21 @@ func NewUnauthorized(reason string) error {
|
|||||||
if len(message) == 0 {
|
if len(message) == 0 {
|
||||||
message = "not authorized"
|
message = "not authorized"
|
||||||
}
|
}
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusUnauthorized,
|
Code: http.StatusUnauthorized,
|
||||||
Reason: api.StatusReasonUnauthorized,
|
Reason: unversioned.StatusReasonUnauthorized,
|
||||||
Message: message,
|
Message: message,
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewForbidden returns an error indicating the requested action was forbidden
|
// NewForbidden returns an error indicating the requested action was forbidden
|
||||||
func NewForbidden(kind, name string, err error) error {
|
func NewForbidden(kind, name string, err error) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusForbidden,
|
Code: http.StatusForbidden,
|
||||||
Reason: api.StatusReasonForbidden,
|
Reason: unversioned.StatusReasonForbidden,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
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.
|
// NewConflict returns an error indicating the item can't be updated as provided.
|
||||||
func NewConflict(kind, name string, err error) error {
|
func NewConflict(kind, name string, err error) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusConflict,
|
Code: http.StatusConflict,
|
||||||
Reason: api.StatusReasonConflict,
|
Reason: unversioned.StatusReasonConflict,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
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.
|
// NewInvalid returns an error indicating the item is invalid and cannot be processed.
|
||||||
func NewInvalid(kind, name string, errs fielderrors.ValidationErrorList) error {
|
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 {
|
for i := range errs {
|
||||||
if err, ok := errs[i].(*fielderrors.ValidationError); ok {
|
if err, ok := errs[i].(*fielderrors.ValidationError); ok {
|
||||||
causes = append(causes, api.StatusCause{
|
causes = append(causes, unversioned.StatusCause{
|
||||||
Type: api.CauseType(err.Type),
|
Type: unversioned.CauseType(err.Type),
|
||||||
Message: err.ErrorBody(),
|
Message: err.ErrorBody(),
|
||||||
Field: err.Field,
|
Field: err.Field,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: StatusUnprocessableEntity, // RFC 4918: StatusUnprocessableEntity
|
Code: StatusUnprocessableEntity, // RFC 4918: StatusUnprocessableEntity
|
||||||
Reason: api.StatusReasonInvalid,
|
Reason: unversioned.StatusReasonInvalid,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
Name: name,
|
||||||
Causes: causes,
|
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.
|
// NewBadRequest creates an error that indicates that the request is invalid and can not be processed.
|
||||||
func NewBadRequest(reason string) error {
|
func NewBadRequest(reason string) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
Reason: api.StatusReasonBadRequest,
|
Reason: unversioned.StatusReasonBadRequest,
|
||||||
Message: reason,
|
Message: reason,
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewServiceUnavailable creates an error that indicates that the requested service is unavailable.
|
// NewServiceUnavailable creates an error that indicates that the requested service is unavailable.
|
||||||
func NewServiceUnavailable(reason string) error {
|
func NewServiceUnavailable(reason string) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusServiceUnavailable,
|
Code: http.StatusServiceUnavailable,
|
||||||
Reason: api.StatusReasonServiceUnavailable,
|
Reason: unversioned.StatusReasonServiceUnavailable,
|
||||||
Message: reason,
|
Message: reason,
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
|
// NewMethodNotSupported returns an error indicating the requested action is not supported on this kind.
|
||||||
func NewMethodNotSupported(kind, action string) error {
|
func NewMethodNotSupported(kind, action string) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusMethodNotAllowed,
|
Code: http.StatusMethodNotAllowed,
|
||||||
Reason: api.StatusReasonMethodNotAllowed,
|
Reason: unversioned.StatusReasonMethodNotAllowed,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
},
|
},
|
||||||
Message: fmt.Sprintf("%s is not supported on resources of kind %q", action, 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
|
// NewServerTimeout returns an error indicating the requested action could not be completed due to a
|
||||||
// transient error, and the client should try again.
|
// transient error, and the client should try again.
|
||||||
func NewServerTimeout(kind, operation string, retryAfterSeconds int) error {
|
func NewServerTimeout(kind, operation string, retryAfterSeconds int) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusInternalServerError,
|
Code: http.StatusInternalServerError,
|
||||||
Reason: api.StatusReasonServerTimeout,
|
Reason: unversioned.StatusReasonServerTimeout,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: operation,
|
Name: operation,
|
||||||
RetryAfterSeconds: retryAfterSeconds,
|
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.
|
// NewInternalError returns an error indicating the item is invalid and cannot be processed.
|
||||||
func NewInternalError(err error) error {
|
func NewInternalError(err error) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusInternalServerError,
|
Code: http.StatusInternalServerError,
|
||||||
Reason: api.StatusReasonInternalError,
|
Reason: unversioned.StatusReasonInternalError,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Causes: []api.StatusCause{{Message: err.Error()}},
|
Causes: []unversioned.StatusCause{{Message: err.Error()}},
|
||||||
},
|
},
|
||||||
Message: fmt.Sprintf("Internal error occurred: %v", err),
|
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
|
// NewTimeoutError returns an error indicating that a timeout occurred before the request
|
||||||
// could be completed. Clients may retry, but the operation may still complete.
|
// could be completed. Clients may retry, but the operation may still complete.
|
||||||
func NewTimeoutError(message string, retryAfterSeconds int) error {
|
func NewTimeoutError(message string, retryAfterSeconds int) error {
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: StatusServerTimeout,
|
Code: StatusServerTimeout,
|
||||||
Reason: api.StatusReasonTimeout,
|
Reason: unversioned.StatusReasonTimeout,
|
||||||
Message: fmt.Sprintf("Timeout: %s", message),
|
Message: fmt.Sprintf("Timeout: %s", message),
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
RetryAfterSeconds: retryAfterSeconds,
|
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.
|
// 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 {
|
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)
|
message := fmt.Sprintf("the server responded with the status code %d but did not return more information", code)
|
||||||
switch code {
|
switch code {
|
||||||
case http.StatusConflict:
|
case http.StatusConflict:
|
||||||
if verb == "POST" {
|
if verb == "POST" {
|
||||||
reason = api.StatusReasonAlreadyExists
|
reason = unversioned.StatusReasonAlreadyExists
|
||||||
} else {
|
} else {
|
||||||
reason = api.StatusReasonConflict
|
reason = unversioned.StatusReasonConflict
|
||||||
}
|
}
|
||||||
message = "the server reported a conflict"
|
message = "the server reported a conflict"
|
||||||
case http.StatusNotFound:
|
case http.StatusNotFound:
|
||||||
reason = api.StatusReasonNotFound
|
reason = unversioned.StatusReasonNotFound
|
||||||
message = "the server could not find the requested resource"
|
message = "the server could not find the requested resource"
|
||||||
case http.StatusBadRequest:
|
case http.StatusBadRequest:
|
||||||
reason = api.StatusReasonBadRequest
|
reason = unversioned.StatusReasonBadRequest
|
||||||
message = "the server rejected our request for an unknown reason"
|
message = "the server rejected our request for an unknown reason"
|
||||||
case http.StatusUnauthorized:
|
case http.StatusUnauthorized:
|
||||||
reason = api.StatusReasonUnauthorized
|
reason = unversioned.StatusReasonUnauthorized
|
||||||
message = "the server has asked for the client to provide credentials"
|
message = "the server has asked for the client to provide credentials"
|
||||||
case http.StatusForbidden:
|
case http.StatusForbidden:
|
||||||
reason = api.StatusReasonForbidden
|
reason = unversioned.StatusReasonForbidden
|
||||||
message = "the server does not allow access to the requested resource"
|
message = "the server does not allow access to the requested resource"
|
||||||
case http.StatusMethodNotAllowed:
|
case http.StatusMethodNotAllowed:
|
||||||
reason = api.StatusReasonMethodNotAllowed
|
reason = unversioned.StatusReasonMethodNotAllowed
|
||||||
message = "the server does not allow this method on the requested resource"
|
message = "the server does not allow this method on the requested resource"
|
||||||
case StatusUnprocessableEntity:
|
case StatusUnprocessableEntity:
|
||||||
reason = api.StatusReasonInvalid
|
reason = unversioned.StatusReasonInvalid
|
||||||
message = "the server rejected our request due to an error in our request"
|
message = "the server rejected our request due to an error in our request"
|
||||||
case StatusServerTimeout:
|
case StatusServerTimeout:
|
||||||
reason = api.StatusReasonServerTimeout
|
reason = unversioned.StatusReasonServerTimeout
|
||||||
message = "the server cannot complete the requested operation at this time, try again later"
|
message = "the server cannot complete the requested operation at this time, try again later"
|
||||||
case StatusTooManyRequests:
|
case StatusTooManyRequests:
|
||||||
reason = api.StatusReasonTimeout
|
reason = unversioned.StatusReasonTimeout
|
||||||
message = "the server has received too many requests and has asked us to try again later"
|
message = "the server has received too many requests and has asked us to try again later"
|
||||||
default:
|
default:
|
||||||
if code >= 500 {
|
if code >= 500 {
|
||||||
reason = api.StatusReasonInternalError
|
reason = unversioned.StatusReasonInternalError
|
||||||
message = "an error on the server has prevented the request from succeeding"
|
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:
|
case len(kind) > 0:
|
||||||
message = fmt.Sprintf("%s (%s %s)", message, strings.ToLower(verb), kind)
|
message = fmt.Sprintf("%s (%s %s)", message, strings.ToLower(verb), kind)
|
||||||
}
|
}
|
||||||
var causes []api.StatusCause
|
var causes []unversioned.StatusCause
|
||||||
if isUnexpectedResponse {
|
if isUnexpectedResponse {
|
||||||
causes = []api.StatusCause{
|
causes = []unversioned.StatusCause{
|
||||||
{
|
{
|
||||||
Type: api.CauseTypeUnexpectedServerResponse,
|
Type: unversioned.CauseTypeUnexpectedServerResponse,
|
||||||
Message: serverMessage,
|
Message: serverMessage,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
causes = nil
|
causes = nil
|
||||||
}
|
}
|
||||||
return &StatusError{api.Status{
|
return &StatusError{unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: code,
|
Code: code,
|
||||||
Reason: reason,
|
Reason: reason,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
Name: name,
|
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.
|
// IsNotFound returns true if the specified error was created by NewNotFound.
|
||||||
func IsNotFound(err error) bool {
|
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.
|
// IsAlreadyExists determines if the err is an error which indicates that a specified resource already exists.
|
||||||
func IsAlreadyExists(err error) bool {
|
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.
|
// IsConflict determines if the err is an error which indicates the provided update conflicts.
|
||||||
func IsConflict(err error) bool {
|
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.
|
// IsInvalid determines if the err is an error which indicates the provided resource is not valid.
|
||||||
func IsInvalid(err error) bool {
|
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
|
// 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.
|
// be performed because it is not supported by the server.
|
||||||
func IsMethodNotSupported(err error) bool {
|
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.
|
// IsBadRequest determines if err is an error which indicates that the request is invalid.
|
||||||
func IsBadRequest(err error) bool {
|
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
|
// IsUnauthorized determines if err is an error which indicates that the request is unauthorized and
|
||||||
// requires authentication by the user.
|
// requires authentication by the user.
|
||||||
func IsUnauthorized(err error) bool {
|
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
|
// IsForbidden determines if err is an error which indicates that the request is forbidden and cannot
|
||||||
// be completed as requested.
|
// be completed as requested.
|
||||||
func IsForbidden(err error) bool {
|
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
|
// IsServerTimeout determines if err is an error which indicates that the request needs to be retried
|
||||||
// by the client.
|
// by the client.
|
||||||
func IsServerTimeout(err error) bool {
|
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,
|
// 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:
|
case *StatusError:
|
||||||
if d := t.Status().Details; d != nil {
|
if d := t.Status().Details; d != nil {
|
||||||
for _, cause := range d.Causes {
|
for _, cause := range d.Causes {
|
||||||
if cause.Type == api.CauseTypeUnexpectedServerResponse {
|
if cause.Type == unversioned.CauseTypeUnexpectedServerResponse {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -411,7 +411,7 @@ func SuggestsClientDelay(err error) (int, bool) {
|
|||||||
case *StatusError:
|
case *StatusError:
|
||||||
if t.Status().Details != nil {
|
if t.Status().Details != nil {
|
||||||
switch t.Status().Reason {
|
switch t.Status().Reason {
|
||||||
case api.StatusReasonServerTimeout, api.StatusReasonTimeout:
|
case unversioned.StatusReasonServerTimeout, unversioned.StatusReasonTimeout:
|
||||||
return t.Status().Details.RetryAfterSeconds, true
|
return t.Status().Details.RetryAfterSeconds, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,10 +419,10 @@ func SuggestsClientDelay(err error) (int, bool) {
|
|||||||
return 0, false
|
return 0, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func reasonForError(err error) api.StatusReason {
|
func reasonForError(err error) unversioned.StatusReason {
|
||||||
switch t := err.(type) {
|
switch t := err.(type) {
|
||||||
case *StatusError:
|
case *StatusError:
|
||||||
return t.ErrStatus.Reason
|
return t.ErrStatus.Reason
|
||||||
}
|
}
|
||||||
return api.StatusReasonUnknown
|
return unversioned.StatusReasonUnknown
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util/fielderrors"
|
"k8s.io/kubernetes/pkg/util/fielderrors"
|
||||||
)
|
)
|
||||||
@ -30,118 +30,118 @@ import (
|
|||||||
func TestErrorNew(t *testing.T) {
|
func TestErrorNew(t *testing.T) {
|
||||||
err := NewAlreadyExists("test", "1")
|
err := NewAlreadyExists("test", "1")
|
||||||
if !IsAlreadyExists(err) {
|
if !IsAlreadyExists(err) {
|
||||||
t.Errorf("expected to be %s", api.StatusReasonAlreadyExists)
|
t.Errorf("expected to be %s", unversioned.StatusReasonAlreadyExists)
|
||||||
}
|
}
|
||||||
if IsConflict(err) {
|
if IsConflict(err) {
|
||||||
t.Errorf("expected to not be %s", api.StatusReasonConflict)
|
t.Errorf("expected to not be %s", unversioned.StatusReasonConflict)
|
||||||
}
|
}
|
||||||
if IsNotFound(err) {
|
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) {
|
if IsInvalid(err) {
|
||||||
t.Errorf("expected to not be %s", api.StatusReasonInvalid)
|
t.Errorf("expected to not be %s", unversioned.StatusReasonInvalid)
|
||||||
}
|
}
|
||||||
if IsBadRequest(err) {
|
if IsBadRequest(err) {
|
||||||
t.Errorf("expected to not be %s", api.StatusReasonBadRequest)
|
t.Errorf("expected to not be %s", unversioned.StatusReasonBadRequest)
|
||||||
}
|
}
|
||||||
if IsForbidden(err) {
|
if IsForbidden(err) {
|
||||||
t.Errorf("expected to not be %s", api.StatusReasonForbidden)
|
t.Errorf("expected to not be %s", unversioned.StatusReasonForbidden)
|
||||||
}
|
}
|
||||||
if IsServerTimeout(err) {
|
if IsServerTimeout(err) {
|
||||||
t.Errorf("expected to not be %s", api.StatusReasonServerTimeout)
|
t.Errorf("expected to not be %s", unversioned.StatusReasonServerTimeout)
|
||||||
}
|
}
|
||||||
if IsMethodNotSupported(err) {
|
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"))) {
|
if !IsConflict(NewConflict("test", "2", errors.New("message"))) {
|
||||||
t.Errorf("expected to be conflict")
|
t.Errorf("expected to be conflict")
|
||||||
}
|
}
|
||||||
if !IsNotFound(NewNotFound("test", "3")) {
|
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)) {
|
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")) {
|
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"))) {
|
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")) {
|
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)) {
|
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 {
|
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 {
|
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")) {
|
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) {
|
func TestNewInvalid(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
Err *fielderrors.ValidationError
|
Err *fielderrors.ValidationError
|
||||||
Details *api.StatusDetails
|
Details *unversioned.StatusDetails
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
fielderrors.NewFieldDuplicate("field[0].name", "bar"),
|
fielderrors.NewFieldDuplicate("field[0].name", "bar"),
|
||||||
&api.StatusDetails{
|
&unversioned.StatusDetails{
|
||||||
Kind: "kind",
|
Kind: "kind",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Causes: []api.StatusCause{{
|
Causes: []unversioned.StatusCause{{
|
||||||
Type: api.CauseTypeFieldValueDuplicate,
|
Type: unversioned.CauseTypeFieldValueDuplicate,
|
||||||
Field: "field[0].name",
|
Field: "field[0].name",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fielderrors.NewFieldInvalid("field[0].name", "bar", "detail"),
|
fielderrors.NewFieldInvalid("field[0].name", "bar", "detail"),
|
||||||
&api.StatusDetails{
|
&unversioned.StatusDetails{
|
||||||
Kind: "kind",
|
Kind: "kind",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Causes: []api.StatusCause{{
|
Causes: []unversioned.StatusCause{{
|
||||||
Type: api.CauseTypeFieldValueInvalid,
|
Type: unversioned.CauseTypeFieldValueInvalid,
|
||||||
Field: "field[0].name",
|
Field: "field[0].name",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fielderrors.NewFieldNotFound("field[0].name", "bar"),
|
fielderrors.NewFieldNotFound("field[0].name", "bar"),
|
||||||
&api.StatusDetails{
|
&unversioned.StatusDetails{
|
||||||
Kind: "kind",
|
Kind: "kind",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Causes: []api.StatusCause{{
|
Causes: []unversioned.StatusCause{{
|
||||||
Type: api.CauseTypeFieldValueNotFound,
|
Type: unversioned.CauseTypeFieldValueNotFound,
|
||||||
Field: "field[0].name",
|
Field: "field[0].name",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fielderrors.NewFieldValueNotSupported("field[0].name", "bar", nil),
|
fielderrors.NewFieldValueNotSupported("field[0].name", "bar", nil),
|
||||||
&api.StatusDetails{
|
&unversioned.StatusDetails{
|
||||||
Kind: "kind",
|
Kind: "kind",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Causes: []api.StatusCause{{
|
Causes: []unversioned.StatusCause{{
|
||||||
Type: api.CauseTypeFieldValueNotSupported,
|
Type: unversioned.CauseTypeFieldValueNotSupported,
|
||||||
Field: "field[0].name",
|
Field: "field[0].name",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fielderrors.NewFieldRequired("field[0].name"),
|
fielderrors.NewFieldRequired("field[0].name"),
|
||||||
&api.StatusDetails{
|
&unversioned.StatusDetails{
|
||||||
Kind: "kind",
|
Kind: "kind",
|
||||||
Name: "name",
|
Name: "name",
|
||||||
Causes: []api.StatusCause{{
|
Causes: []unversioned.StatusCause{{
|
||||||
Type: api.CauseTypeFieldValueRequired,
|
Type: unversioned.CauseTypeFieldValueRequired,
|
||||||
Field: "field[0].name",
|
Field: "field[0].name",
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
@ -152,7 +152,7 @@ func TestNewInvalid(t *testing.T) {
|
|||||||
expected.Causes[0].Message = vErr.ErrorBody()
|
expected.Causes[0].Message = vErr.ErrorBody()
|
||||||
err := NewInvalid("kind", "name", fielderrors.ValidationErrorList{vErr})
|
err := NewInvalid("kind", "name", fielderrors.ValidationErrorList{vErr})
|
||||||
status := err.(*StatusError).ErrStatus
|
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)
|
t.Errorf("%d: unexpected status: %#v", i, status)
|
||||||
}
|
}
|
||||||
if !reflect.DeepEqual(expected, status.Details) {
|
if !reflect.DeepEqual(expected, status.Details) {
|
||||||
@ -162,7 +162,7 @@ func TestNewInvalid(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Test_reasonForError(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)
|
t.Errorf("unexpected reason type: %#v", a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ func TestFromObject(t *testing.T) {
|
|||||||
obj runtime.Object
|
obj runtime.Object
|
||||||
message string
|
message string
|
||||||
}{
|
}{
|
||||||
{&api.Status{Message: "foobar"}, "foobar"},
|
{&unversioned.Status{Message: "foobar"}, "foobar"},
|
||||||
{&TestType{}, "unexpected object: &{}"},
|
{&TestType{}, "unexpected object: &{}"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
internal "k8s.io/kubernetes/pkg/api"
|
internal "k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResourceVersioner(t *testing.T) {
|
func TestResourceVersioner(t *testing.T) {
|
||||||
@ -34,7 +35,7 @@ func TestResourceVersioner(t *testing.T) {
|
|||||||
t.Errorf("unexpected version %v", version)
|
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)
|
version, err = accessor.ResourceVersion(&podList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error: %v", err)
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/conversion"
|
"k8s.io/kubernetes/pkg/conversion"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"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,
|
// ListMetaFor returns a pointer to a provided object's ListMeta,
|
||||||
// or an error if the object does not have that pointer.
|
// or an error if the object does not have that pointer.
|
||||||
// TODO: allow runtime.Unknown to extract this object
|
// 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)
|
v, err := conversion.EnforcePtr(obj)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var meta *ListMeta
|
var meta *unversioned.ListMeta
|
||||||
err = runtime.FieldPtr(v, "ListMeta", &meta)
|
err = runtime.FieldPtr(v, "ListMeta", &meta)
|
||||||
return meta, err
|
return meta, err
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ type FakeAPIObject struct{}
|
|||||||
func (*FakeAPIObject) IsAnAPIObject() {}
|
func (*FakeAPIObject) IsAnAPIObject() {}
|
||||||
|
|
||||||
type ExtensionAPIObject struct {
|
type ExtensionAPIObject struct {
|
||||||
TypeMeta
|
unversioned.TypeMeta
|
||||||
ObjectMeta
|
ObjectMeta
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +63,7 @@ func TestGetReference(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"serviceList": {
|
"serviceList": {
|
||||||
obj: &ServiceList{
|
obj: &ServiceList{
|
||||||
ListMeta: ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "42",
|
ResourceVersion: "42",
|
||||||
SelfLink: "/api/version2/services",
|
SelfLink: "/api/version2/services",
|
||||||
},
|
},
|
||||||
@ -75,7 +76,7 @@ func TestGetReference(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"extensionAPIObject": {
|
"extensionAPIObject": {
|
||||||
obj: &ExtensionAPIObject{
|
obj: &ExtensionAPIObject{
|
||||||
TypeMeta: TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "ExtensionAPIObject",
|
Kind: "ExtensionAPIObject",
|
||||||
},
|
},
|
||||||
ObjectMeta: ObjectMeta{
|
ObjectMeta: ObjectMeta{
|
||||||
@ -95,7 +96,7 @@ func TestGetReference(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"badSelfLink": {
|
"badSelfLink": {
|
||||||
obj: &ServiceList{
|
obj: &ServiceList{
|
||||||
ListMeta: ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "42",
|
ResourceVersion: "42",
|
||||||
SelfLink: "version2/services",
|
SelfLink: "version2/services",
|
||||||
},
|
},
|
||||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -36,7 +37,6 @@ func init() {
|
|||||||
&Service{},
|
&Service{},
|
||||||
&NodeList{},
|
&NodeList{},
|
||||||
&Node{},
|
&Node{},
|
||||||
&Status{},
|
|
||||||
&Endpoints{},
|
&Endpoints{},
|
||||||
&EndpointsList{},
|
&EndpointsList{},
|
||||||
&Binding{},
|
&Binding{},
|
||||||
@ -71,6 +71,13 @@ func init() {
|
|||||||
&ThirdPartyResourceList{},
|
&ThirdPartyResourceList{},
|
||||||
&ThirdPartyResourceData{},
|
&ThirdPartyResourceData{},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Register Unversioned types
|
||||||
|
Scheme.AddKnownTypes("", &unversioned.Status{})
|
||||||
|
|
||||||
|
// Legacy names are supported
|
||||||
|
Scheme.AddKnownTypeWithName("", "Minion", &Node{})
|
||||||
|
Scheme.AddKnownTypeWithName("", "MinionList", &NodeList{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Pod) IsAnAPIObject() {}
|
func (*Pod) IsAnAPIObject() {}
|
||||||
@ -87,7 +94,6 @@ func (*EndpointsList) IsAnAPIObject() {}
|
|||||||
func (*Node) IsAnAPIObject() {}
|
func (*Node) IsAnAPIObject() {}
|
||||||
func (*NodeList) IsAnAPIObject() {}
|
func (*NodeList) IsAnAPIObject() {}
|
||||||
func (*Binding) IsAnAPIObject() {}
|
func (*Binding) IsAnAPIObject() {}
|
||||||
func (*Status) IsAnAPIObject() {}
|
|
||||||
func (*Event) IsAnAPIObject() {}
|
func (*Event) IsAnAPIObject() {}
|
||||||
func (*EventList) IsAnAPIObject() {}
|
func (*EventList) IsAnAPIObject() {}
|
||||||
func (*List) IsAnAPIObject() {}
|
func (*List) IsAnAPIObject() {}
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/conversion"
|
"k8s.io/kubernetes/pkg/conversion"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"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)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
if !t.returnDeletedObject {
|
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)
|
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)
|
t.Errorf("expected success, got: %v", status.Status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/registered"
|
"k8s.io/kubernetes/pkg/api/registered"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/apis/experimental"
|
"k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
@ -54,7 +55,7 @@ func FuzzerFor(t *testing.T, version string, src rand.Source) *fuzz.Fuzzer {
|
|||||||
j.APIVersion = ""
|
j.APIVersion = ""
|
||||||
j.Kind = ""
|
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
|
// We have to customize the randomization of TypeMetas because their
|
||||||
// APIVersion and Kind must remain blank in memory.
|
// APIVersion and Kind must remain blank in memory.
|
||||||
j.APIVersion = ""
|
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.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
|
||||||
j.FieldPath = c.RandString()
|
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.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
|
||||||
j.SelfLink = c.RandString()
|
j.SelfLink = c.RandString()
|
||||||
},
|
},
|
||||||
|
407
pkg/api/types.go
407
pkg/api/types.go
@ -18,6 +18,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -54,33 +55,6 @@ import (
|
|||||||
// Hypens ('-') cannot be leading or trailing character of the string
|
// Hypens ('-') cannot be leading or trailing character of the string
|
||||||
// and cannot be adjacent to other hyphens.
|
// 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
|
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||||
// users must create.
|
// users must create.
|
||||||
type ObjectMeta struct {
|
type ObjectMeta struct {
|
||||||
@ -272,8 +246,8 @@ type PersistentVolumeClaimVolumeSource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PersistentVolume struct {
|
type PersistentVolume struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
//Spec defines a persistent volume owned by the cluster
|
//Spec defines a persistent volume owned by the cluster
|
||||||
Spec PersistentVolumeSpec `json:"spec,omitempty"`
|
Spec PersistentVolumeSpec `json:"spec,omitempty"`
|
||||||
@ -322,15 +296,15 @@ type PersistentVolumeStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PersistentVolumeList struct {
|
type PersistentVolumeList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
Items []PersistentVolume `json:"items"`
|
Items []PersistentVolume `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
|
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
|
||||||
type PersistentVolumeClaim struct {
|
type PersistentVolumeClaim struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the volume requested by a pod author
|
// Spec defines the volume requested by a pod author
|
||||||
Spec PersistentVolumeClaimSpec `json:"spec,omitempty"`
|
Spec PersistentVolumeClaimSpec `json:"spec,omitempty"`
|
||||||
@ -340,9 +314,9 @@ type PersistentVolumeClaim struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PersistentVolumeClaimList struct {
|
type PersistentVolumeClaimList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
Items []PersistentVolumeClaim `json:"items"`
|
Items []PersistentVolumeClaim `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PersistentVolumeClaimSpec describes the common attributes of storage devices
|
// PersistentVolumeClaimSpec describes the common attributes of storage devices
|
||||||
@ -929,8 +903,8 @@ const (
|
|||||||
|
|
||||||
// PodList is a list of Pods.
|
// PodList is a list of Pods.
|
||||||
type PodList struct {
|
type PodList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Pod `json:"items"`
|
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
|
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
|
||||||
type PodStatusResult struct {
|
type PodStatusResult struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
// Status represents the current information about a pod. This data may not be up
|
// Status represents the current information about a pod. This data may not be up
|
||||||
// to date.
|
// to date.
|
||||||
Status PodStatus `json:"status,omitempty"`
|
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).
|
// Pod is a collection of containers, used as either input (create, update) or as output (list, get).
|
||||||
type Pod struct {
|
type Pod struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the behavior of a pod.
|
// Spec defines the behavior of a pod.
|
||||||
Spec PodSpec `json:"spec,omitempty"`
|
Spec PodSpec `json:"spec,omitempty"`
|
||||||
@ -1049,8 +1023,8 @@ type PodTemplateSpec struct {
|
|||||||
|
|
||||||
// PodTemplate describes a template for creating copies of a predefined pod.
|
// PodTemplate describes a template for creating copies of a predefined pod.
|
||||||
type PodTemplate struct {
|
type PodTemplate struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Template defines the pods that will be created from this pod template
|
// Template defines the pods that will be created from this pod template
|
||||||
Template PodTemplateSpec `json:"template,omitempty"`
|
Template PodTemplateSpec `json:"template,omitempty"`
|
||||||
@ -1058,8 +1032,8 @@ type PodTemplate struct {
|
|||||||
|
|
||||||
// PodTemplateList is a list of PodTemplates.
|
// PodTemplateList is a list of PodTemplates.
|
||||||
type PodTemplateList struct {
|
type PodTemplateList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []PodTemplate `json:"items"`
|
Items []PodTemplate `json:"items"`
|
||||||
}
|
}
|
||||||
@ -1098,8 +1072,8 @@ type ReplicationControllerStatus struct {
|
|||||||
|
|
||||||
// ReplicationController represents the configuration of a replication controller.
|
// ReplicationController represents the configuration of a replication controller.
|
||||||
type ReplicationController struct {
|
type ReplicationController struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the desired behavior of this replication controller.
|
// Spec defines the desired behavior of this replication controller.
|
||||||
Spec ReplicationControllerSpec `json:"spec,omitempty"`
|
Spec ReplicationControllerSpec `json:"spec,omitempty"`
|
||||||
@ -1111,8 +1085,8 @@ type ReplicationController struct {
|
|||||||
|
|
||||||
// ReplicationControllerList is a collection of replication controllers.
|
// ReplicationControllerList is a collection of replication controllers.
|
||||||
type ReplicationControllerList struct {
|
type ReplicationControllerList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []ReplicationController `json:"items"`
|
Items []ReplicationController `json:"items"`
|
||||||
}
|
}
|
||||||
@ -1125,8 +1099,8 @@ const (
|
|||||||
|
|
||||||
// ServiceList holds a list of services.
|
// ServiceList holds a list of services.
|
||||||
type ServiceList struct {
|
type ServiceList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Service `json:"items"`
|
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
|
// (for example 3306) that the proxy listens on, and the selector that determines which pods
|
||||||
// will answer requests sent through the proxy.
|
// will answer requests sent through the proxy.
|
||||||
type Service struct {
|
type Service struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the behavior of a service.
|
// Spec defines the behavior of a service.
|
||||||
Spec ServiceSpec `json:"spec,omitempty"`
|
Spec ServiceSpec `json:"spec,omitempty"`
|
||||||
@ -1264,8 +1238,8 @@ type Service struct {
|
|||||||
// * a principal that can be authenticated and authorized
|
// * a principal that can be authenticated and authorized
|
||||||
// * a set of secrets
|
// * a set of secrets
|
||||||
type ServiceAccount struct {
|
type ServiceAccount struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount
|
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount
|
||||||
Secrets []ObjectReference `json:"secrets"`
|
Secrets []ObjectReference `json:"secrets"`
|
||||||
@ -1278,8 +1252,8 @@ type ServiceAccount struct {
|
|||||||
|
|
||||||
// ServiceAccountList is a list of ServiceAccount objects
|
// ServiceAccountList is a list of ServiceAccount objects
|
||||||
type ServiceAccountList struct {
|
type ServiceAccountList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []ServiceAccount `json:"items"`
|
Items []ServiceAccount `json:"items"`
|
||||||
}
|
}
|
||||||
@ -1297,8 +1271,8 @@ type ServiceAccountList struct {
|
|||||||
// },
|
// },
|
||||||
// ]
|
// ]
|
||||||
type Endpoints struct {
|
type Endpoints struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// The set of all endpoints is the union of all subsets.
|
// The set of all endpoints is the union of all subsets.
|
||||||
Subsets []EndpointSubset
|
Subsets []EndpointSubset
|
||||||
@ -1345,8 +1319,8 @@ type EndpointPort struct {
|
|||||||
|
|
||||||
// EndpointsList is a list of endpoints.
|
// EndpointsList is a list of endpoints.
|
||||||
type EndpointsList struct {
|
type EndpointsList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Endpoints `json:"items"`
|
Items []Endpoints `json:"items"`
|
||||||
}
|
}
|
||||||
@ -1489,8 +1463,8 @@ type ResourceList map[ResourceName]resource.Quantity
|
|||||||
// Node is a worker node in Kubernetes
|
// Node is a worker node in Kubernetes
|
||||||
// The name of the node according to etcd is in ObjectMeta.Name.
|
// The name of the node according to etcd is in ObjectMeta.Name.
|
||||||
type Node struct {
|
type Node struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the behavior of a node.
|
// Spec defines the behavior of a node.
|
||||||
Spec NodeSpec `json:"spec,omitempty"`
|
Spec NodeSpec `json:"spec,omitempty"`
|
||||||
@ -1501,8 +1475,8 @@ type Node struct {
|
|||||||
|
|
||||||
// NodeList is a list of nodes.
|
// NodeList is a list of nodes.
|
||||||
type NodeList struct {
|
type NodeList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Node `json:"items"`
|
Items []Node `json:"items"`
|
||||||
}
|
}
|
||||||
@ -1539,8 +1513,8 @@ const (
|
|||||||
// A namespace provides a scope for Names.
|
// A namespace provides a scope for Names.
|
||||||
// Use of multiple namespaces is optional
|
// Use of multiple namespaces is optional
|
||||||
type Namespace struct {
|
type Namespace struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the behavior of the Namespace.
|
// Spec defines the behavior of the Namespace.
|
||||||
Spec NamespaceSpec `json:"spec,omitempty"`
|
Spec NamespaceSpec `json:"spec,omitempty"`
|
||||||
@ -1551,15 +1525,15 @@ type Namespace struct {
|
|||||||
|
|
||||||
// NamespaceList is a list of Namespaces.
|
// NamespaceList is a list of Namespaces.
|
||||||
type NamespaceList struct {
|
type NamespaceList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Namespace `json:"items"`
|
Items []Namespace `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Binding ties one object to another - for example, a pod is bound to a node by a scheduler.
|
// Binding ties one object to another - for example, a pod is bound to a node by a scheduler.
|
||||||
type Binding struct {
|
type Binding struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// ObjectMeta describes the object that is being bound.
|
// ObjectMeta describes the object that is being bound.
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -1569,7 +1543,7 @@ type Binding struct {
|
|||||||
|
|
||||||
// DeleteOptions may be provided when deleting an API object
|
// DeleteOptions may be provided when deleting an API object
|
||||||
type DeleteOptions struct {
|
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.
|
// 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
|
// 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
|
// ListOptions is the query options to a standard REST list call, and has future support for
|
||||||
// watch calls.
|
// watch calls.
|
||||||
type ListOptions struct {
|
type ListOptions struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// A selector based on labels
|
// A selector based on labels
|
||||||
LabelSelector labels.Selector
|
LabelSelector labels.Selector
|
||||||
@ -1594,7 +1568,7 @@ type ListOptions struct {
|
|||||||
|
|
||||||
// PodLogOptions is the query options for a Pod's logs REST call
|
// PodLogOptions is the query options for a Pod's logs REST call
|
||||||
type PodLogOptions struct {
|
type PodLogOptions struct {
|
||||||
TypeMeta
|
unversioned.TypeMeta
|
||||||
|
|
||||||
// Container for which to return logs
|
// Container for which to return logs
|
||||||
Container string
|
Container string
|
||||||
@ -1609,7 +1583,7 @@ type PodLogOptions struct {
|
|||||||
// PodAttachOptions is the query options to a Pod's remote attach call
|
// PodAttachOptions is the query options to a Pod's remote attach call
|
||||||
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
|
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
|
||||||
type PodAttachOptions struct {
|
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 if true indicates that stdin is to be redirected for the attach call
|
||||||
Stdin bool `json:"stdin,omitempty"`
|
Stdin bool `json:"stdin,omitempty"`
|
||||||
@ -1629,7 +1603,7 @@ type PodAttachOptions struct {
|
|||||||
|
|
||||||
// PodExecOptions is the query options to a Pod's remote exec call
|
// PodExecOptions is the query options to a Pod's remote exec call
|
||||||
type PodExecOptions struct {
|
type PodExecOptions struct {
|
||||||
TypeMeta
|
unversioned.TypeMeta
|
||||||
|
|
||||||
// Stdin if true indicates that stdin is to be redirected for the exec call
|
// Stdin if true indicates that stdin is to be redirected for the exec call
|
||||||
Stdin bool
|
Stdin bool
|
||||||
@ -1652,225 +1626,12 @@ type PodExecOptions struct {
|
|||||||
|
|
||||||
// PodProxyOptions is the query options to a Pod's proxy call
|
// PodProxyOptions is the query options to a Pod's proxy call
|
||||||
type PodProxyOptions struct {
|
type PodProxyOptions struct {
|
||||||
TypeMeta
|
unversioned.TypeMeta
|
||||||
|
|
||||||
// Path is the URL path to use for the current proxy request
|
// Path is the URL path to use for the current proxy request
|
||||||
Path string
|
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.
|
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||||
type ObjectReference struct {
|
type ObjectReference struct {
|
||||||
Kind string `json:"kind,omitempty"`
|
Kind string `json:"kind,omitempty"`
|
||||||
@ -1898,8 +1659,8 @@ type LocalObjectReference struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SerializedReference struct {
|
type SerializedReference struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
Reference ObjectReference `json:"reference,omitempty"`
|
Reference ObjectReference `json:"reference,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventSource struct {
|
type EventSource struct {
|
||||||
@ -1912,8 +1673,8 @@ type EventSource struct {
|
|||||||
// Event is a report of an event somewhere in the cluster.
|
// 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.
|
// TODO: Decide whether to store these separately or with the object they apply to.
|
||||||
type Event struct {
|
type Event struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Required. The object that this event is about.
|
// Required. The object that this event is about.
|
||||||
InvolvedObject ObjectReference `json:"involvedObject,omitempty"`
|
InvolvedObject ObjectReference `json:"involvedObject,omitempty"`
|
||||||
@ -1943,16 +1704,16 @@ type Event struct {
|
|||||||
|
|
||||||
// EventList is a list of events.
|
// EventList is a list of events.
|
||||||
type EventList struct {
|
type EventList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Event `json:"items"`
|
Items []Event `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// List holds a list of objects, which may not be known by the server.
|
// List holds a list of objects, which may not be known by the server.
|
||||||
type List struct {
|
type List struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []runtime.Object `json:"items"`
|
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
|
// LimitRange sets resource usage limits for each kind of resource in a Namespace
|
||||||
type LimitRange struct {
|
type LimitRange struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the limits enforced
|
// Spec defines the limits enforced
|
||||||
Spec LimitRangeSpec `json:"spec,omitempty"`
|
Spec LimitRangeSpec `json:"spec,omitempty"`
|
||||||
@ -2000,8 +1761,8 @@ type LimitRange struct {
|
|||||||
|
|
||||||
// LimitRangeList is a list of LimitRange items.
|
// LimitRangeList is a list of LimitRange items.
|
||||||
type LimitRangeList struct {
|
type LimitRangeList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is a list of LimitRange objects
|
// Items is a list of LimitRange objects
|
||||||
Items []LimitRange `json:"items"`
|
Items []LimitRange `json:"items"`
|
||||||
@ -2039,8 +1800,8 @@ type ResourceQuotaStatus struct {
|
|||||||
|
|
||||||
// ResourceQuota sets aggregate quota restrictions enforced per namespace
|
// ResourceQuota sets aggregate quota restrictions enforced per namespace
|
||||||
type ResourceQuota struct {
|
type ResourceQuota struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Spec defines the desired quota
|
// Spec defines the desired quota
|
||||||
Spec ResourceQuotaSpec `json:"spec,omitempty"`
|
Spec ResourceQuotaSpec `json:"spec,omitempty"`
|
||||||
@ -2051,8 +1812,8 @@ type ResourceQuota struct {
|
|||||||
|
|
||||||
// ResourceQuotaList is a list of ResourceQuota items
|
// ResourceQuotaList is a list of ResourceQuota items
|
||||||
type ResourceQuotaList struct {
|
type ResourceQuotaList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is a list of ResourceQuota objects
|
// Items is a list of ResourceQuota objects
|
||||||
Items []ResourceQuota `json:"items"`
|
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
|
// Secret holds secret data of a certain type. The total bytes of the values in
|
||||||
// the Data field must be less than MaxSecretSize bytes.
|
// the Data field must be less than MaxSecretSize bytes.
|
||||||
type Secret struct {
|
type Secret struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN
|
// Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN
|
||||||
// or leading dot followed by valid DNS_SUBDOMAIN.
|
// or leading dot followed by valid DNS_SUBDOMAIN.
|
||||||
@ -2112,8 +1873,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SecretList struct {
|
type SecretList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []Secret `json:"items"`
|
Items []Secret `json:"items"`
|
||||||
}
|
}
|
||||||
@ -2175,15 +1936,15 @@ type ComponentCondition struct {
|
|||||||
|
|
||||||
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
||||||
type ComponentStatus struct {
|
type ComponentStatus struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Conditions []ComponentCondition `json:"conditions,omitempty"`
|
Conditions []ComponentCondition `json:"conditions,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ComponentStatusList struct {
|
type ComponentStatusList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []ComponentStatus `json:"items"`
|
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
|
// 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.
|
// of the cluster, thus the object is less strongly typed than most.
|
||||||
type RangeAllocation struct {
|
type RangeAllocation struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
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
|
// 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
|
// 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.
|
// 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
|
// 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.
|
// types to the API. It consists of one or more Versions of the api.
|
||||||
type ThirdPartyResource struct {
|
type ThirdPartyResource struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
|
|
||||||
@ -2260,8 +2021,8 @@ type ThirdPartyResource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ThirdPartyResourceList struct {
|
type ThirdPartyResourceList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Items []ThirdPartyResource `json:"items"`
|
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.
|
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
|
||||||
type ThirdPartyResourceData struct {
|
type ThirdPartyResourceData struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
Data []byte `json:"name,omitempty"`
|
Data []byte `json:"name,omitempty"`
|
||||||
}
|
}
|
||||||
|
271
pkg/api/unversioned/types.go
Normal file
271
pkg/api/unversioned/types.go
Normal 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() {}
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
api "k8s.io/kubernetes/pkg/api"
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
resource "k8s.io/kubernetes/pkg/api/resource"
|
resource "k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
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
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*api.ListMeta))(in)
|
defaulting.(func(*unversioned.ListMeta))(in)
|
||||||
}
|
}
|
||||||
out.SelfLink = in.SelfLink
|
out.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
@ -2247,9 +2248,9 @@ func convert_api_ServiceStatus_To_v1_ServiceStatus(in *api.ServiceStatus, out *S
|
|||||||
return nil
|
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 {
|
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 {
|
if err := convert_api_TypeMeta_To_v1_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
|
||||||
return err
|
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.Status = in.Status
|
||||||
out.Message = in.Message
|
out.Message = in.Message
|
||||||
out.Reason = StatusReason(in.Reason)
|
out.Reason = unversioned.StatusReason(in.Reason)
|
||||||
if in.Details != nil {
|
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 {
|
if err := convert_api_StatusDetails_To_v1_StatusDetails(in.Details, out.Details, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -2272,24 +2273,24 @@ func convert_api_Status_To_v1_Status(in *api.Status, out *Status, s conversion.S
|
|||||||
return nil
|
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 {
|
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.Message = in.Message
|
||||||
out.Field = in.Field
|
out.Field = in.Field
|
||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*api.StatusDetails))(in)
|
defaulting.(func(*unversioned.StatusDetails))(in)
|
||||||
}
|
}
|
||||||
out.Name = in.Name
|
out.Name = in.Name
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
if in.Causes != nil {
|
if in.Causes != nil {
|
||||||
out.Causes = make([]StatusCause, len(in.Causes))
|
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
|
||||||
for i := range in.Causes {
|
for i := range in.Causes {
|
||||||
if err := convert_api_StatusCause_To_v1_StatusCause(&in.Causes[i], &out.Causes[i], s); err != nil {
|
if err := convert_api_StatusCause_To_v1_StatusCause(&in.Causes[i], &out.Causes[i], s); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -2312,9 +2313,9 @@ func convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction,
|
|||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*api.TypeMeta))(in)
|
defaulting.(func(*unversioned.TypeMeta))(in)
|
||||||
}
|
}
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
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
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*ListMeta))(in)
|
defaulting.(func(*unversioned.ListMeta))(in)
|
||||||
}
|
}
|
||||||
out.SelfLink = in.SelfLink
|
out.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
@ -4682,9 +4683,9 @@ func convert_v1_ServiceStatus_To_api_ServiceStatus(in *ServiceStatus, out *api.S
|
|||||||
return nil
|
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 {
|
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 {
|
if err := convert_v1_TypeMeta_To_api_TypeMeta(&in.TypeMeta, &out.TypeMeta, s); err != nil {
|
||||||
return err
|
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.Status = in.Status
|
||||||
out.Message = in.Message
|
out.Message = in.Message
|
||||||
out.Reason = api.StatusReason(in.Reason)
|
out.Reason = unversioned.StatusReason(in.Reason)
|
||||||
if in.Details != nil {
|
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 {
|
if err := convert_v1_StatusDetails_To_api_StatusDetails(in.Details, out.Details, s); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -4707,24 +4708,24 @@ func convert_v1_Status_To_api_Status(in *Status, out *api.Status, s conversion.S
|
|||||||
return nil
|
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 {
|
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.Message = in.Message
|
||||||
out.Field = in.Field
|
out.Field = in.Field
|
||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*StatusDetails))(in)
|
defaulting.(func(*unversioned.StatusDetails))(in)
|
||||||
}
|
}
|
||||||
out.Name = in.Name
|
out.Name = in.Name
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
if in.Causes != nil {
|
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 {
|
for i := range in.Causes {
|
||||||
if err := convert_v1_StatusCause_To_api_StatusCause(&in.Causes[i], &out.Causes[i], s); err != nil {
|
if err := convert_v1_StatusCause_To_api_StatusCause(&in.Causes[i], &out.Causes[i], s); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -4747,9 +4748,9 @@ func convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *TCPSocketAction, out
|
|||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*TypeMeta))(in)
|
defaulting.(func(*unversioned.TypeMeta))(in)
|
||||||
}
|
}
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
api "k8s.io/kubernetes/pkg/api"
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
resource "k8s.io/kubernetes/pkg/api/resource"
|
resource "k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||||
runtime "k8s.io/kubernetes/pkg/runtime"
|
runtime "k8s.io/kubernetes/pkg/runtime"
|
||||||
util "k8s.io/kubernetes/pkg/util"
|
util "k8s.io/kubernetes/pkg/util"
|
||||||
@ -790,7 +791,7 @@ func deepCopy_v1_List(in List, out *List, c *conversion.Cloner) error {
|
|||||||
return nil
|
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.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
return nil
|
return nil
|
||||||
@ -2030,7 +2031,7 @@ func deepCopy_v1_ServiceStatus(in ServiceStatus, out *ServiceStatus, c *conversi
|
|||||||
return nil
|
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 {
|
if err := deepCopy_v1_TypeMeta(in.TypeMeta, &out.TypeMeta, c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -2041,7 +2042,7 @@ func deepCopy_v1_Status(in Status, out *Status, c *conversion.Cloner) error {
|
|||||||
out.Message = in.Message
|
out.Message = in.Message
|
||||||
out.Reason = in.Reason
|
out.Reason = in.Reason
|
||||||
if in.Details != nil {
|
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 {
|
if err := deepCopy_v1_StatusDetails(*in.Details, out.Details, c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -2052,18 +2053,18 @@ func deepCopy_v1_Status(in Status, out *Status, c *conversion.Cloner) error {
|
|||||||
return nil
|
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.Type = in.Type
|
||||||
out.Message = in.Message
|
out.Message = in.Message
|
||||||
out.Field = in.Field
|
out.Field = in.Field
|
||||||
return nil
|
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.Name = in.Name
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
if in.Causes != nil {
|
if in.Causes != nil {
|
||||||
out.Causes = make([]StatusCause, len(in.Causes))
|
out.Causes = make([]unversioned.StatusCause, len(in.Causes))
|
||||||
for i := range in.Causes {
|
for i := range in.Causes {
|
||||||
if err := deepCopy_v1_StatusCause(in.Causes[i], &out.Causes[i], c); err != nil {
|
if err := deepCopy_v1_StatusCause(in.Causes[i], &out.Causes[i], c); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -2083,7 +2084,7 @@ func deepCopy_v1_TCPSocketAction(in TCPSocketAction, out *TCPSocketAction, c *co
|
|||||||
return nil
|
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.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
return nil
|
return nil
|
||||||
|
@ -19,6 +19,7 @@ package v1
|
|||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/registered"
|
"k8s.io/kubernetes/pkg/api/registered"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +55,6 @@ func addKnownTypes() {
|
|||||||
&Node{},
|
&Node{},
|
||||||
&NodeList{},
|
&NodeList{},
|
||||||
&Binding{},
|
&Binding{},
|
||||||
&Status{},
|
|
||||||
&Event{},
|
&Event{},
|
||||||
&EventList{},
|
&EventList{},
|
||||||
&List{},
|
&List{},
|
||||||
@ -86,6 +86,13 @@ func addKnownTypes() {
|
|||||||
&ThirdPartyResourceList{},
|
&ThirdPartyResourceList{},
|
||||||
&ThirdPartyResourceData{},
|
&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() {}
|
func (*Pod) IsAnAPIObject() {}
|
||||||
@ -102,7 +109,6 @@ func (*EndpointsList) IsAnAPIObject() {}
|
|||||||
func (*Node) IsAnAPIObject() {}
|
func (*Node) IsAnAPIObject() {}
|
||||||
func (*NodeList) IsAnAPIObject() {}
|
func (*NodeList) IsAnAPIObject() {}
|
||||||
func (*Binding) IsAnAPIObject() {}
|
func (*Binding) IsAnAPIObject() {}
|
||||||
func (*Status) IsAnAPIObject() {}
|
|
||||||
func (*Event) IsAnAPIObject() {}
|
func (*Event) IsAnAPIObject() {}
|
||||||
func (*EventList) IsAnAPIObject() {}
|
func (*EventList) IsAnAPIObject() {}
|
||||||
func (*List) IsAnAPIObject() {}
|
func (*List) IsAnAPIObject() {}
|
||||||
|
@ -18,6 +18,7 @@ package v1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/types"
|
"k8s.io/kubernetes/pkg/types"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
@ -62,41 +63,6 @@ import (
|
|||||||
// Hypens ('-') cannot be leading or trailing character of the string
|
// Hypens ('-') cannot be leading or trailing character of the string
|
||||||
// and cannot be adjacent to other hyphens.
|
// 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
|
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||||
// users must create.
|
// users must create.
|
||||||
type ObjectMeta struct {
|
type ObjectMeta struct {
|
||||||
@ -342,7 +308,7 @@ type PersistentVolumeSource struct {
|
|||||||
// It is analogous to a node.
|
// It is analogous to a node.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md
|
||||||
type PersistentVolume struct {
|
type PersistentVolume struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -410,10 +376,10 @@ type PersistentVolumeStatus struct {
|
|||||||
|
|
||||||
// PersistentVolumeList is a list of PersistentVolume items.
|
// PersistentVolumeList is a list of PersistentVolume items.
|
||||||
type PersistentVolumeList struct {
|
type PersistentVolumeList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// List of persistent volumes.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md
|
||||||
Items []PersistentVolume `json:"items"`
|
Items []PersistentVolume `json:"items"`
|
||||||
@ -421,7 +387,7 @@ type PersistentVolumeList struct {
|
|||||||
|
|
||||||
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
|
// PersistentVolumeClaim is a user's request for and claim to a persistent volume
|
||||||
type PersistentVolumeClaim struct {
|
type PersistentVolumeClaim struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -438,10 +404,10 @@ type PersistentVolumeClaim struct {
|
|||||||
|
|
||||||
// PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
|
// PersistentVolumeClaimList is a list of PersistentVolumeClaim items.
|
||||||
type PersistentVolumeClaimList struct {
|
type PersistentVolumeClaimList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// A list of persistent volume claims.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#persistentvolumeclaims
|
// More info: http://releases.k8s.io/HEAD/docs/user-guide/persistent-volumes.md#persistentvolumeclaims
|
||||||
Items []PersistentVolumeClaim `json:"items"`
|
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
|
// PodStatusResult is a wrapper for PodStatus returned by kubelet that can be encode/decoded
|
||||||
type PodStatusResult struct {
|
type PodStatusResult struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
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
|
// Pod is a collection of containers that can run on a host. This resource is created
|
||||||
// by clients and scheduled onto hosts.
|
// by clients and scheduled onto hosts.
|
||||||
type Pod struct {
|
type Pod struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1305,10 +1271,10 @@ type Pod struct {
|
|||||||
|
|
||||||
// PodList is a list of Pods.
|
// PodList is a list of Pods.
|
||||||
type PodList struct {
|
type PodList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// List of pods.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/pods.md
|
// 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.
|
// PodTemplate describes a template for creating copies of a predefined pod.
|
||||||
type PodTemplate struct {
|
type PodTemplate struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1340,10 +1306,10 @@ type PodTemplate struct {
|
|||||||
|
|
||||||
// PodTemplateList is a list of PodTemplates.
|
// PodTemplateList is a list of PodTemplates.
|
||||||
type PodTemplateList struct {
|
type PodTemplateList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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
|
// List of pod templates
|
||||||
Items []PodTemplate `json:"items"`
|
Items []PodTemplate `json:"items"`
|
||||||
@ -1388,7 +1354,7 @@ type ReplicationControllerStatus struct {
|
|||||||
|
|
||||||
// ReplicationController represents the configuration of a replication controller.
|
// ReplicationController represents the configuration of a replication controller.
|
||||||
type ReplicationController struct {
|
type ReplicationController struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// If the Labels of a ReplicationController are empty, they are defaulted to
|
// If the Labels of a ReplicationController are empty, they are defaulted to
|
||||||
// be the same as the Pod(s) that the replication controller manages.
|
// 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.
|
// ReplicationControllerList is a collection of replication controllers.
|
||||||
type ReplicationControllerList struct {
|
type ReplicationControllerList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// List of replication controllers.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/replication-controller.md
|
// 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
|
// (for example 3306) that the proxy listens on, and the selector that determines which pods
|
||||||
// will answer requests sent through the proxy.
|
// will answer requests sent through the proxy.
|
||||||
type Service struct {
|
type Service struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1580,10 +1546,10 @@ const (
|
|||||||
|
|
||||||
// ServiceList holds a list of services.
|
// ServiceList holds a list of services.
|
||||||
type ServiceList struct {
|
type ServiceList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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
|
// List of services
|
||||||
Items []Service `json:"items"`
|
Items []Service `json:"items"`
|
||||||
@ -1594,7 +1560,7 @@ type ServiceList struct {
|
|||||||
// * a principal that can be authenticated and authorized
|
// * a principal that can be authenticated and authorized
|
||||||
// * a set of secrets
|
// * a set of secrets
|
||||||
type ServiceAccount struct {
|
type ServiceAccount struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1612,10 +1578,10 @@ type ServiceAccount struct {
|
|||||||
|
|
||||||
// ServiceAccountList is a list of ServiceAccount objects
|
// ServiceAccountList is a list of ServiceAccount objects
|
||||||
type ServiceAccountList struct {
|
type ServiceAccountList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// List of ServiceAccounts.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md#service-accounts
|
// More info: http://releases.k8s.io/HEAD/docs/design/service_accounts.md#service-accounts
|
||||||
@ -1635,7 +1601,7 @@ type ServiceAccountList struct {
|
|||||||
// },
|
// },
|
||||||
// ]
|
// ]
|
||||||
type Endpoints struct {
|
type Endpoints struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1702,10 +1668,10 @@ type EndpointPort struct {
|
|||||||
|
|
||||||
// EndpointsList is a list of endpoints.
|
// EndpointsList is a list of endpoints.
|
||||||
type EndpointsList struct {
|
type EndpointsList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// List of endpoints.
|
||||||
Items []Endpoints `json:"items"`
|
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.
|
// 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).
|
// Each node will have a unique identifier in the cache (i.e. in etcd).
|
||||||
type Node struct {
|
type Node struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
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.
|
// NodeList is the whole list of all Nodes which have been registered with master.
|
||||||
type NodeList struct {
|
type NodeList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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
|
// List of nodes
|
||||||
Items []Node `json:"items"`
|
Items []Node `json:"items"`
|
||||||
@ -1913,7 +1879,7 @@ const (
|
|||||||
// Namespace provides a scope for Names.
|
// Namespace provides a scope for Names.
|
||||||
// Use of multiple namespaces is optional.
|
// Use of multiple namespaces is optional.
|
||||||
type Namespace struct {
|
type Namespace struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1929,10 +1895,10 @@ type Namespace struct {
|
|||||||
|
|
||||||
// NamespaceList is a list of Namespaces.
|
// NamespaceList is a list of Namespaces.
|
||||||
type NamespaceList struct {
|
type NamespaceList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// Items is the list of Namespace objects in the list.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/namespaces.md
|
// 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.
|
// Binding ties one object to another.
|
||||||
// For example, a pod is bound to a node by a scheduler.
|
// For example, a pod is bound to a node by a scheduler.
|
||||||
type Binding struct {
|
type Binding struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -1953,7 +1919,7 @@ type Binding struct {
|
|||||||
|
|
||||||
// DeleteOptions may be provided when deleting an API object
|
// DeleteOptions may be provided when deleting an API object
|
||||||
type DeleteOptions struct {
|
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 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
|
// 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.
|
// ListOptions is the query options to a standard REST list call.
|
||||||
type ListOptions struct {
|
type ListOptions struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// A selector to restrict the list of returned objects by their labels.
|
// A selector to restrict the list of returned objects by their labels.
|
||||||
// Defaults to everything.
|
// Defaults to everything.
|
||||||
@ -1982,7 +1948,7 @@ type ListOptions struct {
|
|||||||
|
|
||||||
// PodLogOptions is the query options for a Pod's logs REST call.
|
// PodLogOptions is the query options for a Pod's logs REST call.
|
||||||
type PodLogOptions struct {
|
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.
|
// The container for which to stream logs. Defaults to only container if there is one container in the pod.
|
||||||
Container string `json:"container,omitempty"`
|
Container string `json:"container,omitempty"`
|
||||||
@ -2001,7 +1967,7 @@ type PodLogOptions struct {
|
|||||||
// TODO: merge w/ PodExecOptions below for stdin, stdout, etc
|
// 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
|
// and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY
|
||||||
type PodAttachOptions struct {
|
type PodAttachOptions struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// Stdin if true, redirects the standard input stream of the pod for this call.
|
// Stdin if true, redirects the standard input stream of the pod for this call.
|
||||||
// Defaults to false.
|
// 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
|
// 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
|
// and also when we cut V2, we should export a "StreamOptions" or somesuch that contains Stdin, Stdout, Stder and TTY
|
||||||
type PodExecOptions struct {
|
type PodExecOptions struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// Redirect the standard input stream of the pod for this call.
|
// Redirect the standard input stream of the pod for this call.
|
||||||
// Defaults to false.
|
// Defaults to false.
|
||||||
@ -2059,170 +2025,12 @@ type PodExecOptions struct {
|
|||||||
|
|
||||||
// PodProxyOptions is the query options to a Pod's proxy call.
|
// PodProxyOptions is the query options to a Pod's proxy call.
|
||||||
type PodProxyOptions struct {
|
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 is the URL path to use for the current proxy request to pod.
|
||||||
Path string `json:"path,omitempty"`
|
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.
|
// ObjectReference contains enough information to let you inspect or modify the referred object.
|
||||||
type ObjectReference struct {
|
type ObjectReference struct {
|
||||||
// Kind of the referent.
|
// Kind of the referent.
|
||||||
@ -2265,7 +2073,7 @@ type LocalObjectReference struct {
|
|||||||
|
|
||||||
// SerializedReference is a reference to serialized object.
|
// SerializedReference is a reference to serialized object.
|
||||||
type SerializedReference struct {
|
type SerializedReference struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// The reference to an object in the system.
|
// The reference to an object in the system.
|
||||||
Reference ObjectReference `json:"reference,omitempty"`
|
Reference ObjectReference `json:"reference,omitempty"`
|
||||||
}
|
}
|
||||||
@ -2281,7 +2089,7 @@ type EventSource struct {
|
|||||||
// Event is a report of an event somewhere in the cluster.
|
// 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.
|
// TODO: Decide whether to store these separately or with the object they apply to.
|
||||||
type Event struct {
|
type Event struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata"`
|
ObjectMeta `json:"metadata"`
|
||||||
@ -2313,10 +2121,10 @@ type Event struct {
|
|||||||
|
|
||||||
// EventList is a list of events.
|
// EventList is a list of events.
|
||||||
type EventList struct {
|
type EventList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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
|
// List of events
|
||||||
Items []Event `json:"items"`
|
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.
|
// List holds a list of objects, which may not be known by the server.
|
||||||
type List struct {
|
type List struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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
|
// List of objects
|
||||||
Items []runtime.RawExtension `json:"items"`
|
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.
|
// LimitRange sets resource usage limits for each kind of resource in a Namespace.
|
||||||
type LimitRange struct {
|
type LimitRange struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -2379,10 +2187,10 @@ type LimitRange struct {
|
|||||||
|
|
||||||
// LimitRangeList is a list of LimitRange items.
|
// LimitRangeList is a list of LimitRange items.
|
||||||
type LimitRangeList struct {
|
type LimitRangeList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// Items is a list of LimitRange objects.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/design/admission_control_limit_range.md
|
// 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
|
// ResourceQuota sets aggregate quota restrictions enforced per namespace
|
||||||
type ResourceQuota struct {
|
type ResourceQuota struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -2439,10 +2247,10 @@ type ResourceQuota struct {
|
|||||||
|
|
||||||
// ResourceQuotaList is a list of ResourceQuota items.
|
// ResourceQuotaList is a list of ResourceQuota items.
|
||||||
type ResourceQuotaList struct {
|
type ResourceQuotaList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// Items is a list of ResourceQuota objects.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/design/admission_control_resource_quota.md#admissioncontrol-plugin-resourcequota
|
// 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
|
// Secret holds secret data of a certain type. The total bytes of the values in
|
||||||
// the Data field must be less than MaxSecretSize bytes.
|
// the Data field must be less than MaxSecretSize bytes.
|
||||||
type Secret struct {
|
type Secret struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -2507,10 +2315,10 @@ const (
|
|||||||
|
|
||||||
// SecretList is a list of Secret.
|
// SecretList is a list of Secret.
|
||||||
type SecretList struct {
|
type SecretList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// Items is a list of secret objects.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/user-guide/secrets.md
|
// 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.
|
// ComponentStatus (and ComponentStatusList) holds the cluster validation info.
|
||||||
type ComponentStatus struct {
|
type ComponentStatus struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
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.
|
// Status of all the conditions for the component as a list of ComponentStatus objects.
|
||||||
type ComponentStatusList struct {
|
type ComponentStatusList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds
|
// 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.
|
// List of ComponentStatus objects.
|
||||||
Items []ComponentStatus `json:"items"`
|
Items []ComponentStatus `json:"items"`
|
||||||
@ -2627,7 +2435,7 @@ type SELinuxOptions struct {
|
|||||||
|
|
||||||
// RangeAllocation is not a public type.
|
// RangeAllocation is not a public type.
|
||||||
type RangeAllocation struct {
|
type RangeAllocation struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
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
|
// 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.
|
// types to the API. It consists of one or more Versions of the api.
|
||||||
type ThirdPartyResource struct {
|
type ThirdPartyResource struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -2655,10 +2463,10 @@ type ThirdPartyResource struct {
|
|||||||
|
|
||||||
// ThirdPartyResourceList is a list of ThirdPartyResource.
|
// ThirdPartyResourceList is a list of ThirdPartyResource.
|
||||||
type ThirdPartyResourceList struct {
|
type ThirdPartyResourceList struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is a list of schema objects.
|
||||||
Items []ThirdPartyResource `json:"items"`
|
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.
|
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
|
||||||
type ThirdPartyResourceData struct {
|
type ThirdPartyResourceData struct {
|
||||||
TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
ObjectMeta `json:"metadata,omitempty"`
|
ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
@ -528,16 +528,6 @@ func (List) SwaggerDoc() map[string]string {
|
|||||||
return map_List
|
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{
|
var map_ListOptions = map[string]string{
|
||||||
"": "ListOptions is the query options to a standard REST list call.",
|
"": "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.",
|
"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
|
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{
|
var map_TCPSocketAction = map[string]string{
|
||||||
"": "TCPSocketAction describes an action based on opening a socket",
|
"": "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.",
|
"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
|
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{
|
var map_Volume = map[string]string{
|
||||||
"": "Volume represents a named volume in a pod that may be accessed by any container in the pod.",
|
"": "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",
|
"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",
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
api "k8s.io/kubernetes/pkg/api"
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
resource "k8s.io/kubernetes/pkg/api/resource"
|
resource "k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||||
util "k8s.io/kubernetes/pkg/util"
|
util "k8s.io/kubernetes/pkg/util"
|
||||||
inf "speter.net/go/exp/math/dec/inf"
|
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
|
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.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
return nil
|
return nil
|
||||||
@ -605,7 +606,7 @@ func deepCopy_api_TCPSocketAction(in api.TCPSocketAction, out *api.TCPSocketActi
|
|||||||
return nil
|
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.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
return nil
|
return nil
|
||||||
|
@ -31,6 +31,7 @@ package experimental
|
|||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -51,7 +52,7 @@ type ScaleStatus struct {
|
|||||||
|
|
||||||
// Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
|
// Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
|
||||||
type Scale struct {
|
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.
|
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ type Scale struct {
|
|||||||
|
|
||||||
// Dummy definition
|
// Dummy definition
|
||||||
type ReplicationControllerDummy struct {
|
type ReplicationControllerDummy struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubresourceReference contains enough information to let you inspect or modify the referred subresource.
|
// 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.
|
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
|
||||||
type HorizontalPodAutoscaler struct {
|
type HorizontalPodAutoscaler struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
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 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"`
|
Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty"`
|
||||||
@ -134,8 +135,8 @@ type HorizontalPodAutoscaler struct {
|
|||||||
|
|
||||||
// HorizontalPodAutoscaler is a collection of pod autoscalers.
|
// HorizontalPodAutoscaler is a collection of pod autoscalers.
|
||||||
type HorizontalPodAutoscalerList struct {
|
type HorizontalPodAutoscalerList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is the list of horizontal pod autoscalers.
|
// Items is the list of horizontal pod autoscalers.
|
||||||
Items []HorizontalPodAutoscaler `json:"items"`
|
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
|
// 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.
|
// types to the API. It consists of one or more Versions of the api.
|
||||||
type ThirdPartyResource struct {
|
type ThirdPartyResource struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// Standard object metadata
|
// Standard object metadata
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -157,10 +158,10 @@ type ThirdPartyResource struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ThirdPartyResourceList struct {
|
type ThirdPartyResourceList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
api.ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is the list of horizontal pod autoscalers.
|
// Items is the list of horizontal pod autoscalers.
|
||||||
Items []ThirdPartyResource `json:"items"`
|
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.
|
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
|
||||||
type ThirdPartyResourceData struct {
|
type ThirdPartyResourceData struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object metadata.
|
// Standard object metadata.
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -186,8 +187,8 @@ type ThirdPartyResourceData struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Deployment struct {
|
type Deployment struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Specification of the desired behavior of the Deployment.
|
// Specification of the desired behavior of the Deployment.
|
||||||
Spec DeploymentSpec `json:"spec,omitempty"`
|
Spec DeploymentSpec `json:"spec,omitempty"`
|
||||||
@ -286,8 +287,8 @@ type DeploymentStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DeploymentList struct {
|
type DeploymentList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is the list of deployments.
|
// Items is the list of deployments.
|
||||||
Items []Deployment `json:"items"`
|
Items []Deployment `json:"items"`
|
||||||
@ -326,7 +327,7 @@ type DaemonSetStatus struct {
|
|||||||
|
|
||||||
// DaemonSet represents the configuration of a daemon set.
|
// DaemonSet represents the configuration of a daemon set.
|
||||||
type DaemonSet struct {
|
type DaemonSet struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -345,27 +346,27 @@ type DaemonSet struct {
|
|||||||
|
|
||||||
// DaemonSetList is a collection of daemon sets.
|
// DaemonSetList is a collection of daemon sets.
|
||||||
type DaemonSetList struct {
|
type DaemonSetList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is a list of daemon sets.
|
||||||
Items []DaemonSet `json:"items"`
|
Items []DaemonSet `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThirdPartyResourceDataList struct {
|
type ThirdPartyResourceDataList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata
|
// Standard list metadata
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is a list of third party objects
|
||||||
Items []ThirdPartyResourceData `json:"items"`
|
Items []ThirdPartyResourceData `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Job represents the configuration of a single job.
|
// Job represents the configuration of a single job.
|
||||||
type Job struct {
|
type Job struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -381,10 +382,10 @@ type Job struct {
|
|||||||
|
|
||||||
// JobList is a collection of jobs.
|
// JobList is a collection of jobs.
|
||||||
type JobList struct {
|
type JobList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata
|
// Standard list metadata
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is the list of Job.
|
||||||
Items []Job `json:"items"`
|
Items []Job `json:"items"`
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
api "k8s.io/kubernetes/pkg/api"
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
resource "k8s.io/kubernetes/pkg/api/resource"
|
resource "k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||||
experimental "k8s.io/kubernetes/pkg/apis/experimental"
|
experimental "k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
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
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*api.ListMeta))(in)
|
defaulting.(func(*unversioned.ListMeta))(in)
|
||||||
}
|
}
|
||||||
out.SelfLink = in.SelfLink
|
out.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
@ -646,9 +647,9 @@ func convert_api_TCPSocketAction_To_v1_TCPSocketAction(in *api.TCPSocketAction,
|
|||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*api.TypeMeta))(in)
|
defaulting.(func(*unversioned.TypeMeta))(in)
|
||||||
}
|
}
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
@ -1172,9 +1173,9 @@ func convert_v1_Lifecycle_To_api_Lifecycle(in *v1.Lifecycle, out *api.Lifecycle,
|
|||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*v1.ListMeta))(in)
|
defaulting.(func(*unversioned.ListMeta))(in)
|
||||||
}
|
}
|
||||||
out.SelfLink = in.SelfLink
|
out.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
@ -1413,9 +1414,9 @@ func convert_v1_TCPSocketAction_To_api_TCPSocketAction(in *v1.TCPSocketAction, o
|
|||||||
return nil
|
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 {
|
if defaulting, found := s.DefaultingInterface(reflect.TypeOf(*in)); found {
|
||||||
defaulting.(func(*v1.TypeMeta))(in)
|
defaulting.(func(*unversioned.TypeMeta))(in)
|
||||||
}
|
}
|
||||||
out.Kind = in.Kind
|
out.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
api "k8s.io/kubernetes/pkg/api"
|
api "k8s.io/kubernetes/pkg/api"
|
||||||
resource "k8s.io/kubernetes/pkg/api/resource"
|
resource "k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||||
conversion "k8s.io/kubernetes/pkg/conversion"
|
conversion "k8s.io/kubernetes/pkg/conversion"
|
||||||
util "k8s.io/kubernetes/pkg/util"
|
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
|
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.SelfLink = in.SelfLink
|
||||||
out.ResourceVersion = in.ResourceVersion
|
out.ResourceVersion = in.ResourceVersion
|
||||||
return nil
|
return nil
|
||||||
@ -623,7 +624,7 @@ func deepCopy_v1_TCPSocketAction(in v1.TCPSocketAction, out *v1.TCPSocketAction,
|
|||||||
return nil
|
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.Kind = in.Kind
|
||||||
out.APIVersion = in.APIVersion
|
out.APIVersion = in.APIVersion
|
||||||
return nil
|
return nil
|
||||||
|
@ -18,6 +18,7 @@ package v1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
)
|
)
|
||||||
@ -39,7 +40,7 @@ type ScaleStatus struct {
|
|||||||
|
|
||||||
// Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
|
// Scale subresource, applicable to ReplicationControllers and (in future) Deployment.
|
||||||
type Scale struct {
|
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.
|
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -52,7 +53,7 @@ type Scale struct {
|
|||||||
|
|
||||||
// Dummy definition
|
// Dummy definition
|
||||||
type ReplicationControllerDummy struct {
|
type ReplicationControllerDummy struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// SubresourceReference contains enough information to let you inspect or modify the referred subresource.
|
// 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.
|
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
|
||||||
type HorizontalPodAutoscaler struct {
|
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
|
// Standard object metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -124,9 +125,9 @@ type HorizontalPodAutoscaler struct {
|
|||||||
|
|
||||||
// HorizontalPodAutoscalerList is a list of HorizontalPodAutoscalers.
|
// HorizontalPodAutoscalerList is a list of HorizontalPodAutoscalers.
|
||||||
type HorizontalPodAutoscalerList struct {
|
type HorizontalPodAutoscalerList struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
v1.ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is the list of HorizontalPodAutoscalers.
|
// Items is the list of HorizontalPodAutoscalers.
|
||||||
Items []HorizontalPodAutoscaler `json:"items"`
|
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
|
// 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.
|
// types to the API. It consists of one or more Versions of the api.
|
||||||
type ThirdPartyResource struct {
|
type ThirdPartyResource struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// Standard object metadata
|
// Standard object metadata
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -149,10 +150,10 @@ type ThirdPartyResource struct {
|
|||||||
|
|
||||||
// ThirdPartyResourceList is a list of ThirdPartyResources.
|
// ThirdPartyResourceList is a list of ThirdPartyResources.
|
||||||
type ThirdPartyResourceList struct {
|
type ThirdPartyResourceList struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
v1.ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is the list of ThirdPartyResources.
|
// Items is the list of ThirdPartyResources.
|
||||||
Items []ThirdPartyResource `json:"items"`
|
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.
|
// An internal object, used for versioned storage in etcd. Not exposed to the end user.
|
||||||
type ThirdPartyResourceData struct {
|
type ThirdPartyResourceData struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object metadata.
|
// Standard object metadata.
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -179,7 +180,7 @@ type ThirdPartyResourceData struct {
|
|||||||
|
|
||||||
// Deployment enables declarative updates for Pods and ReplicationControllers.
|
// Deployment enables declarative updates for Pods and ReplicationControllers.
|
||||||
type Deployment struct {
|
type Deployment struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object metadata.
|
// Standard object metadata.
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
@ -284,9 +285,9 @@ type DeploymentStatus struct {
|
|||||||
|
|
||||||
// DeploymentList is a list of Deployments.
|
// DeploymentList is a list of Deployments.
|
||||||
type DeploymentList struct {
|
type DeploymentList struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
v1.ListMeta `json:"metadata,omitempty"`
|
unversioned.ListMeta `json:"metadata,omitempty"`
|
||||||
|
|
||||||
// Items is the list of Deployments.
|
// Items is the list of Deployments.
|
||||||
Items []Deployment `json:"items"`
|
Items []Deployment `json:"items"`
|
||||||
@ -325,7 +326,7 @@ type DaemonSetStatus struct {
|
|||||||
|
|
||||||
// DaemonSet represents the configuration of a daemon set.
|
// DaemonSet represents the configuration of a daemon set.
|
||||||
type DaemonSet struct {
|
type DaemonSet struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -344,10 +345,10 @@ type DaemonSet struct {
|
|||||||
|
|
||||||
// DaemonSetList is a collection of daemon sets.
|
// DaemonSetList is a collection of daemon sets.
|
||||||
type DaemonSetList struct {
|
type DaemonSetList struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata.
|
// Standard list metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is a list of daemon sets.
|
||||||
Items []DaemonSet `json:"items"`
|
Items []DaemonSet `json:"items"`
|
||||||
@ -355,10 +356,10 @@ type DaemonSetList struct {
|
|||||||
|
|
||||||
// ThirdPartyResrouceDataList is a list of ThirdPartyResourceData.
|
// ThirdPartyResrouceDataList is a list of ThirdPartyResourceData.
|
||||||
type ThirdPartyResourceDataList struct {
|
type ThirdPartyResourceDataList struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata
|
// Standard list metadata
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is the list of ThirdpartyResourceData.
|
||||||
Items []ThirdPartyResourceData `json:"items"`
|
Items []ThirdPartyResourceData `json:"items"`
|
||||||
@ -366,7 +367,7 @@ type ThirdPartyResourceDataList struct {
|
|||||||
|
|
||||||
// Job represents the configuration of a single job.
|
// Job represents the configuration of a single job.
|
||||||
type Job struct {
|
type Job struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard object's metadata.
|
// Standard object's metadata.
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||||
v1.ObjectMeta `json:"metadata,omitempty"`
|
v1.ObjectMeta `json:"metadata,omitempty"`
|
||||||
@ -382,10 +383,10 @@ type Job struct {
|
|||||||
|
|
||||||
// JobList is a collection of jobs.
|
// JobList is a collection of jobs.
|
||||||
type JobList struct {
|
type JobList struct {
|
||||||
v1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Standard list metadata
|
// Standard list metadata
|
||||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#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 is the list of Job.
|
||||||
Items []Job `json:"items"`
|
Items []Job `json:"items"`
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful"
|
"github.com/emicklei/go-restful"
|
||||||
)
|
)
|
||||||
@ -43,7 +44,7 @@ func TestScopeNamingGenerateLink(t *testing.T) {
|
|||||||
Name: "foo",
|
Name: "foo",
|
||||||
Namespace: "other",
|
Namespace: "other",
|
||||||
},
|
},
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Service",
|
Kind: "Service",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ import (
|
|||||||
apierrs "k8s.io/kubernetes/pkg/api/errors"
|
apierrs "k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -94,26 +95,26 @@ func newMapper() *meta.DefaultRESTMapper {
|
|||||||
func addTestTypes() {
|
func addTestTypes() {
|
||||||
type ListOptions struct {
|
type ListOptions struct {
|
||||||
runtime.Object
|
runtime.Object
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
LabelSelector string `json:"labels,omitempty"`
|
LabelSelector string `json:"labels,omitempty"`
|
||||||
FieldSelector string `json:"fields,omitempty"`
|
FieldSelector string `json:"fields,omitempty"`
|
||||||
Watch bool `json:"watch,omitempty"`
|
Watch bool `json:"watch,omitempty"`
|
||||||
ResourceVersion string `json:"resourceVersion,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{})
|
api.Scheme.AddKnownTypes(testVersion, &api.Pod{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func addNewTestTypes() {
|
func addNewTestTypes() {
|
||||||
type ListOptions struct {
|
type ListOptions struct {
|
||||||
runtime.Object
|
runtime.Object
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
LabelSelector string `json:"labelSelector,omitempty"`
|
LabelSelector string `json:"labelSelector,omitempty"`
|
||||||
FieldSelector string `json:"fieldSelector,omitempty"`
|
FieldSelector string `json:"fieldSelector,omitempty"`
|
||||||
Watch bool `json:"watch,omitempty"`
|
Watch bool `json:"watch,omitempty"`
|
||||||
ResourceVersion string `json:"resourceVersion,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() {
|
func init() {
|
||||||
@ -121,7 +122,7 @@ func init() {
|
|||||||
// api.Status is returned in errors
|
// api.Status is returned in errors
|
||||||
|
|
||||||
// "internal" version
|
// "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()
|
addTestTypes()
|
||||||
addNewTestTypes()
|
addNewTestTypes()
|
||||||
|
|
||||||
@ -228,28 +229,28 @@ func handleInternal(legacy bool, storage map[string]rest.Storage, admissionContr
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Simple struct {
|
type Simple struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata"`
|
api.ObjectMeta `json:"metadata"`
|
||||||
Other string `json:"other,omitempty"`
|
Other string `json:"other,omitempty"`
|
||||||
Labels map[string]string `json:"labels,omitempty"`
|
Labels map[string]string `json:"labels,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*Simple) IsAnAPIObject() {}
|
func (*Simple) IsAnAPIObject() {}
|
||||||
|
|
||||||
type SimpleRoot struct {
|
type SimpleRoot struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata"`
|
api.ObjectMeta `json:"metadata"`
|
||||||
Other string `json:"other,omitempty"`
|
Other string `json:"other,omitempty"`
|
||||||
Labels map[string]string `json:"labels,omitempty"`
|
Labels map[string]string `json:"labels,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*SimpleRoot) IsAnAPIObject() {}
|
func (*SimpleRoot) IsAnAPIObject() {}
|
||||||
|
|
||||||
type SimpleGetOptions struct {
|
type SimpleGetOptions struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
Param1 string `json:"param1"`
|
Param1 string `json:"param1"`
|
||||||
Param2 string `json:"param2"`
|
Param2 string `json:"param2"`
|
||||||
Path string `json:"atAPath"`
|
Path string `json:"atAPath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SimpleGetOptions) SwaggerDoc() map[string]string {
|
func (SimpleGetOptions) SwaggerDoc() map[string]string {
|
||||||
@ -262,9 +263,9 @@ func (SimpleGetOptions) SwaggerDoc() map[string]string {
|
|||||||
func (*SimpleGetOptions) IsAnAPIObject() {}
|
func (*SimpleGetOptions) IsAnAPIObject() {}
|
||||||
|
|
||||||
type SimpleList struct {
|
type SimpleList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ListMeta `json:"metadata,inline"`
|
unversioned.ListMeta `json:"metadata,inline"`
|
||||||
Items []Simple `json:"items,omitempty"`
|
Items []Simple `json:"items,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*SimpleList) IsAnAPIObject() {}
|
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 {
|
if err := storage.errors["delete"]; err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var obj runtime.Object = &api.Status{Status: api.StatusSuccess}
|
var obj runtime.Object = &unversioned.Status{Status: unversioned.StatusSuccess}
|
||||||
var err error
|
var err error
|
||||||
if storage.injectedFunction != nil {
|
if storage.injectedFunction != nil {
|
||||||
obj, err = storage.injectedFunction(&Simple{ObjectMeta: api.ObjectMeta{Name: id}})
|
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{}
|
client := http.Client{}
|
||||||
request, err := http.NewRequest(method, url, bytes.NewBuffer(data))
|
request, err := http.NewRequest(method, url, bytes.NewBuffer(data))
|
||||||
if err != nil {
|
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)
|
t.Fatalf("unexpected error on %s %s: %v", method, url, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var status api.Status
|
var status unversioned.Status
|
||||||
_, err = extractBody(response, &status)
|
_, err = extractBody(response, &status)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unexpected error on %s %s: %v", method, url, err)
|
t.Fatalf("unexpected error on %s %s: %v", method, url, err)
|
||||||
@ -2453,7 +2454,7 @@ func TestDelayReturnsError(t *testing.T) {
|
|||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
status := expectApiStatus(t, "DELETE", fmt.Sprintf("%s/api/version/namespaces/default/foo/bar", server.URL), nil, http.StatusConflict)
|
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)
|
t.Errorf("Unexpected status %#v", status)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2470,7 +2471,7 @@ func TestWriteJSONDecodeError(t *testing.T) {
|
|||||||
}))
|
}))
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
status := expectApiStatus(t, "GET", server.URL, nil, http.StatusInternalServerError)
|
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)
|
t.Errorf("unexpected reason %#v", status)
|
||||||
}
|
}
|
||||||
if !strings.Contains(status.Message, "type apiserver.UnregisteredAPIObject is not registered") {
|
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)
|
t.Errorf("unexpected error: %v", err)
|
||||||
}
|
}
|
||||||
itemOut := expectApiStatus(t, "POST", server.URL+"/api/version/namespaces/default/foo?timeout=4ms", data, apierrs.StatusServerTimeout)
|
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)
|
t.Errorf("Unexpected status %#v", itemOut)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,29 +20,29 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
etcdstorage "k8s.io/kubernetes/pkg/storage/etcd"
|
etcdstorage "k8s.io/kubernetes/pkg/storage/etcd"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"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 {
|
type statusError interface {
|
||||||
Status() api.Status
|
Status() unversioned.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
// errToAPIStatus converts an error to an api.Status object.
|
// errToAPIStatus converts an error to an unversioned.Status object.
|
||||||
func errToAPIStatus(err error) *api.Status {
|
func errToAPIStatus(err error) *unversioned.Status {
|
||||||
switch t := err.(type) {
|
switch t := err.(type) {
|
||||||
case statusError:
|
case statusError:
|
||||||
status := t.Status()
|
status := t.Status()
|
||||||
if len(status.Status) == 0 {
|
if len(status.Status) == 0 {
|
||||||
status.Status = api.StatusFailure
|
status.Status = unversioned.StatusFailure
|
||||||
}
|
}
|
||||||
if status.Code == 0 {
|
if status.Code == 0 {
|
||||||
switch status.Status {
|
switch status.Status {
|
||||||
case api.StatusSuccess:
|
case unversioned.StatusSuccess:
|
||||||
status.Code = http.StatusOK
|
status.Code = http.StatusOK
|
||||||
case api.StatusFailure:
|
case unversioned.StatusFailure:
|
||||||
status.Code = http.StatusInternalServerError
|
status.Code = http.StatusInternalServerError
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -59,11 +59,11 @@ func errToAPIStatus(err error) *api.Status {
|
|||||||
// by REST storage - these typically indicate programmer
|
// by REST storage - these typically indicate programmer
|
||||||
// error by not using pkg/api/errors, or unexpected failure
|
// error by not using pkg/api/errors, or unexpected failure
|
||||||
// cases.
|
// cases.
|
||||||
util.HandleError(fmt.Errorf("apiserver received an error that is not an api.Status: %v", err))
|
util.HandleError(fmt.Errorf("apiserver received an error that is not an unversioned.Status: %v", err))
|
||||||
return &api.Status{
|
return &unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: status,
|
Code: status,
|
||||||
Reason: api.StatusReasonUnknown,
|
Reason: unversioned.StatusReasonUnknown,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,38 +22,38 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestErrorsToAPIStatus(t *testing.T) {
|
func TestErrorsToAPIStatus(t *testing.T) {
|
||||||
cases := map[error]api.Status{
|
cases := map[error]unversioned.Status{
|
||||||
errors.NewNotFound("foo", "bar"): {
|
errors.NewNotFound("foo", "bar"): {
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusNotFound,
|
Code: http.StatusNotFound,
|
||||||
Reason: api.StatusReasonNotFound,
|
Reason: unversioned.StatusReasonNotFound,
|
||||||
Message: "foo \"bar\" not found",
|
Message: "foo \"bar\" not found",
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: "foo",
|
Kind: "foo",
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors.NewAlreadyExists("foo", "bar"): {
|
errors.NewAlreadyExists("foo", "bar"): {
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusConflict,
|
Code: http.StatusConflict,
|
||||||
Reason: "AlreadyExists",
|
Reason: "AlreadyExists",
|
||||||
Message: "foo \"bar\" already exists",
|
Message: "foo \"bar\" already exists",
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: "foo",
|
Kind: "foo",
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
errors.NewConflict("foo", "bar", stderrs.New("failure")): {
|
errors.NewConflict("foo", "bar", stderrs.New("failure")): {
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Code: http.StatusConflict,
|
Code: http.StatusConflict,
|
||||||
Reason: "Conflict",
|
Reason: "Conflict",
|
||||||
Message: "foo \"bar\" cannot be updated: failure",
|
Message: "foo \"bar\" cannot be updated: failure",
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Kind: "foo",
|
Kind: "foo",
|
||||||
Name: "bar",
|
Name: "bar",
|
||||||
},
|
},
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"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) {
|
result, err := finishRequest(timeout, func() (runtime.Object, error) {
|
||||||
out, err := r.Create(ctx, name, obj)
|
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
|
status.Code = http.StatusCreated
|
||||||
}
|
}
|
||||||
return out, err
|
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
|
// if the rest.Deleter returns a nil object, fill out a status. Callers may return a valid
|
||||||
// object with the response.
|
// object with the response.
|
||||||
if result == nil {
|
if result == nil {
|
||||||
result = &api.Status{
|
result = &unversioned.Status{
|
||||||
Status: api.StatusSuccess,
|
Status: unversioned.StatusSuccess,
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
Details: &api.StatusDetails{
|
Details: &unversioned.StatusDetails{
|
||||||
Name: name,
|
Name: name,
|
||||||
Kind: scope.Kind,
|
Kind: scope.Kind,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// when a non-status response is returned, set the self link
|
// 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 {
|
if err := setSelfLink(result, req, scope.Namer); err != nil {
|
||||||
errorJSON(err, scope.Codec, w)
|
errorJSON(err, scope.Codec, w)
|
||||||
return
|
return
|
||||||
@ -636,7 +637,7 @@ func finishRequest(timeout time.Duration, fn resultFunc) (result runtime.Object,
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case result = <-ch:
|
case result = <-ch:
|
||||||
if status, ok := result.(*api.Status); ok {
|
if status, ok := result.(*unversioned.Status); ok {
|
||||||
return nil, errors.FromObject(status)
|
return nil, errors.FromObject(status)
|
||||||
}
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
"golang.org/x/net/websocket"
|
"golang.org/x/net/websocket"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -361,7 +362,7 @@ func TestWatchHTTPTimeout(t *testing.T) {
|
|||||||
req, _ := http.NewRequest("GET", dest.String(), nil)
|
req, _ := http.NewRequest("GET", dest.String(), nil)
|
||||||
client := http.Client{}
|
client := http.Client{}
|
||||||
resp, err := client.Do(req)
|
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
|
// Make sure we can actually watch an endpoint
|
||||||
decoder := json.NewDecoder(resp.Body)
|
decoder := json.NewDecoder(resp.Body)
|
||||||
|
9
pkg/client/cache/reflector_test.go
vendored
9
pkg/client/cache/reflector_test.go
vendored
@ -24,6 +24,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
"k8s.io/kubernetes/pkg/watch"
|
"k8s.io/kubernetes/pkg/watch"
|
||||||
@ -48,7 +49,7 @@ func TestCloseWatchChannelOnError(t *testing.T) {
|
|||||||
return fw, nil
|
return fw, nil
|
||||||
},
|
},
|
||||||
ListFunc: func() (runtime.Object, error) {
|
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)
|
go r.ListAndWatch(util.NeverStop)
|
||||||
@ -74,7 +75,7 @@ func TestRunUntil(t *testing.T) {
|
|||||||
return fw, nil
|
return fw, nil
|
||||||
},
|
},
|
||||||
ListFunc: func() (runtime.Object, error) {
|
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)
|
r.RunUntil(stopCh)
|
||||||
@ -234,7 +235,7 @@ func TestReflector_ListAndWatch(t *testing.T) {
|
|||||||
return fw, nil
|
return fw, nil
|
||||||
},
|
},
|
||||||
ListFunc: func() (runtime.Object, error) {
|
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)
|
s := NewFIFO(MetaNamespaceKeyFunc)
|
||||||
@ -277,7 +278,7 @@ func TestReflector_ListAndWatchWithErrors(t *testing.T) {
|
|||||||
return &api.Pod{ObjectMeta: api.ObjectMeta{Name: id, ResourceVersion: rv}}
|
return &api.Pod{ObjectMeta: api.ObjectMeta{Name: id, ResourceVersion: rv}}
|
||||||
}
|
}
|
||||||
mkList := func(rv string, pods ...*api.Pod) *api.PodList {
|
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 {
|
for _, pod := range pods {
|
||||||
list.Items = append(list.Items, *pod)
|
list.Items = append(list.Items, *pod)
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/version"
|
"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
|
// APIStatus is exposed by errors that can be converted to an api.Status object
|
||||||
// for finer grained details.
|
// for finer grained details.
|
||||||
type APIStatus interface {
|
type APIStatus interface {
|
||||||
Status() api.Status
|
Status() unversioned.Status
|
||||||
}
|
}
|
||||||
|
|
||||||
// Client is the implementation of a Kubernetes client.
|
// Client is the implementation of a Kubernetes client.
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
)
|
)
|
||||||
@ -37,7 +38,7 @@ func TestListNodes(t *testing.T) {
|
|||||||
Method: "GET",
|
Method: "GET",
|
||||||
Path: testapi.Default.ResourcePath(getNodesResourceName(), "", ""),
|
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())
|
response, err := c.Setup(t).Nodes().List(labels.Everything(), fields.Everything())
|
||||||
c.Validate(t, response, err)
|
c.Validate(t, response, err)
|
||||||
|
@ -33,6 +33,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/metrics"
|
"k8s.io/kubernetes/pkg/client/metrics"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"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?
|
// Did the server give us a status response?
|
||||||
isStatusResponse := false
|
isStatusResponse := false
|
||||||
var status api.Status
|
var status unversioned.Status
|
||||||
if err := r.codec.DecodeInto(body, &status); err == nil && status.Status != "" {
|
if err := r.codec.DecodeInto(body, &status); err == nil && status.Status != "" {
|
||||||
isStatusResponse = true
|
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.
|
// If the server gave us a status back, look at what it was.
|
||||||
success := resp.StatusCode >= http.StatusOK && resp.StatusCode <= http.StatusPartialContent
|
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.
|
// "Failed" requests are clearly just an error and it makes sense to return them as such.
|
||||||
return Result{err: errors.FromObject(&status)}
|
return Result{err: errors.FromObject(&status)}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
@ -436,9 +437,9 @@ func TestRequestWatch(t *testing.T) {
|
|||||||
client: clientFunc(func(req *http.Request) (*http.Response, error) {
|
client: clientFunc(func(req *http.Request) (*http.Response, error) {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusUnauthorized,
|
StatusCode: http.StatusUnauthorized,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Status{
|
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Reason: api.StatusReasonUnauthorized,
|
Reason: unversioned.StatusReasonUnauthorized,
|
||||||
})))),
|
})))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
@ -536,9 +537,9 @@ func TestRequestStream(t *testing.T) {
|
|||||||
client: clientFunc(func(req *http.Request) (*http.Response, error) {
|
client: clientFunc(func(req *http.Request) (*http.Response, error) {
|
||||||
return &http.Response{
|
return &http.Response{
|
||||||
StatusCode: http.StatusUnauthorized,
|
StatusCode: http.StatusUnauthorized,
|
||||||
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &api.Status{
|
Body: ioutil.NopCloser(bytes.NewReader([]byte(runtime.EncodeOrDie(testapi.Default.Codec(), &unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Reason: api.StatusReasonUnauthorized,
|
Reason: unversioned.StatusReasonUnauthorized,
|
||||||
})))),
|
})))),
|
||||||
}, nil
|
}, nil
|
||||||
}),
|
}),
|
||||||
|
@ -22,8 +22,8 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
)
|
)
|
||||||
@ -107,7 +107,7 @@ func TestValidatesHostParameter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDoRequestBearer(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)
|
expectedBody, _ := testapi.Default.Codec().Encode(status)
|
||||||
fakeHandler := util.FakeHandler{
|
fakeHandler := util.FakeHandler{
|
||||||
StatusCode: 400,
|
StatusCode: 400,
|
||||||
@ -136,7 +136,7 @@ func TestDoRequestBearer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDoRequestWithoutPassword(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)
|
expectedBody, _ := testapi.Default.Codec().Encode(status)
|
||||||
fakeHandler := util.FakeHandler{
|
fakeHandler := util.FakeHandler{
|
||||||
StatusCode: 400,
|
StatusCode: 400,
|
||||||
@ -175,7 +175,7 @@ func TestDoRequestWithoutPassword(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDoRequestSuccess(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)
|
expectedBody, _ := testapi.Default.Codec().Encode(status)
|
||||||
fakeHandler := util.FakeHandler{
|
fakeHandler := util.FakeHandler{
|
||||||
StatusCode: 200,
|
StatusCode: 200,
|
||||||
@ -212,12 +212,12 @@ func TestDoRequestSuccess(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDoRequestFailed(t *testing.T) {
|
func TestDoRequestFailed(t *testing.T) {
|
||||||
status := &api.Status{
|
status := &unversioned.Status{
|
||||||
Code: http.StatusNotFound,
|
Code: http.StatusNotFound,
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Reason: api.StatusReasonNotFound,
|
Reason: unversioned.StatusReasonNotFound,
|
||||||
Message: " \"\" not found",
|
Message: " \"\" not found",
|
||||||
Details: &api.StatusDetails{},
|
Details: &unversioned.StatusDetails{},
|
||||||
}
|
}
|
||||||
expectedBody, _ := testapi.Default.Codec().Encode(status)
|
expectedBody, _ := testapi.Default.Codec().Encode(status)
|
||||||
fakeHandler := util.FakeHandler{
|
fakeHandler := util.FakeHandler{
|
||||||
@ -250,7 +250,7 @@ func TestDoRequestFailed(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDoRequestCreated(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)
|
expectedBody, _ := testapi.Default.Codec().Encode(status)
|
||||||
fakeHandler := util.FakeHandler{
|
fakeHandler := util.FakeHandler{
|
||||||
StatusCode: 201,
|
StatusCode: 201,
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util/yaml"
|
"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
|
o.last[kind] = index + 1
|
||||||
|
|
||||||
if status, ok := out.(*api.Status); ok {
|
if status, ok := out.(*unversioned.Status); ok {
|
||||||
if status.Details != nil {
|
if status.Details != nil {
|
||||||
status.Details.Kind = kind
|
status.Details.Kind = kind
|
||||||
}
|
}
|
||||||
if status.Status != api.StatusSuccess {
|
if status.Status != unversioned.StatusSuccess {
|
||||||
return nilValue, &errors.StatusError{ErrStatus: *status}
|
return nilValue, &errors.StatusError{ErrStatus: *status}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +221,7 @@ func (o objects) Add(obj runtime.Object) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
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
|
kind = status.Details.Kind
|
||||||
}
|
}
|
||||||
o.types[kind] = append(o.types[kind], obj)
|
o.types[kind] = append(o.types[kind], obj)
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
"k8s.io/kubernetes/pkg/client/record"
|
"k8s.io/kubernetes/pkg/client/record"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
@ -49,7 +50,7 @@ func NewFakeControllerExpectationsLookup(ttl time.Duration) (*ControllerExpectat
|
|||||||
|
|
||||||
func newReplicationController(replicas int) *api.ReplicationController {
|
func newReplicationController(replicas int) *api.ReplicationController {
|
||||||
rc := &api.ReplicationController{
|
rc := &api.ReplicationController{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
UID: util.NewUUID(),
|
UID: util.NewUUID(),
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
endptspkg "k8s.io/kubernetes/pkg/api/endpoints"
|
endptspkg "k8s.io/kubernetes/pkg/api/endpoints"
|
||||||
_ "k8s.io/kubernetes/pkg/api/latest"
|
_ "k8s.io/kubernetes/pkg/api/latest"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -35,7 +36,7 @@ import (
|
|||||||
func addPods(store cache.Store, namespace string, nPods int, nPorts int, nNotReady int) {
|
func addPods(store cache.Store, namespace string, nPods int, nPorts int, nNotReady int) {
|
||||||
for i := 0; i < nPods+nNotReady; i++ {
|
for i := 0; i < nPods+nNotReady; i++ {
|
||||||
p := &api.Pod{
|
p := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Namespace: namespace,
|
Namespace: namespace,
|
||||||
Name: fmt.Sprintf("pod%d", i),
|
Name: fmt.Sprintf("pod%d", i),
|
||||||
@ -202,7 +203,7 @@ func TestCheckLeftoverEndpoints(t *testing.T) {
|
|||||||
// below.
|
// below.
|
||||||
testServer, _ := makeTestServer(t, api.NamespaceAll,
|
testServer, _ := makeTestServer(t, api.NamespaceAll,
|
||||||
serverResponse{http.StatusOK, &api.EndpointsList{
|
serverResponse{http.StatusOK, &api.EndpointsList{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "1",
|
ResourceVersion: "1",
|
||||||
},
|
},
|
||||||
Items: []api.Endpoints{{
|
Items: []api.Endpoints{{
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
|
"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 {
|
func newReplicationController(replicas int) *api.ReplicationController {
|
||||||
rc := &api.ReplicationController{
|
rc := &api.ReplicationController{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
UID: util.NewUUID(),
|
UID: util.NewUUID(),
|
||||||
Name: "foobar",
|
Name: "foobar",
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
@ -281,7 +282,7 @@ func TestRunExposeServiceFromFile(t *testing.T) {
|
|||||||
},
|
},
|
||||||
input: &api.Service{
|
input: &api.Service{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", ResourceVersion: "12"},
|
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{
|
Spec: api.ServiceSpec{
|
||||||
Selector: map[string]string{"app": "go"},
|
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"},
|
flags: map[string]string{"selector": "func=stream", "protocol": "UDP", "port": "14", "name": "foo", "labels": "svc=test"},
|
||||||
output: &api.Service{
|
output: &api.Service{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", ResourceVersion: "12", Labels: map[string]string{"svc": "test"}},
|
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{
|
Spec: api.ServiceSpec{
|
||||||
Ports: []api.ServicePort{
|
Ports: []api.ServicePort{
|
||||||
{
|
{
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -40,7 +41,7 @@ import (
|
|||||||
func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList) {
|
func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
pods := &api.PodList{
|
pods := &api.PodList{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "15",
|
ResourceVersion: "15",
|
||||||
},
|
},
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
@ -63,7 +64,7 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList)
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
svc := &api.ServiceList{
|
svc := &api.ServiceList{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "16",
|
ResourceVersion: "16",
|
||||||
},
|
},
|
||||||
Items: []api.Service{
|
Items: []api.Service{
|
||||||
@ -77,7 +78,7 @@ func testData() (*api.PodList, *api.ServiceList, *api.ReplicationControllerList)
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
rc := &api.ReplicationControllerList{
|
rc := &api.ReplicationControllerList{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "17",
|
ResourceVersion: "17",
|
||||||
},
|
},
|
||||||
Items: []api.ReplicationController{
|
Items: []api.ReplicationController{
|
||||||
|
@ -29,6 +29,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/validation"
|
"k8s.io/kubernetes/pkg/api/validation"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||||
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
|
||||||
@ -127,7 +128,7 @@ func TestLabelsForObject(t *testing.T) {
|
|||||||
name: "successful re-use of labels",
|
name: "successful re-use of labels",
|
||||||
object: &api.Service{
|
object: &api.Service{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "baz", Namespace: "test", Labels: map[string]string{"svc": "test"}},
|
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",
|
expected: "svc=test",
|
||||||
err: nil,
|
err: nil,
|
||||||
@ -136,7 +137,7 @@ func TestLabelsForObject(t *testing.T) {
|
|||||||
name: "empty labels",
|
name: "empty labels",
|
||||||
object: &api.Service{
|
object: &api.Service{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "foo", Namespace: "test", Labels: map[string]string{}},
|
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: "",
|
expected: "",
|
||||||
err: nil,
|
err: nil,
|
||||||
@ -145,7 +146,7 @@ func TestLabelsForObject(t *testing.T) {
|
|||||||
name: "nil labels",
|
name: "nil labels",
|
||||||
object: &api.Service{
|
object: &api.Service{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "zen", Namespace: "test", Labels: nil},
|
ObjectMeta: api.ObjectMeta{Name: "zen", Namespace: "test", Labels: nil},
|
||||||
TypeMeta: api.TypeMeta{Kind: "Service", APIVersion: "v1"},
|
TypeMeta: unversioned.TypeMeta{Kind: "Service", APIVersion: "v1"},
|
||||||
},
|
},
|
||||||
expected: "",
|
expected: "",
|
||||||
err: nil,
|
err: nil,
|
||||||
|
@ -29,9 +29,9 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/evanphx/json-patch"
|
"github.com/evanphx/json-patch"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||||
"k8s.io/kubernetes/pkg/kubectl/resource"
|
"k8s.io/kubernetes/pkg/kubectl/resource"
|
||||||
@ -122,7 +122,7 @@ func checkErr(err error, handleErr func(string)) {
|
|||||||
handleErr(msg)
|
handleErr(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func statusCausesToAggrError(scs []api.StatusCause) utilerrors.Aggregate {
|
func statusCausesToAggrError(scs []unversioned.StatusCause) utilerrors.Aggregate {
|
||||||
errs := make([]error, len(scs))
|
errs := make([]error, len(scs))
|
||||||
for i, sc := range scs {
|
for i, sc := range scs {
|
||||||
errs[i] = fmt.Errorf("%s: %s", sc.Field, sc.Message)
|
errs[i] = fmt.Errorf("%s: %s", sc.Field, sc.Message)
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
)
|
)
|
||||||
@ -251,7 +252,7 @@ bar
|
|||||||
FieldSpec: "{.apiVersion}",
|
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
|
expectedOutput: `NAME API_VERSION
|
||||||
foo baz
|
foo baz
|
||||||
`,
|
`,
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util/errors"
|
"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) {
|
func testData() (*api.PodList, *api.ServiceList) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
pods := &api.PodList{
|
pods := &api.PodList{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "15",
|
ResourceVersion: "15",
|
||||||
},
|
},
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
@ -107,7 +108,7 @@ func testData() (*api.PodList, *api.ServiceList) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
svc := &api.ServiceList{
|
svc := &api.ServiceList{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: "16",
|
ResourceVersion: "16",
|
||||||
},
|
},
|
||||||
Items: []api.Service{
|
Items: []api.Service{
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -60,14 +61,14 @@ func TestHelperDelete(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
Body: objBody(&api.Status{Status: api.StatusFailure}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
|
||||||
},
|
},
|
||||||
Err: true,
|
Err: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: objBody(&api.Status{Status: api.StatusSuccess}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess}),
|
||||||
},
|
},
|
||||||
Req: func(req *http.Request) bool {
|
Req: func(req *http.Request) bool {
|
||||||
if req.Method != "DELETE" {
|
if req.Method != "DELETE" {
|
||||||
@ -147,14 +148,14 @@ func TestHelperCreate(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
Body: objBody(&api.Status{Status: api.StatusFailure}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
|
||||||
},
|
},
|
||||||
Err: true,
|
Err: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
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"}},
|
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
|
||||||
ExpectObject: &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,
|
Modify: false,
|
||||||
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
|
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
|
||||||
ExpectObject: &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,
|
Req: expectPost,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -178,7 +179,7 @@ func TestHelperCreate(t *testing.T) {
|
|||||||
TerminationGracePeriodSeconds: &grace,
|
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,
|
Req: expectPost,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -241,7 +242,7 @@ func TestHelperGet(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
Body: objBody(&api.Status{Status: api.StatusFailure}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
|
||||||
},
|
},
|
||||||
Err: true,
|
Err: true,
|
||||||
},
|
},
|
||||||
@ -308,7 +309,7 @@ func TestHelperList(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
Body: objBody(&api.Status{Status: api.StatusFailure}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
|
||||||
},
|
},
|
||||||
Err: true,
|
Err: true,
|
||||||
},
|
},
|
||||||
@ -403,7 +404,7 @@ func TestHelperReplace(t *testing.T) {
|
|||||||
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
|
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusNotFound,
|
StatusCode: http.StatusNotFound,
|
||||||
Body: objBody(&api.Status{Status: api.StatusFailure}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusFailure}),
|
||||||
},
|
},
|
||||||
Err: true,
|
Err: true,
|
||||||
},
|
},
|
||||||
@ -412,7 +413,7 @@ func TestHelperReplace(t *testing.T) {
|
|||||||
ExpectObject: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
|
ExpectObject: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo"}},
|
||||||
Resp: &http.Response{
|
Resp: &http.Response{
|
||||||
StatusCode: http.StatusOK,
|
StatusCode: http.StatusOK,
|
||||||
Body: objBody(&api.Status{Status: api.StatusSuccess}),
|
Body: objBody(&unversioned.Status{Status: unversioned.StatusSuccess}),
|
||||||
},
|
},
|
||||||
Req: expectPut,
|
Req: expectPut,
|
||||||
},
|
},
|
||||||
@ -429,7 +430,7 @@ func TestHelperReplace(t *testing.T) {
|
|||||||
Overwrite: true,
|
Overwrite: true,
|
||||||
RespFunc: func(req *http.Request) (*http.Response, error) {
|
RespFunc: func(req *http.Request) (*http.Response, error) {
|
||||||
if req.Method == "PUT" {
|
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
|
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"}},
|
Object: &api.Pod{ObjectMeta: api.ObjectMeta{Name: "foo", ResourceVersion: "10"}},
|
||||||
ExpectObject: &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,
|
Req: expectPut,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util/errors"
|
"k8s.io/kubernetes/pkg/util/errors"
|
||||||
"k8s.io/kubernetes/pkg/util/sets"
|
"k8s.io/kubernetes/pkg/util/sets"
|
||||||
@ -147,7 +148,7 @@ func (r *Result) Object() (runtime.Object, error) {
|
|||||||
version = versions.List()[0]
|
version = versions.List()[0]
|
||||||
}
|
}
|
||||||
return &api.List{
|
return &api.List{
|
||||||
ListMeta: api.ListMeta{
|
ListMeta: unversioned.ListMeta{
|
||||||
ResourceVersion: version,
|
ResourceVersion: version,
|
||||||
},
|
},
|
||||||
Items: objects,
|
Items: objects,
|
||||||
|
@ -35,6 +35,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apis/experimental"
|
"k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
"k8s.io/kubernetes/pkg/conversion"
|
"k8s.io/kubernetes/pkg/conversion"
|
||||||
@ -213,7 +214,7 @@ func (p *NamePrinter) PrintObj(obj runtime.Object, w io.Writer) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
tpmeta := api.TypeMeta{
|
tpmeta := unversioned.TypeMeta{
|
||||||
APIVersion: version,
|
APIVersion: version,
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apis/experimental"
|
"k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -38,12 +39,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type testStruct struct {
|
type testStruct struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata,omitempty"`
|
api.ObjectMeta `json:"metadata,omitempty"`
|
||||||
Key string `json:"Key"`
|
Key string `json:"Key"`
|
||||||
Map map[string]int `json:"Map"`
|
Map map[string]int `json:"Map"`
|
||||||
StringList []string `json:"StringList"`
|
StringList []string `json:"StringList"`
|
||||||
IntList []int `json:"IntList"`
|
IntList []int `json:"IntList"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ts *testStruct) IsAnAPIObject() {}
|
func (ts *testStruct) IsAnAPIObject() {}
|
||||||
@ -292,7 +293,7 @@ func TestNamePrinter(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
"singleObject": {
|
"singleObject": {
|
||||||
&api.Pod{
|
&api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -302,7 +303,7 @@ func TestNamePrinter(t *testing.T) {
|
|||||||
"pod/foo\n"},
|
"pod/foo\n"},
|
||||||
"List": {
|
"List": {
|
||||||
&v1.List{
|
&v1.List{
|
||||||
TypeMeta: v1.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "List",
|
Kind: "List",
|
||||||
},
|
},
|
||||||
Items: []runtime.RawExtension{
|
Items: []runtime.RawExtension{
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/registered"
|
"k8s.io/kubernetes/pkg/api/registered"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/securitycontext"
|
"k8s.io/kubernetes/pkg/securitycontext"
|
||||||
|
|
||||||
"github.com/ghodss/yaml"
|
"github.com/ghodss/yaml"
|
||||||
@ -33,7 +34,7 @@ func noDefault(*api.Pod) error { return nil }
|
|||||||
func TestDecodeSinglePod(t *testing.T) {
|
func TestDecodeSinglePod(t *testing.T) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -95,7 +96,7 @@ func TestDecodeSinglePod(t *testing.T) {
|
|||||||
func TestDecodePodList(t *testing.T) {
|
func TestDecodePodList(t *testing.T) {
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/validation"
|
"k8s.io/kubernetes/pkg/api/validation"
|
||||||
"k8s.io/kubernetes/pkg/kubelet"
|
"k8s.io/kubernetes/pkg/kubelet"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -78,7 +79,7 @@ func TestReadPodsFromFile(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "Simple pod",
|
desc: "Simple pod",
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
},
|
},
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/validation"
|
"k8s.io/kubernetes/pkg/api/validation"
|
||||||
"k8s.io/kubernetes/pkg/kubelet"
|
"k8s.io/kubernetes/pkg/kubelet"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
@ -58,16 +59,16 @@ func TestExtractInvalidPods(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
desc: "No version",
|
desc: "No version",
|
||||||
pod: &api.Pod{TypeMeta: api.TypeMeta{APIVersion: ""}},
|
pod: &api.Pod{TypeMeta: unversioned.TypeMeta{APIVersion: ""}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "Invalid version",
|
desc: "Invalid version",
|
||||||
pod: &api.Pod{TypeMeta: api.TypeMeta{APIVersion: "v1betta2"}},
|
pod: &api.Pod{TypeMeta: unversioned.TypeMeta{APIVersion: "v1betta2"}},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
desc: "Invalid volume name",
|
desc: "Invalid volume name",
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
Volumes: []api.Volume{{Name: "_INVALID_"}},
|
Volumes: []api.Volume{{Name: "_INVALID_"}},
|
||||||
},
|
},
|
||||||
@ -76,7 +77,7 @@ func TestExtractInvalidPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "Duplicate volume names",
|
desc: "Duplicate volume names",
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
Volumes: []api.Volume{{Name: "repeated"}, {Name: "repeated"}},
|
Volumes: []api.Volume{{Name: "repeated"}, {Name: "repeated"}},
|
||||||
},
|
},
|
||||||
@ -85,7 +86,7 @@ func TestExtractInvalidPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "Unspecified container name",
|
desc: "Unspecified container name",
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
Containers: []api.Container{{Name: ""}},
|
Containers: []api.Container{{Name: ""}},
|
||||||
},
|
},
|
||||||
@ -94,7 +95,7 @@ func TestExtractInvalidPods(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "Invalid container name",
|
desc: "Invalid container name",
|
||||||
pod: &api.Pod{
|
pod: &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{APIVersion: testapi.Default.Version()},
|
TypeMeta: unversioned.TypeMeta{APIVersion: testapi.Default.Version()},
|
||||||
Spec: api.PodSpec{
|
Spec: api.PodSpec{
|
||||||
Containers: []api.Container{{Name: "_INVALID_"}},
|
Containers: []api.Container{{Name: "_INVALID_"}},
|
||||||
},
|
},
|
||||||
@ -132,7 +133,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "Single pod",
|
desc: "Single pod",
|
||||||
pods: &api.Pod{
|
pods: &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
},
|
},
|
||||||
@ -174,7 +175,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
{
|
{
|
||||||
desc: "Multiple pods",
|
desc: "Multiple pods",
|
||||||
pods: &api.PodList{
|
pods: &api.PodList{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "PodList",
|
Kind: "PodList",
|
||||||
APIVersion: "",
|
APIVersion: "",
|
||||||
},
|
},
|
||||||
@ -287,7 +288,7 @@ func TestExtractPodsFromHTTP(t *testing.T) {
|
|||||||
|
|
||||||
func TestURLWithHeader(t *testing.T) {
|
func TestURLWithHeader(t *testing.T) {
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
APIVersion: testapi.Default.Version(),
|
APIVersion: testapi.Default.Version(),
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFieldPath(t *testing.T) {
|
func TestFieldPath(t *testing.T) {
|
||||||
@ -64,7 +65,7 @@ func TestFieldPath(t *testing.T) {
|
|||||||
func TestGenerateContainerRef(t *testing.T) {
|
func TestGenerateContainerRef(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
okPod = api.Pod{
|
okPod = api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: testapi.Default.Version(),
|
APIVersion: testapi.Default.Version(),
|
||||||
},
|
},
|
||||||
|
@ -65,7 +65,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/network"
|
"k8s.io/kubernetes/pkg/kubelet/network"
|
||||||
kubeletTypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubeletTypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
utilexec "k8s.io/kubernetes/pkg/util/exec"
|
utilexec "k8s.io/kubernetes/pkg/util/exec"
|
||||||
@ -154,7 +154,7 @@ func (plugin *execNetworkPlugin) Status(namespace string, name string, id kubele
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
findVersion := struct {
|
findVersion := struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
}{}
|
}{}
|
||||||
err = json.Unmarshal(out, &findVersion)
|
err = json.Unmarshal(out, &findVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
kubeletTypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubeletTypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
"k8s.io/kubernetes/pkg/util/errors"
|
"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)
|
// PodNetworkStatus stores the network status of a pod (currently just the primary IP address)
|
||||||
// This struct represents version "v1"
|
// This struct represents version "v1"
|
||||||
type PodNetworkStatus struct {
|
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 -
|
// 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
|
// - kube expects to be reachable across the cluster
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/record"
|
"k8s.io/kubernetes/pkg/client/record"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
|
"k8s.io/kubernetes/pkg/client/unversioned/testclient"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"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) {
|
client.AddReactor("create", "nodes", func(action testclient.Action) (bool, runtime.Object, error) {
|
||||||
// Return an error on create.
|
// Return an error on create.
|
||||||
return true, &api.Node{}, &apierrors.StatusError{
|
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) {
|
client.AddReactor("get", "nodes", func(action testclient.Action) (bool, runtime.Object, error) {
|
||||||
|
@ -37,6 +37,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/v1"
|
"k8s.io/kubernetes/pkg/api/v1"
|
||||||
"k8s.io/kubernetes/pkg/apis/experimental"
|
"k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
"k8s.io/kubernetes/pkg/apiserver"
|
"k8s.io/kubernetes/pkg/apiserver"
|
||||||
@ -425,16 +426,16 @@ func TestGenerateSSHKey(t *testing.T) {
|
|||||||
var versionsToTest = []string{"v1", "v3"}
|
var versionsToTest = []string{"v1", "v3"}
|
||||||
|
|
||||||
type Foo struct {
|
type Foo struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
|
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
|
||||||
|
|
||||||
SomeField string `json:"someField"`
|
SomeField string `json:"someField"`
|
||||||
OtherField int `json:"otherField"`
|
OtherField int `json:"otherField"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FooList struct {
|
type FooList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.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.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"`
|
||||||
|
|
||||||
items []Foo `json:"items"`
|
items []Foo `json:"items"`
|
||||||
}
|
}
|
||||||
@ -546,7 +547,7 @@ func testInstallThirdPartyAPIGetVersion(t *testing.T, version string) {
|
|||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
},
|
},
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Foo",
|
Kind: "Foo",
|
||||||
APIVersion: version,
|
APIVersion: version,
|
||||||
},
|
},
|
||||||
@ -591,7 +592,7 @@ func testInstallThirdPartyAPIPostForVersion(t *testing.T, version string) {
|
|||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
Name: "test",
|
Name: "test",
|
||||||
},
|
},
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Foo",
|
Kind: "Foo",
|
||||||
APIVersion: version,
|
APIVersion: version,
|
||||||
},
|
},
|
||||||
@ -660,7 +661,7 @@ func testInstallThirdPartyAPIDeleteVersion(t *testing.T, version string) {
|
|||||||
Name: "test",
|
Name: "test",
|
||||||
Namespace: "default",
|
Namespace: "default",
|
||||||
},
|
},
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Foo",
|
Kind: "Foo",
|
||||||
},
|
},
|
||||||
SomeField: "test field",
|
SomeField: "test field",
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
kubeerr "k8s.io/kubernetes/pkg/api/errors"
|
kubeerr "k8s.io/kubernetes/pkg/api/errors"
|
||||||
etcderr "k8s.io/kubernetes/pkg/api/errors/etcd"
|
etcderr "k8s.io/kubernetes/pkg/api/errors/etcd"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/registry/generic"
|
"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 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
|
// Watch makes a matcher for the given label and field, and calls
|
||||||
|
@ -26,6 +26,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
etcderr "k8s.io/kubernetes/pkg/api/errors/etcd"
|
etcderr "k8s.io/kubernetes/pkg/api/errors/etcd"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/capabilities"
|
"k8s.io/kubernetes/pkg/capabilities"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"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")})
|
return nil, errors.NewInvalid("binding", binding.Name, fielderrors.ValidationErrorList{fielderrors.NewFieldRequired("to.name")})
|
||||||
}
|
}
|
||||||
err = r.assignPod(ctx, binding.Name, binding.Target.Name, binding.Annotations)
|
err = r.assignPod(ctx, binding.Name, binding.Target.Name, binding.Annotations)
|
||||||
out = &api.Status{Status: api.StatusSuccess}
|
out = &unversioned.Status{Status: unversioned.StatusSuccess}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
"k8s.io/kubernetes/pkg/api/rest"
|
"k8s.io/kubernetes/pkg/api/rest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api/validation"
|
"k8s.io/kubernetes/pkg/api/validation"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"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) {
|
func (rs *REST) Get(ctx api.Context, id string) (runtime.Object, error) {
|
||||||
|
@ -22,9 +22,9 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
"k8s.io/kubernetes/pkg/api/meta"
|
"k8s.io/kubernetes/pkg/api/meta"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/apis/experimental"
|
"k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"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 {
|
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 {
|
if err := json.Unmarshal(data, &typeMeta); err != nil {
|
||||||
return err
|
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, ","))
|
fmt.Fprintf(buff, template, t.kind+"List", strings.Join(dataStrings, ","))
|
||||||
return buff.Bytes(), nil
|
return buff.Bytes(), nil
|
||||||
case *api.Status:
|
case *unversioned.Status:
|
||||||
return t.delegate.Encode(obj)
|
return t.delegate.Encode(obj)
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unexpected object to encode: %#v", obj)
|
return nil, fmt.Errorf("unexpected object to encode: %#v", obj)
|
||||||
|
@ -23,21 +23,22 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/apis/experimental"
|
"k8s.io/kubernetes/pkg/apis/experimental"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Foo struct {
|
type Foo struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
|
api.ObjectMeta `json:"metadata,omitempty" description:"standard object metadata"`
|
||||||
|
|
||||||
SomeField string `json:"someField"`
|
SomeField string `json:"someField"`
|
||||||
OtherField int `json:"otherField"`
|
OtherField int `json:"otherField"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FooList struct {
|
type FooList struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.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.ListMeta `json:"metadata,omitempty" description:"standard list metadata; see http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata"`
|
||||||
|
|
||||||
items []Foo `json:"items"`
|
items []Foo `json:"items"`
|
||||||
}
|
}
|
||||||
@ -54,11 +55,11 @@ func TestCodec(t *testing.T) {
|
|||||||
name: "missing kind",
|
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",
|
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",
|
name: "resource version",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -67,7 +68,7 @@ func TestCodec(t *testing.T) {
|
|||||||
Name: "bar",
|
Name: "bar",
|
||||||
CreationTimestamp: util.Time{time.Unix(100, 0)},
|
CreationTimestamp: util.Time{time.Unix(100, 0)},
|
||||||
},
|
},
|
||||||
TypeMeta: api.TypeMeta{Kind: "Foo"},
|
TypeMeta: unversioned.TypeMeta{Kind: "Foo"},
|
||||||
},
|
},
|
||||||
name: "creation time",
|
name: "creation time",
|
||||||
},
|
},
|
||||||
@ -78,7 +79,7 @@ func TestCodec(t *testing.T) {
|
|||||||
ResourceVersion: "baz",
|
ResourceVersion: "baz",
|
||||||
Labels: map[string]string{"foo": "bar", "baz": "blah"},
|
Labels: map[string]string{"foo": "bar", "baz": "blah"},
|
||||||
},
|
},
|
||||||
TypeMeta: api.TypeMeta{Kind: "Foo"},
|
TypeMeta: unversioned.TypeMeta{Kind: "Foo"},
|
||||||
},
|
},
|
||||||
name: "labels",
|
name: "labels",
|
||||||
},
|
},
|
||||||
|
@ -34,6 +34,7 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/conversion"
|
"k8s.io/kubernetes/pkg/conversion"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/storage"
|
"k8s.io/kubernetes/pkg/storage"
|
||||||
@ -44,9 +45,9 @@ import (
|
|||||||
const validEtcdVersion = "etcd 2.0.9"
|
const validEtcdVersion = "etcd 2.0.9"
|
||||||
|
|
||||||
type TestResource struct {
|
type TestResource struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
api.ObjectMeta `json:"metadata"`
|
api.ObjectMeta `json:"metadata"`
|
||||||
Value int `json:"value"`
|
Value int `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (*TestResource) IsAnAPIObject() {}
|
func (*TestResource) IsAnAPIObject() {}
|
||||||
@ -125,7 +126,7 @@ func TestList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
expect := api.PodList{
|
expect := api.PodList{
|
||||||
ListMeta: api.ListMeta{ResourceVersion: "10"},
|
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
|
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
|
||||||
@ -198,7 +199,7 @@ func TestListFiltered(t *testing.T) {
|
|||||||
}
|
}
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
expect := api.PodList{
|
expect := api.PodList{
|
||||||
ListMeta: api.ListMeta{ResourceVersion: "10"},
|
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
|
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
|
||||||
@ -274,7 +275,7 @@ func TestListAcrossDirectories(t *testing.T) {
|
|||||||
}
|
}
|
||||||
grace := int64(30)
|
grace := int64(30)
|
||||||
expect := api.PodList{
|
expect := api.PodList{
|
||||||
ListMeta: api.ListMeta{ResourceVersion: "10"},
|
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
// We expect list to be sorted by directory (e.g. namespace) first, then by name.
|
// 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)
|
grace := int64(30)
|
||||||
expect := api.PodList{
|
expect := api.PodList{
|
||||||
ListMeta: api.ListMeta{ResourceVersion: "10"},
|
ListMeta: unversioned.ListMeta{ResourceVersion: "10"},
|
||||||
Items: []api.Pod{
|
Items: []api.Pod{
|
||||||
{
|
{
|
||||||
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
|
ObjectMeta: api.ObjectMeta{Name: "bar", ResourceVersion: "2"},
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/storage"
|
"k8s.io/kubernetes/pkg/storage"
|
||||||
"k8s.io/kubernetes/pkg/tools"
|
"k8s.io/kubernetes/pkg/tools"
|
||||||
@ -183,8 +183,8 @@ func (w *etcdWatcher) translate() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
w.emit(watch.Event{
|
w.emit(watch.Event{
|
||||||
Type: watch.Error,
|
Type: watch.Error,
|
||||||
Object: &api.Status{
|
Object: &unversioned.Status{
|
||||||
Status: api.StatusFailure,
|
Status: unversioned.StatusFailure,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
"github.com/coreos/go-etcd/etcd"
|
"github.com/coreos/go-etcd/etcd"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/storage"
|
"k8s.io/kubernetes/pkg/storage"
|
||||||
"k8s.io/kubernetes/pkg/tools"
|
"k8s.io/kubernetes/pkg/tools"
|
||||||
@ -231,14 +232,14 @@ func TestWatchEtcdError(t *testing.T) {
|
|||||||
if got.Type != watch.Error {
|
if got.Type != watch.Error {
|
||||||
t.Fatalf("Unexpected non-error")
|
t.Fatalf("Unexpected non-error")
|
||||||
}
|
}
|
||||||
status, ok := got.Object.(*api.Status)
|
status, ok := got.Object.(*unversioned.Status)
|
||||||
if !ok {
|
if !ok {
|
||||||
t.Fatalf("Unexpected non-error object type")
|
t.Fatalf("Unexpected non-error object type")
|
||||||
}
|
}
|
||||||
if status.Message != "immediate error" {
|
if status.Message != "immediate error" {
|
||||||
t.Errorf("Unexpected wrong error")
|
t.Errorf("Unexpected wrong error")
|
||||||
}
|
}
|
||||||
if status.Status != api.StatusFailure {
|
if status.Status != unversioned.StatusFailure {
|
||||||
t.Errorf("Unexpected wrong error status")
|
t.Errorf("Unexpected wrong error status")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -289,7 +290,7 @@ func TestWatch(t *testing.T) {
|
|||||||
if e, a := watch.Error, errEvent.Type; e != a {
|
if e, a := watch.Error, errEvent.Type; e != a {
|
||||||
t.Errorf("Expected %v, got %v", 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)
|
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 {
|
if e, a := watch.Error, errEvent.Type; e != a {
|
||||||
t.Errorf("Expected %v, got %v", 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)
|
t.Errorf("Expected %v, got %v", e, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
"k8s.io/kubernetes/pkg/runtime"
|
"k8s.io/kubernetes/pkg/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
@ -252,7 +253,7 @@ func TestReflectorForWatchCache(t *testing.T) {
|
|||||||
return fw, nil
|
return fw, nil
|
||||||
},
|
},
|
||||||
ListFunc: func() (runtime.Object, error) {
|
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)
|
r := cache.NewReflector(lw, &api.Pod{}, store, 0)
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
apierrors "k8s.io/kubernetes/pkg/api/errors"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/util/httpstream"
|
"k8s.io/kubernetes/pkg/util/httpstream"
|
||||||
"k8s.io/kubernetes/third_party/golang/netutil"
|
"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"
|
responseError = "unable to read error from server response"
|
||||||
} else {
|
} else {
|
||||||
if obj, err := api.Scheme.Decode(responseErrorBytes); err == nil {
|
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}
|
return nil, &apierrors.StatusError{ErrStatus: *status}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,12 +16,10 @@ limitations under the License.
|
|||||||
|
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import "k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Policy struct {
|
type Policy struct {
|
||||||
api.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Holds the information to configure the fit predicate functions
|
// Holds the information to configure the fit predicate functions
|
||||||
Predicates []PredicatePolicy `json:"predicates"`
|
Predicates []PredicatePolicy `json:"predicates"`
|
||||||
// Holds the information to configure the priority functions
|
// Holds the information to configure the priority functions
|
||||||
|
@ -16,12 +16,10 @@ limitations under the License.
|
|||||||
|
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import "k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
apiv1 "k8s.io/kubernetes/pkg/api/v1"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Policy struct {
|
type Policy struct {
|
||||||
apiv1.TypeMeta `json:",inline"`
|
unversioned.TypeMeta `json:",inline"`
|
||||||
// Holds the information to configure the fit predicate functions
|
// Holds the information to configure the fit predicate functions
|
||||||
Predicates []PredicatePolicy `json:"predicates"`
|
Predicates []PredicatePolicy `json:"predicates"`
|
||||||
// Holds the information to configure the priority functions
|
// Holds the information to configure the priority functions
|
||||||
|
@ -27,6 +27,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/cache"
|
"k8s.io/kubernetes/pkg/client/cache"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/controller/framework"
|
"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 GinkgoRecover()
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
@ -40,7 +41,7 @@ var dnsServiceLableSelector = labels.Set{
|
|||||||
|
|
||||||
func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd string) *api.Pod {
|
func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd string) *api.Pod {
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: latest.GroupOrDie("").Version,
|
APIVersion: latest.GroupOrDie("").Version,
|
||||||
},
|
},
|
||||||
|
@ -18,10 +18,12 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
"path"
|
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
)
|
)
|
||||||
@ -205,7 +207,7 @@ func formatMedium(medium api.StorageMedium) string {
|
|||||||
func testPodWithVolume(image, path string, source *api.EmptyDirVolumeSource) *api.Pod {
|
func testPodWithVolume(image, path string, source *api.EmptyDirVolumeSource) *api.Pod {
|
||||||
podName := "pod-" + string(util.NewUUID())
|
podName := "pod-" + string(util.NewUUID())
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: latest.GroupOrDie("").Version,
|
APIVersion: latest.GroupOrDie("").Version,
|
||||||
},
|
},
|
||||||
|
@ -18,12 +18,14 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"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/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
@ -121,7 +123,7 @@ func testPodWithHostVol(path string, source *api.HostPathVolumeSource) *api.Pod
|
|||||||
podName := "pod-host-path-test"
|
podName := "pod-host-path-test"
|
||||||
|
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: latest.GroupOrDie("").Version,
|
APIVersion: latest.GroupOrDie("").Version,
|
||||||
},
|
},
|
||||||
|
@ -23,6 +23,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"k8s.io/kubernetes/pkg/labels"
|
||||||
"k8s.io/kubernetes/pkg/util"
|
"k8s.io/kubernetes/pkg/util"
|
||||||
@ -55,7 +56,7 @@ var _ = Describe("Networking", func() {
|
|||||||
podName := "wget-test"
|
podName := "wget-test"
|
||||||
contName := "wget-test-container"
|
contName := "wget-test-container"
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
@ -28,6 +28,7 @@ import (
|
|||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
|
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
@ -340,7 +341,7 @@ func testPDPod(diskName, targetHost string, readOnly bool, numContainers int) *a
|
|||||||
}
|
}
|
||||||
|
|
||||||
pod := &api.Pod{
|
pod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: latest.GroupOrDie("").Version,
|
APIVersion: latest.GroupOrDie("").Version,
|
||||||
},
|
},
|
||||||
|
@ -18,14 +18,15 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
|
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
"k8s.io/kubernetes/pkg/api/testapi"
|
"k8s.io/kubernetes/pkg/api/testapi"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Marked with [Skipped] to skip the test by default (see driver.go),
|
// 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
|
// Prepare pod that mounts the NFS volume again and
|
||||||
// checks that /mnt/index.html was scrubbed there
|
// checks that /mnt/index.html was scrubbed there
|
||||||
return &api.Pod{
|
return &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: testapi.Default.Version(),
|
APIVersion: testapi.Default.Version(),
|
||||||
},
|
},
|
||||||
|
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/latest"
|
"k8s.io/kubernetes/pkg/api/latest"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"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.
|
// Add "name": name to the labels, overwriting if it exists.
|
||||||
labels["name"] = name
|
labels["name"] = name
|
||||||
return &api.ReplicationController{
|
return &api.ReplicationController{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "ReplicationController",
|
Kind: "ReplicationController",
|
||||||
APIVersion: latest.GroupOrDie("").Version,
|
APIVersion: latest.GroupOrDie("").Version,
|
||||||
},
|
},
|
||||||
|
@ -22,6 +22,7 @@ import (
|
|||||||
|
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/resource"
|
"k8s.io/kubernetes/pkg/api/resource"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"k8s.io/kubernetes/pkg/fields"
|
||||||
"k8s.io/kubernetes/pkg/labels"
|
"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))
|
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{
|
startPods(c, podsNeededForSaturation, ns, "maxp", api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -215,7 +216,7 @@ var _ = Describe("SchedulerPredicates", func() {
|
|||||||
|
|
||||||
podName := "additional-pod"
|
podName := "additional-pod"
|
||||||
_, err = c.Pods(ns).Create(&api.Pod{
|
_, err = c.Pods(ns).Create(&api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
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))
|
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{
|
startPods(c, podsNeededForSaturation, ns, "overcommit", api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -300,7 +301,7 @@ var _ = Describe("SchedulerPredicates", func() {
|
|||||||
|
|
||||||
podName := "additional-pod"
|
podName := "additional-pod"
|
||||||
_, err = c.Pods(ns).Create(&api.Pod{
|
_, err = c.Pods(ns).Create(&api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
@ -342,7 +343,7 @@ var _ = Describe("SchedulerPredicates", func() {
|
|||||||
_, currentlyDeadPods := getPodsNumbers(allPods)
|
_, currentlyDeadPods := getPodsNumbers(allPods)
|
||||||
|
|
||||||
_, err = c.Pods(ns).Create(&api.Pod{
|
_, err = c.Pods(ns).Create(&api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
},
|
},
|
||||||
ObjectMeta: api.ObjectMeta{
|
ObjectMeta: api.ObjectMeta{
|
||||||
|
@ -33,10 +33,12 @@ package e2e
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
|
||||||
"time"
|
"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/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
)
|
)
|
||||||
@ -99,7 +101,7 @@ func startVolumeServer(client *client.Client, config VolumeTestConfig) *api.Pod
|
|||||||
privileged := new(bool)
|
privileged := new(bool)
|
||||||
*privileged = true
|
*privileged = true
|
||||||
serverPod := &api.Pod{
|
serverPod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
},
|
},
|
||||||
@ -159,7 +161,7 @@ func testVolumeClient(client *client.Client, config VolumeTestConfig, volume api
|
|||||||
podClient := client.Pods(config.namespace)
|
podClient := client.Pods(config.namespace)
|
||||||
|
|
||||||
clientPod := &api.Pod{
|
clientPod := &api.Pod{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Pod",
|
Kind: "Pod",
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
},
|
},
|
||||||
@ -304,7 +306,7 @@ var _ = Describe("Volumes", func() {
|
|||||||
|
|
||||||
// create Endpoints for the server
|
// create Endpoints for the server
|
||||||
endpoints := api.Endpoints{
|
endpoints := api.Endpoints{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Endpoints",
|
Kind: "Endpoints",
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
},
|
},
|
||||||
@ -435,7 +437,7 @@ var _ = Describe("Volumes", func() {
|
|||||||
|
|
||||||
// create secrets for the server
|
// create secrets for the server
|
||||||
secret := api.Secret{
|
secret := api.Secret{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Secret",
|
Kind: "Secret",
|
||||||
APIVersion: "v1",
|
APIVersion: "v1",
|
||||||
},
|
},
|
||||||
@ -507,7 +509,7 @@ var _ = Describe("Volumes", func() {
|
|||||||
|
|
||||||
// create ceph secret
|
// create ceph secret
|
||||||
secret := &api.Secret{
|
secret := &api.Secret{
|
||||||
TypeMeta: api.TypeMeta{
|
TypeMeta: unversioned.TypeMeta{
|
||||||
Kind: "Secret",
|
Kind: "Secret",
|
||||||
APIVersion: "v1beta3",
|
APIVersion: "v1beta3",
|
||||||
},
|
},
|
||||||
|
@ -32,6 +32,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
"k8s.io/kubernetes/pkg/api/errors"
|
"k8s.io/kubernetes/pkg/api/errors"
|
||||||
|
"k8s.io/kubernetes/pkg/api/unversioned"
|
||||||
client "k8s.io/kubernetes/pkg/client/unversioned"
|
client "k8s.io/kubernetes/pkg/client/unversioned"
|
||||||
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
|
||||||
"k8s.io/kubernetes/pkg/fields"
|
"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)
|
glog.Infof("After %v while making a proxy call got error %v", time.Since(start), err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var r api.Status
|
var r unversioned.Status
|
||||||
if err := api.Scheme.DecodeInto(hostname, &r); err != nil {
|
if err := api.Scheme.DecodeInto(hostname, &r); err != nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if r.Status == api.StatusFailure {
|
if r.Status == unversioned.StatusFailure {
|
||||||
glog.Infof("After %v got status %v", time.Since(start), string(hostname))
|
glog.Infof("After %v got status %v", time.Since(start), string(hostname))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user