Merge pull request #39709 from smarterclayton/object_meta

Automatic merge from submit-queue

Move ObjectMeta into pkg/apis/meta/v1

Where it belongs
This commit is contained in:
Kubernetes Submit Queue 2017-01-17 15:32:33 -08:00 committed by GitHub
commit 627e1e8174
1058 changed files with 21002 additions and 16176 deletions

View File

@ -32,6 +32,7 @@ go_library(
"//vendor:github.com/prometheus/client_golang/prometheus", "//vendor:github.com/prometheus/client_golang/prometheus",
"//vendor:github.com/spf13/cobra", "//vendor:github.com/spf13/cobra",
"//vendor:github.com/spf13/pflag", "//vendor:github.com/spf13/pflag",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/apiserver/pkg/healthz", "//vendor:k8s.io/apiserver/pkg/healthz",
], ],

View File

@ -25,6 +25,7 @@ import (
"strconv" "strconv"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apiserver/pkg/healthz" "k8s.io/apiserver/pkg/healthz"
"k8s.io/kubernetes/cmd/cloud-controller-manager/app/options" "k8s.io/kubernetes/cmd/cloud-controller-manager/app/options"
@ -158,7 +159,7 @@ func Run(s *options.CloudControllerManagerServer, cloud cloudprovider.Interface)
// Lock required for leader election // Lock required for leader election
rl := resourcelock.EndpointsLock{ rl := resourcelock.EndpointsLock{
EndpointsMeta: v1.ObjectMeta{ EndpointsMeta: metav1.ObjectMeta{
Namespace: "kube-system", Namespace: "kube-system",
Name: "cloud-controller-manager", Name: "cloud-controller-manager",
}, },

View File

@ -16,10 +16,7 @@ limitations under the License.
package apiregistration package apiregistration
import ( import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kapi "k8s.io/kubernetes/pkg/api"
)
// APIServiceList is a list of APIService objects. // APIServiceList is a list of APIService objects.
type APIServiceList struct { type APIServiceList struct {
@ -75,7 +72,7 @@ type APIServiceStatus struct {
// Name must be "version.group". // Name must be "version.group".
type APIService struct { type APIService struct {
metav1.TypeMeta metav1.TypeMeta
kapi.ObjectMeta metav1.ObjectMeta
// Spec contains information for locating and communicating with a server // Spec contains information for locating and communicating with a server
Spec APIServiceSpec Spec APIServiceSpec

View File

@ -26,8 +26,7 @@ import (
"fmt" "fmt"
codec1978 "github.com/ugorji/go/codec" codec1978 "github.com/ugorji/go/codec"
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkg3_types "k8s.io/apimachinery/pkg/types" pkg2_types "k8s.io/apimachinery/pkg/types"
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
"reflect" "reflect"
"runtime" "runtime"
time "time" time "time"
@ -64,10 +63,9 @@ func init() {
} }
if false { // reference the types, but skip this branch at build/run time if false { // reference the types, but skip this branch at build/run time
var v0 pkg1_v1.TypeMeta var v0 pkg1_v1.TypeMeta
var v1 pkg3_types.UID var v1 pkg2_types.UID
var v2 pkg2_v1.ObjectMeta var v2 time.Time
var v3 time.Time _, _, _ = v0, v1, v2
_, _, _, _ = v0, v1, v2, v3
} }
} }
@ -1340,7 +1338,13 @@ func (x *APIService) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] { if yyq2[2] {
yy10 := &x.ObjectMeta yy10 := &x.ObjectMeta
yy10.CodecEncodeSelf(e) yym11 := z.EncBinary()
_ = yym11
if false {
} else if z.HasExtensions() && z.EncExt(yy10) {
} else {
z.EncFallback(yy10)
}
} else { } else {
r.EncodeNil() r.EncodeNil()
} }
@ -1350,7 +1354,13 @@ func (x *APIService) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string("metadata")) r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy12 := &x.ObjectMeta yy12 := &x.ObjectMeta
yy12.CodecEncodeSelf(e) yym13 := z.EncBinary()
_ = yym13
if false {
} else if z.HasExtensions() && z.EncExt(yy12) {
} else {
z.EncFallback(yy12)
}
} }
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
@ -1474,24 +1484,30 @@ func (x *APIService) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} }
case "metadata": case "metadata":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{} x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else { } else {
yyv8 := &x.ObjectMeta yyv8 := &x.ObjectMeta
yyv8.CodecDecodeSelf(d) yym9 := z.DecBinary()
_ = yym9
if false {
} else if z.HasExtensions() && z.DecExt(yyv8) {
} else {
z.DecFallback(yyv8, false)
}
} }
case "spec": case "spec":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Spec = APIServiceSpec{} x.Spec = APIServiceSpec{}
} else { } else {
yyv9 := &x.Spec yyv10 := &x.Spec
yyv9.CodecDecodeSelf(d) yyv10.CodecDecodeSelf(d)
} }
case "status": case "status":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Status = APIServiceStatus{} x.Status = APIServiceStatus{}
} else { } else {
yyv10 := &x.Status yyv11 := &x.Status
yyv10.CodecDecodeSelf(d) yyv11.CodecDecodeSelf(d)
} }
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
@ -1504,16 +1520,16 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj11 int var yyj12 int
var yyb11 bool var yyb12 bool
var yyhl11 bool = l >= 0 var yyhl12 bool = l >= 0
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1521,21 +1537,21 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Kind = "" x.Kind = ""
} else { } else {
yyv12 := &x.Kind yyv13 := &x.Kind
yym13 := z.DecBinary() yym14 := z.DecBinary()
_ = yym13 _ = yym14
if false { if false {
} else { } else {
*((*string)(yyv12)) = r.DecodeString() *((*string)(yyv13)) = r.DecodeString()
} }
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1543,38 +1559,44 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.APIVersion = "" x.APIVersion = ""
} else { } else {
yyv14 := &x.APIVersion yyv15 := &x.APIVersion
yym15 := z.DecBinary() yym16 := z.DecBinary()
_ = yym15 _ = yym16
if false { if false {
} else { } else {
*((*string)(yyv14)) = r.DecodeString() *((*string)(yyv15)) = r.DecodeString()
} }
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{} x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else { } else {
yyv16 := &x.ObjectMeta yyv17 := &x.ObjectMeta
yyv16.CodecDecodeSelf(d) yym18 := z.DecBinary()
_ = yym18
if false {
} else if z.HasExtensions() && z.DecExt(yyv17) {
} else {
z.DecFallback(yyv17, false)
}
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1582,16 +1604,16 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Spec = APIServiceSpec{} x.Spec = APIServiceSpec{}
} else { } else {
yyv17 := &x.Spec yyv19 := &x.Spec
yyv17.CodecDecodeSelf(d) yyv19.CodecDecodeSelf(d)
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1599,21 +1621,21 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Status = APIServiceStatus{} x.Status = APIServiceStatus{}
} else { } else {
yyv18 := &x.Status yyv20 := &x.Status
yyv18.CodecDecodeSelf(d) yyv20.CodecDecodeSelf(d)
} }
for { for {
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj11-1, "") z.DecStructFieldNotFound(yyj12-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -16,10 +16,7 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
kapi "k8s.io/kubernetes/pkg/api/v1"
)
// APIServiceList is a list of APIService objects. // APIServiceList is a list of APIService objects.
type APIServiceList struct { type APIServiceList struct {
@ -74,8 +71,8 @@ type APIServiceStatus struct {
// APIService represents a server for a particular GroupVersion. // APIService represents a server for a particular GroupVersion.
// Name must be "version.group". // Name must be "version.group".
type APIService struct { type APIService struct {
metav1.TypeMeta `json:",inline"` metav1.TypeMeta `json:",inline"`
kapi.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec contains information for locating and communicating with a server // Spec contains information for locating and communicating with a server
Spec APIServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` Spec APIServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`

View File

@ -49,10 +49,7 @@ func RegisterConversions(scheme *runtime.Scheme) error {
} }
func autoConvert_v1alpha1_APIService_To_apiregistration_APIService(in *APIService, out *apiregistration.APIService, s conversion.Scope) error { func autoConvert_v1alpha1_APIService_To_apiregistration_APIService(in *APIService, out *apiregistration.APIService, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it? out.ObjectMeta = in.ObjectMeta
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_v1alpha1_APIServiceSpec_To_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil { if err := Convert_v1alpha1_APIServiceSpec_To_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil {
return err return err
} }
@ -67,10 +64,7 @@ func Convert_v1alpha1_APIService_To_apiregistration_APIService(in *APIService, o
} }
func autoConvert_apiregistration_APIService_To_v1alpha1_APIService(in *apiregistration.APIService, out *APIService, s conversion.Scope) error { func autoConvert_apiregistration_APIService_To_v1alpha1_APIService(in *apiregistration.APIService, out *APIService, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it? out.ObjectMeta = in.ObjectMeta
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_apiregistration_APIServiceSpec_To_v1alpha1_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil { if err := Convert_apiregistration_APIServiceSpec_To_v1alpha1_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil {
return err return err
} }

View File

@ -21,9 +21,9 @@ limitations under the License.
package v1alpha1 package v1alpha1
import ( import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
v1 "k8s.io/kubernetes/pkg/api/v1"
reflect "reflect" reflect "reflect"
) )
@ -48,8 +48,10 @@ func DeepCopy_v1alpha1_APIService(in interface{}, out interface{}, c *conversion
in := in.(*APIService) in := in.(*APIService)
out := out.(*APIService) out := out.(*APIService)
*out = *in *out = *in
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
} }
if err := DeepCopy_v1alpha1_APIServiceSpec(&in.Spec, &out.Spec, c); err != nil { if err := DeepCopy_v1alpha1_APIServiceSpec(&in.Spec, &out.Spec, c); err != nil {
return err return err

View File

@ -21,9 +21,9 @@ limitations under the License.
package apiregistration package apiregistration
import ( import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
api "k8s.io/kubernetes/pkg/api"
reflect "reflect" reflect "reflect"
) )
@ -48,8 +48,10 @@ func DeepCopy_apiregistration_APIService(in interface{}, out interface{}, c *con
in := in.(*APIService) in := in.(*APIService)
out := out.(*APIService) out := out.(*APIService)
*out = *in *out = *in
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
} }
if err := DeepCopy_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, c); err != nil { if err := DeepCopy_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, c); err != nil {
return err return err

View File

@ -111,7 +111,7 @@ func TestAPIs(t *testing.T) {
name: "simple add", name: "simple add",
apiservices: []*apiregistration.APIService{ apiservices: []*apiregistration.APIService{
{ {
ObjectMeta: api.ObjectMeta{Name: "v1.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -123,7 +123,7 @@ func TestAPIs(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v1.bar"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.bar"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -172,7 +172,7 @@ func TestAPIs(t *testing.T) {
name: "sorting", name: "sorting",
apiservices: []*apiregistration.APIService{ apiservices: []*apiregistration.APIService{
{ {
ObjectMeta: api.ObjectMeta{Name: "v1.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -184,7 +184,7 @@ func TestAPIs(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v2.bar"}, ObjectMeta: metav1.ObjectMeta{Name: "v2.bar"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -196,7 +196,7 @@ func TestAPIs(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v2.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v2.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -208,7 +208,7 @@ func TestAPIs(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v1.bar"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.bar"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -277,9 +277,9 @@ func TestAPIs(t *testing.T) {
for _, o := range tc.apiservices { for _, o := range tc.apiservices {
indexer.Add(o) indexer.Add(o)
} }
serviceIndexer.Add(&corev1.Service{ObjectMeta: corev1.ObjectMeta{Namespace: "ns", Name: "api"}}) serviceIndexer.Add(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "api"}})
endpointsIndexer.Add(&corev1.Endpoints{ endpointsIndexer.Add(&corev1.Endpoints{
ObjectMeta: corev1.ObjectMeta{Namespace: "ns", Name: "api"}, ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "api"},
Subsets: []corev1.EndpointSubset{ Subsets: []corev1.EndpointSubset{
{Addresses: []corev1.EndpointAddress{{}}}, {Addresses: []corev1.EndpointAddress{{}}},
}, },
@ -352,7 +352,7 @@ func TestAPIGroup(t *testing.T) {
group: "foo", group: "foo",
apiservices: []*apiregistration.APIService{ apiservices: []*apiregistration.APIService{
{ {
ObjectMeta: api.ObjectMeta{Name: "v1.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -364,7 +364,7 @@ func TestAPIGroup(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v2.bar"}, ObjectMeta: metav1.ObjectMeta{Name: "v2.bar"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -376,7 +376,7 @@ func TestAPIGroup(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v2.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v2.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -388,7 +388,7 @@ func TestAPIGroup(t *testing.T) {
}, },
}, },
{ {
ObjectMeta: api.ObjectMeta{Name: "v1.bar"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.bar"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Service: apiregistration.ServiceReference{ Service: apiregistration.ServiceReference{
Namespace: "ns", Namespace: "ns",
@ -434,9 +434,9 @@ func TestAPIGroup(t *testing.T) {
for _, o := range tc.apiservices { for _, o := range tc.apiservices {
indexer.Add(o) indexer.Add(o)
} }
serviceIndexer.Add(&corev1.Service{ObjectMeta: corev1.ObjectMeta{Namespace: "ns", Name: "api"}}) serviceIndexer.Add(&corev1.Service{ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "api"}})
endpointsIndexer.Add(&corev1.Endpoints{ endpointsIndexer.Add(&corev1.Endpoints{
ObjectMeta: corev1.ObjectMeta{Namespace: "ns", Name: "api"}, ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "api"},
Subsets: []corev1.EndpointSubset{ Subsets: []corev1.EndpointSubset{
{Addresses: []corev1.EndpointAddress{{}}}, {Addresses: []corev1.EndpointAddress{{}}},
}, },

View File

@ -25,10 +25,10 @@ import (
"strings" "strings"
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authentication/user"
genericapirequest "k8s.io/apiserver/pkg/request" genericapirequest "k8s.io/apiserver/pkg/request"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration" "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
) )
@ -103,7 +103,7 @@ func TestProxyHandler(t *testing.T) {
}, },
"no user": { "no user": {
apiService: &apiregistration.APIService{ apiService: &apiregistration.APIService{
ObjectMeta: api.ObjectMeta{Name: "v1.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: "foo", Group: "foo",
Version: "v1", Version: "v1",
@ -119,7 +119,7 @@ func TestProxyHandler(t *testing.T) {
}, },
path: "/request/path", path: "/request/path",
apiService: &apiregistration.APIService{ apiService: &apiregistration.APIService{
ObjectMeta: api.ObjectMeta{Name: "v1.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: "foo", Group: "foo",
Version: "v1", Version: "v1",
@ -144,7 +144,7 @@ func TestProxyHandler(t *testing.T) {
}, },
path: "/request/path", path: "/request/path",
apiService: &apiregistration.APIService{ apiService: &apiregistration.APIService{
ObjectMeta: api.ObjectMeta{Name: "v1.foo"}, ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
Spec: apiregistration.APIServiceSpec{ Spec: apiregistration.APIServiceSpec{
Group: "foo", Group: "foo",
Version: "v1", Version: "v1",

View File

@ -16,9 +16,9 @@ go_library(
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library", "//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library",
"//pkg/api:go_default_library",
"//pkg/client/cache:go_default_library", "//pkg/client/cache:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/labels", "//vendor:k8s.io/apimachinery/pkg/labels",
], ],
) )

View File

@ -20,9 +20,9 @@ package internalversion
import ( import (
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration" apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
api "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/cache"
) )
@ -55,7 +55,7 @@ func (s *aPIServiceLister) List(selector labels.Selector) (ret []*apiregistratio
// Get retrieves the APIService from the index for a given name. // Get retrieves the APIService from the index for a given name.
func (s *aPIServiceLister) Get(name string) (*apiregistration.APIService, error) { func (s *aPIServiceLister) Get(name string) (*apiregistration.APIService, error) {
key := &apiregistration.APIService{ObjectMeta: api.ObjectMeta{Name: name}} key := &apiregistration.APIService{ObjectMeta: v1.ObjectMeta{Name: name}}
obj, exists, err := s.indexer.Get(key) obj, exists, err := s.indexer.Get(key)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -17,9 +17,9 @@ go_library(
deps = [ deps = [
"//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library", "//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library",
"//cmd/kube-aggregator/pkg/apis/apiregistration/v1alpha1:go_default_library", "//cmd/kube-aggregator/pkg/apis/apiregistration/v1alpha1:go_default_library",
"//pkg/api/v1:go_default_library",
"//pkg/client/cache:go_default_library", "//pkg/client/cache:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/labels", "//vendor:k8s.io/apimachinery/pkg/labels",
], ],
) )

View File

@ -20,10 +20,10 @@ package v1alpha1
import ( import (
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration" apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
v1alpha1 "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration/v1alpha1" v1alpha1 "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration/v1alpha1"
v1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/cache"
) )

View File

@ -31,6 +31,7 @@ import (
"strconv" "strconv"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -178,7 +179,7 @@ func Run(s *options.CMServer) error {
// TODO: enable other lock types // TODO: enable other lock types
rl := resourcelock.EndpointsLock{ rl := resourcelock.EndpointsLock{
EndpointsMeta: v1.ObjectMeta{ EndpointsMeta: metav1.ObjectMeta{
Namespace: "kube-system", Namespace: "kube-system",
Name: "kube-controller-manager", Name: "kube-controller-manager",
}, },

View File

@ -127,11 +127,11 @@ func standardLabels(n string) map[string]string {
func NewDaemonSet(daemonName string, podSpec v1.PodSpec) *extensions.DaemonSet { func NewDaemonSet(daemonName string, podSpec v1.PodSpec) *extensions.DaemonSet {
l := standardLabels(daemonName) l := standardLabels(daemonName)
return &extensions.DaemonSet{ return &extensions.DaemonSet{
ObjectMeta: v1.ObjectMeta{Name: daemonName}, ObjectMeta: metav1.ObjectMeta{Name: daemonName},
Spec: extensions.DaemonSetSpec{ Spec: extensions.DaemonSetSpec{
Selector: &metav1.LabelSelector{MatchLabels: l}, Selector: &metav1.LabelSelector{MatchLabels: l},
Template: v1.PodTemplateSpec{ Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: l}, ObjectMeta: metav1.ObjectMeta{Labels: l},
Spec: podSpec, Spec: podSpec,
}, },
}, },
@ -141,7 +141,7 @@ func NewDaemonSet(daemonName string, podSpec v1.PodSpec) *extensions.DaemonSet {
func NewService(serviceName string, spec v1.ServiceSpec) *v1.Service { func NewService(serviceName string, spec v1.ServiceSpec) *v1.Service {
l := standardLabels(serviceName) l := standardLabels(serviceName)
return &v1.Service{ return &v1.Service{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: serviceName, Name: serviceName,
Labels: l, Labels: l,
}, },
@ -152,12 +152,12 @@ func NewService(serviceName string, spec v1.ServiceSpec) *v1.Service {
func NewDeployment(deploymentName string, replicas int32, podSpec v1.PodSpec) *extensions.Deployment { func NewDeployment(deploymentName string, replicas int32, podSpec v1.PodSpec) *extensions.Deployment {
l := standardLabels(deploymentName) l := standardLabels(deploymentName)
return &extensions.Deployment{ return &extensions.Deployment{
ObjectMeta: v1.ObjectMeta{Name: deploymentName}, ObjectMeta: metav1.ObjectMeta{Name: deploymentName},
Spec: extensions.DeploymentSpec{ Spec: extensions.DeploymentSpec{
Replicas: &replicas, Replicas: &replicas,
Selector: &metav1.LabelSelector{MatchLabels: l}, Selector: &metav1.LabelSelector{MatchLabels: l},
Template: v1.PodTemplateSpec{ Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{Labels: l}, ObjectMeta: metav1.ObjectMeta{Labels: l},
Spec: podSpec, Spec: podSpec,
}, },
}, },
@ -213,7 +213,7 @@ func UpdateMasterRoleLabelsAndTaints(client *clientset.Clientset, schedulable bo
return nil return nil
} }
func SetMasterTaintTolerations(meta *v1.ObjectMeta) { func SetMasterTaintTolerations(meta *metav1.ObjectMeta) {
tolerationsAnnotation, _ := json.Marshal([]v1.Toleration{{Key: "dedicated", Value: "master", Effect: "NoSchedule"}}) tolerationsAnnotation, _ := json.Marshal([]v1.Toleration{{Key: "dedicated", Value: "master", Effect: "NoSchedule"}})
if meta.Annotations == nil { if meta.Annotations == nil {
meta.Annotations = map[string]string{} meta.Annotations = map[string]string{}
@ -222,7 +222,7 @@ func SetMasterTaintTolerations(meta *v1.ObjectMeta) {
} }
// SetNodeAffinity is a basic helper to set meta.Annotations[v1.AffinityAnnotationKey] for one or more v1.NodeSelectorRequirement(s) // SetNodeAffinity is a basic helper to set meta.Annotations[v1.AffinityAnnotationKey] for one or more v1.NodeSelectorRequirement(s)
func SetNodeAffinity(meta *v1.ObjectMeta, expr ...v1.NodeSelectorRequirement) { func SetNodeAffinity(meta *metav1.ObjectMeta, expr ...v1.NodeSelectorRequirement) {
nodeAffinity := &v1.NodeAffinity{ nodeAffinity := &v1.NodeAffinity{
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{ RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
NodeSelectorTerms: []v1.NodeSelectorTerm{{MatchExpressions: expr}}, NodeSelectorTerms: []v1.NodeSelectorTerm{{MatchExpressions: expr}},

View File

@ -109,7 +109,7 @@ func newKubeDiscovery(cfg *kubeadmapi.MasterConfiguration, caCert *x509.Certific
kd := kubeDiscovery{ kd := kubeDiscovery{
Deployment: NewDeployment(kubeDiscoveryName, 1, newKubeDiscoveryPodSpec(cfg)), Deployment: NewDeployment(kubeDiscoveryName, 1, newKubeDiscoveryPodSpec(cfg)),
Secret: &v1.Secret{ Secret: &v1.Secret{
ObjectMeta: v1.ObjectMeta{Name: kubeDiscoverySecretName}, ObjectMeta: metav1.ObjectMeta{Name: kubeDiscoverySecretName},
Type: v1.SecretTypeOpaque, Type: v1.SecretTypeOpaque,
Data: encodeKubeDiscoverySecretData(cfg.Discovery.Token, cfg.API, caCert), Data: encodeKubeDiscoverySecretData(cfg.Discovery.Token, cfg.API, caCert),
}, },

View File

@ -261,7 +261,7 @@ func componentPod(container api.Container, volumes ...api.Volume) api.Pod {
APIVersion: "v1", APIVersion: "v1",
Kind: "Pod", Kind: "Pod",
}, },
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: container.Name, Name: container.Name,
Namespace: "kube-system", Namespace: "kube-system",
Labels: map[string]string{"component": container.Name, "tier": "control-plane"}, Labels: map[string]string{"component": container.Name, "tier": "control-plane"},

View File

@ -151,7 +151,7 @@ func UpdateOrCreateToken(client *clientset.Clientset, d *kubeadmapi.TokenDiscove
// Secret does not already exist: // Secret does not already exist:
if apierrors.IsNotFound(err) { if apierrors.IsNotFound(err) {
secret = &v1.Secret{ secret = &v1.Secret{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: secretName, Name: secretName,
}, },
Type: api.SecretTypeBootstrapToken, Type: api.SecretTypeBootstrapToken,

View File

@ -16,16 +16,13 @@ limitations under the License.
package testgroup package testgroup
import ( import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api"
)
// +genclient=true // +genclient=true
type TestType struct { type TestType struct {
metav1.TypeMeta metav1.TypeMeta
api.ObjectMeta metav1.ObjectMeta
Status TestTypeStatus Status TestTypeStatus
} }

View File

@ -26,8 +26,7 @@ import (
"fmt" "fmt"
codec1978 "github.com/ugorji/go/codec" codec1978 "github.com/ugorji/go/codec"
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1" pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkg3_types "k8s.io/apimachinery/pkg/types" pkg2_types "k8s.io/apimachinery/pkg/types"
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
"reflect" "reflect"
"runtime" "runtime"
time "time" time "time"
@ -64,10 +63,9 @@ func init() {
} }
if false { // reference the types, but skip this branch at build/run time if false { // reference the types, but skip this branch at build/run time
var v0 pkg1_v1.TypeMeta var v0 pkg1_v1.TypeMeta
var v1 pkg3_types.UID var v1 pkg2_types.UID
var v2 pkg2_v1.ObjectMeta var v2 time.Time
var v3 time.Time _, _, _ = v0, v1, v2
_, _, _, _ = v0, v1, v2, v3
} }
} }
@ -159,7 +157,13 @@ func (x *TestType) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] { if yyq2[2] {
yy10 := &x.ObjectMeta yy10 := &x.ObjectMeta
yy10.CodecEncodeSelf(e) yym11 := z.EncBinary()
_ = yym11
if false {
} else if z.HasExtensions() && z.EncExt(yy10) {
} else {
z.EncFallback(yy10)
}
} else { } else {
r.EncodeNil() r.EncodeNil()
} }
@ -169,7 +173,13 @@ func (x *TestType) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string("metadata")) r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy12 := &x.ObjectMeta yy12 := &x.ObjectMeta
yy12.CodecEncodeSelf(e) yym13 := z.EncBinary()
_ = yym13
if false {
} else if z.HasExtensions() && z.EncExt(yy12) {
} else {
z.EncFallback(yy12)
}
} }
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
@ -276,17 +286,23 @@ func (x *TestType) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} }
case "metadata": case "metadata":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{} x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else { } else {
yyv8 := &x.ObjectMeta yyv8 := &x.ObjectMeta
yyv8.CodecDecodeSelf(d) yym9 := z.DecBinary()
_ = yym9
if false {
} else if z.HasExtensions() && z.DecExt(yyv8) {
} else {
z.DecFallback(yyv8, false)
}
} }
case "status": case "status":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Status = TestTypeStatus{} x.Status = TestTypeStatus{}
} else { } else {
yyv9 := &x.Status yyv10 := &x.Status
yyv9.CodecDecodeSelf(d) yyv10.CodecDecodeSelf(d)
} }
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
@ -299,16 +315,16 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj10 int var yyj11 int
var yyb10 bool var yyb11 bool
var yyhl10 bool = l >= 0 var yyhl11 bool = l >= 0
yyj10++ yyj11++
if yyhl10 { if yyhl11 {
yyb10 = yyj10 > l yyb11 = yyj11 > l
} else { } else {
yyb10 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb10 { if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -316,21 +332,21 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Kind = "" x.Kind = ""
} else { } else {
yyv11 := &x.Kind yyv12 := &x.Kind
yym12 := z.DecBinary() yym13 := z.DecBinary()
_ = yym12 _ = yym13
if false { if false {
} else { } else {
*((*string)(yyv11)) = r.DecodeString() *((*string)(yyv12)) = r.DecodeString()
} }
} }
yyj10++ yyj11++
if yyhl10 { if yyhl11 {
yyb10 = yyj10 > l yyb11 = yyj11 > l
} else { } else {
yyb10 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb10 { if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -338,38 +354,44 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.APIVersion = "" x.APIVersion = ""
} else { } else {
yyv13 := &x.APIVersion yyv14 := &x.APIVersion
yym14 := z.DecBinary() yym15 := z.DecBinary()
_ = yym14 _ = yym15
if false { if false {
} else { } else {
*((*string)(yyv13)) = r.DecodeString() *((*string)(yyv14)) = r.DecodeString()
} }
} }
yyj10++ yyj11++
if yyhl10 { if yyhl11 {
yyb10 = yyj10 > l yyb11 = yyj11 > l
} else { } else {
yyb10 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb10 { if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ObjectMeta = pkg2_v1.ObjectMeta{} x.ObjectMeta = pkg1_v1.ObjectMeta{}
} else { } else {
yyv15 := &x.ObjectMeta yyv16 := &x.ObjectMeta
yyv15.CodecDecodeSelf(d) yym17 := z.DecBinary()
_ = yym17
if false {
} else if z.HasExtensions() && z.DecExt(yyv16) {
} else {
z.DecFallback(yyv16, false)
}
} }
yyj10++ yyj11++
if yyhl10 { if yyhl11 {
yyb10 = yyj10 > l yyb11 = yyj11 > l
} else { } else {
yyb10 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb10 { if yyb11 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -377,21 +399,21 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Status = TestTypeStatus{} x.Status = TestTypeStatus{}
} else { } else {
yyv16 := &x.Status yyv18 := &x.Status
yyv16.CodecDecodeSelf(d) yyv18.CodecDecodeSelf(d)
} }
for { for {
yyj10++ yyj11++
if yyhl10 { if yyhl11 {
yyb10 = yyj10 > l yyb11 = yyj11 > l
} else { } else {
yyb10 = r.CheckBreak() yyb11 = r.CheckBreak()
} }
if yyb10 { if yyb11 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj10-1, "") z.DecStructFieldNotFound(yyj11-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -16,10 +16,7 @@ limitations under the License.
package v1 package v1
import ( import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
)
// +genclient=true // +genclient=true
@ -30,7 +27,7 @@ type TestType struct {
// unversioned objects in the generate file that is not used anywhere other than this test type. // unversioned objects in the generate file that is not used anywhere other than this test type.
// +k8s:openapi-gen=false // +k8s:openapi-gen=false
// +optional // +optional
apiv1.ObjectMeta `json:"metadata,omitempty"` metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional // +optional
Status TestTypeStatus `json:"status,omitempty"` Status TestTypeStatus `json:"status,omitempty"`
} }

View File

@ -657,7 +657,7 @@ func (g *genConversion) doSlice(inType, outType *types.Type, sw *generator.Snipp
} else if g.convertibleOnlyWithinPackage(inType.Elem, outType.Elem) { } else if g.convertibleOnlyWithinPackage(inType.Elem, outType.Elem) {
sw.Do("if err := "+nameTmpl+"(&(*in)[i], &(*out)[i], s); err != nil {\n", argsFromType(inType.Elem, outType.Elem)) sw.Do("if err := "+nameTmpl+"(&(*in)[i], &(*out)[i], s); err != nil {\n", argsFromType(inType.Elem, outType.Elem))
} else { } else {
// TODO: This triggers on v1.ObjectMeta <-> api.ObjectMeta and // TODO: This triggers on metav1.ObjectMeta <-> metav1.ObjectMeta and
// similar because neither package is the target package, and // similar because neither package is the target package, and
// we really don't know which package will have the conversion // we really don't know which package will have the conversion
// function defined. This fires on basically every object // function defined. This fires on basically every object

View File

@ -74,7 +74,7 @@ func generatedBy() string {
} }
// objectMetaForPackage returns the type of ObjectMeta used by package p. // objectMetaForPackage returns the type of ObjectMeta used by package p.
func objectMetaForPackage(p *types.Package) (*types.Type, error) { func objectMetaForPackage(p *types.Package) (*types.Type, bool, error) {
generatingForPackage := false generatingForPackage := false
for _, t := range p.Types { for _, t := range p.Types {
// filter out types which dont have genclient=true. // filter out types which dont have genclient=true.
@ -84,19 +84,19 @@ func objectMetaForPackage(p *types.Package) (*types.Type, error) {
generatingForPackage = true generatingForPackage = true
for _, member := range t.Members { for _, member := range t.Members {
if member.Name == "ObjectMeta" { if member.Name == "ObjectMeta" {
return member.Type, nil return member.Type, isInternal(member), nil
} }
} }
} }
if generatingForPackage { if generatingForPackage {
return nil, fmt.Errorf("unable to find ObjectMeta for any types in package %s", p.Path) return nil, false, fmt.Errorf("unable to find ObjectMeta for any types in package %s", p.Path)
} }
return nil, nil return nil, false, nil
} }
// isInternal returns true if t's package is k8s.io/kubernetes/pkg/api. // isInternal returns true if the tags for a member do not contain a json tag
func isInternal(t *types.Type) bool { func isInternal(m types.Member) bool {
return t.Name.Package == "k8s.io/kubernetes/pkg/api" return !strings.Contains(m.Tags, "json")
} }
func packageForGroup(base string, group clientgentypes.Group) string { func packageForGroup(base string, group clientgentypes.Group) string {
@ -128,7 +128,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
for _, inputDir := range arguments.InputDirs { for _, inputDir := range arguments.InputDirs {
p := context.Universe.Package(inputDir) p := context.Universe.Package(inputDir)
objectMeta, err := objectMetaForPackage(p) objectMeta, internal, err := objectMetaForPackage(p)
if err != nil { if err != nil {
glog.Fatal(err) glog.Fatal(err)
} }
@ -139,7 +139,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
var gv clientgentypes.GroupVersion var gv clientgentypes.GroupVersion
if isInternal(objectMeta) { if internal {
lastSlash := strings.LastIndex(p.Path, "/") lastSlash := strings.LastIndex(p.Path, "/")
if lastSlash == -1 { if lastSlash == -1 {
glog.Fatalf("error constructing internal group version for package %q", p.Path) glog.Fatalf("error constructing internal group version for package %q", p.Path)

View File

@ -87,7 +87,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
for _, inputDir := range arguments.InputDirs { for _, inputDir := range arguments.InputDirs {
p := context.Universe.Package(inputDir) p := context.Universe.Package(inputDir)
objectMeta, err := objectMetaForPackage(p) objectMeta, internal, err := objectMetaForPackage(p)
if err != nil { if err != nil {
glog.Fatal(err) glog.Fatal(err)
} }
@ -99,7 +99,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
var gv clientgentypes.GroupVersion var gv clientgentypes.GroupVersion
var internalGVPkg string var internalGVPkg string
if isInternal(objectMeta) { if internal {
lastSlash := strings.LastIndex(p.Path, "/") lastSlash := strings.LastIndex(p.Path, "/")
if lastSlash == -1 { if lastSlash == -1 {
glog.Fatalf("error constructing internal group version for package %q", p.Path) glog.Fatalf("error constructing internal group version for package %q", p.Path)
@ -165,7 +165,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
} }
// objectMetaForPackage returns the type of ObjectMeta used by package p. // objectMetaForPackage returns the type of ObjectMeta used by package p.
func objectMetaForPackage(p *types.Package) (*types.Type, error) { func objectMetaForPackage(p *types.Package) (*types.Type, bool, error) {
generatingForPackage := false generatingForPackage := false
for _, t := range p.Types { for _, t := range p.Types {
// filter out types which dont have genclient=true. // filter out types which dont have genclient=true.
@ -175,19 +175,19 @@ func objectMetaForPackage(p *types.Package) (*types.Type, error) {
generatingForPackage = true generatingForPackage = true
for _, member := range t.Members { for _, member := range t.Members {
if member.Name == "ObjectMeta" { if member.Name == "ObjectMeta" {
return member.Type, nil return member.Type, isInternal(member), nil
} }
} }
} }
if generatingForPackage { if generatingForPackage {
return nil, fmt.Errorf("unable to find ObjectMeta for any types in package %s", p.Path) return nil, false, fmt.Errorf("unable to find ObjectMeta for any types in package %s", p.Path)
} }
return nil, nil return nil, false, nil
} }
// isInternal returns true if t's package is k8s.io/kubernetes/pkg/api. // isInternal returns true if the tags for a member do not contain a json tag
func isInternal(t *types.Type) bool { func isInternal(m types.Member) bool {
return t.Name.Package == "k8s.io/kubernetes/pkg/api" return !strings.Contains(m.Tags, "json")
} }
// listerGenerator produces a file of listers for a given GroupVersion and // listerGenerator produces a file of listers for a given GroupVersion and

View File

@ -21,6 +21,7 @@ go_library(
deps = [ deps = [
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/api/install:go_default_library", "//pkg/api/install:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
], ],
) )

View File

@ -26,6 +26,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
@ -57,7 +58,7 @@ func main() {
nginxCrt := read(*crt) nginxCrt := read(*crt)
nginxKey := read(*key) nginxKey := read(*key)
secret := &api.Secret{ secret := &api.Secret{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "nginxsecret", Name: "nginxsecret",
}, },
Data: map[string][]byte{ Data: map[string][]byte{

View File

@ -20,6 +20,7 @@ go_library(
tags = ["automanaged"], tags = ["automanaged"],
deps = [ deps = [
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
], ],
) )

View File

@ -23,6 +23,7 @@ import (
"io/ioutil" "io/ioutil"
"log" "log"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
) )
@ -50,7 +51,7 @@ func main() {
} }
cfg := read(*kubeconfig) cfg := read(*kubeconfig)
secret := &api.Secret{ secret := &api.Secret{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: *name, Name: *name,
Namespace: *ns, Namespace: *ns,
}, },

View File

@ -28,7 +28,7 @@ import (
) )
func TestResourceVersioner(t *testing.T) { func TestResourceVersioner(t *testing.T) {
cluster := federation.Cluster{ObjectMeta: api.ObjectMeta{ResourceVersion: "10"}} cluster := federation.Cluster{ObjectMeta: metav1.ObjectMeta{ResourceVersion: "10"}}
version, err := accessor.ResourceVersion(&cluster) version, err := accessor.ResourceVersion(&cluster)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
@ -105,7 +105,7 @@ func TestRESTMapper(t *testing.T) {
t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces) t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces)
} }
rc := &federation.Cluster{ObjectMeta: api.ObjectMeta{Name: "foo"}} rc := &federation.Cluster{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
name, err := mapping.MetadataAccessor.Name(rc) name, err := mapping.MetadataAccessor.Name(rc)
if err != nil { if err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)

View File

@ -99,7 +99,7 @@ type Cluster struct {
// 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
// +optional // +optional
api.ObjectMeta metav1.ObjectMeta
// Spec defines the behavior of the Cluster. // Spec defines the behavior of the Cluster.
// +optional // +optional

View File

@ -468,7 +468,7 @@ func (this *Cluster) String() string {
return "nil" return "nil"
} }
s := strings.Join([]string{`&Cluster{`, s := strings.Join([]string{`&Cluster{`,
`ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_kubernetes_pkg_api_v1.ObjectMeta", 1), `&`, ``, 1) + `,`, `ObjectMeta:` + strings.Replace(strings.Replace(this.ObjectMeta.String(), "ObjectMeta", "k8s_io_apimachinery_pkg_apis_meta_v1.ObjectMeta", 1), `&`, ``, 1) + `,`,
`Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ClusterSpec", "ClusterSpec", 1), `&`, ``, 1) + `,`, `Spec:` + strings.Replace(strings.Replace(this.Spec.String(), "ClusterSpec", "ClusterSpec", 1), `&`, ``, 1) + `,`,
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "ClusterStatus", "ClusterStatus", 1), `&`, ``, 1) + `,`, `Status:` + strings.Replace(strings.Replace(this.Status.String(), "ClusterStatus", "ClusterStatus", 1), `&`, ``, 1) + `,`,
`}`, `}`,
@ -1487,56 +1487,56 @@ var (
) )
var fileDescriptorGenerated = []byte{ var fileDescriptorGenerated = []byte{
// 806 bytes of a gzipped FileDescriptorProto // 802 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6a, 0xeb, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6b, 0x33, 0x55,
0x14, 0xb6, 0xfc, 0x7b, 0x3d, 0xa9, 0xdb, 0xcb, 0xd0, 0x82, 0xeb, 0x85, 0x7c, 0x31, 0xa5, 0xf8, 0x14, 0xce, 0xe4, 0xb3, 0xb9, 0x35, 0x5a, 0x2e, 0x0a, 0x31, 0x8b, 0x49, 0x09, 0x22, 0xad, 0xe8,
0x96, 0x56, 0xc2, 0xa6, 0x94, 0x0b, 0xa5, 0x85, 0x2b, 0x5f, 0x0a, 0x01, 0x87, 0x94, 0x49, 0x28, 0x8c, 0x09, 0x22, 0x05, 0x51, 0xe8, 0xa4, 0x08, 0x85, 0x96, 0xca, 0x6d, 0x71, 0x51, 0x04, 0x9d,
0x25, 0x14, 0x8a, 0x2c, 0x1f, 0x2b, 0xaa, 0xad, 0x1f, 0x66, 0x46, 0x06, 0x67, 0xd5, 0x07, 0xe8, 0x4c, 0x4e, 0xa6, 0x63, 0x32, 0x1f, 0xdc, 0x7b, 0x27, 0x90, 0xae, 0xfc, 0x01, 0x2e, 0xfc, 0x11,
0xa2, 0x0f, 0xd1, 0x37, 0x28, 0x7d, 0x87, 0xec, 0x9a, 0x45, 0x17, 0x59, 0x99, 0xc6, 0x7d, 0x8b, 0xfe, 0x03, 0xd7, 0xee, 0xbb, 0xb3, 0x0b, 0x17, 0x5d, 0x05, 0x1b, 0xff, 0x45, 0x57, 0x2f, 0xf7,
0xac, 0xca, 0x8c, 0x46, 0xb2, 0x15, 0xc5, 0x69, 0x6f, 0xb2, 0xd3, 0x39, 0x3a, 0xe7, 0xfb, 0xbe, 0xce, 0xcd, 0x24, 0xd3, 0x24, 0x7d, 0xfb, 0xb6, 0xbb, 0x39, 0x67, 0xce, 0x79, 0x9e, 0xe7, 0x9e,
0x39, 0x7f, 0xe8, 0xcd, 0xfc, 0x15, 0x33, 0xbc, 0xd0, 0x9c, 0xc7, 0x13, 0xa0, 0x01, 0x70, 0x60, 0x2f, 0x74, 0x34, 0x3c, 0x60, 0x86, 0x17, 0x9a, 0xc3, 0xb8, 0x07, 0x34, 0x00, 0x0e, 0xcc, 0x1c,
0xe6, 0x0c, 0xa6, 0x40, 0x6d, 0xee, 0x85, 0x81, 0x69, 0x47, 0x5e, 0xce, 0x5e, 0x0e, 0x26, 0xc0, 0x40, 0x1f, 0xa8, 0xcd, 0xbd, 0x30, 0x30, 0xed, 0xc8, 0xcb, 0xd8, 0xe3, 0x76, 0x0f, 0xb8, 0xdd,
0xed, 0x81, 0xe9, 0x42, 0x20, 0x5c, 0x30, 0x35, 0x22, 0x1a, 0xf2, 0x10, 0x7f, 0x9e, 0xa0, 0x18, 0x36, 0x5d, 0x08, 0x84, 0x0b, 0xfa, 0x46, 0x44, 0x43, 0x1e, 0xe2, 0xaf, 0x12, 0x14, 0x63, 0x81,
0x5b, 0x14, 0x63, 0x9b, 0x65, 0x08, 0x94, 0x5d, 0x5b, 0xa1, 0x74, 0x3e, 0x73, 0x3d, 0x7e, 0x1e, 0x62, 0x2c, 0xb2, 0x0c, 0x81, 0xb2, 0x6c, 0x2b, 0x94, 0xc6, 0x17, 0xae, 0xc7, 0xaf, 0xe2, 0x9e,
0x4f, 0x0c, 0x27, 0xf4, 0x4d, 0x37, 0x74, 0x43, 0x53, 0x82, 0x4d, 0xe2, 0x99, 0xb4, 0xa4, 0x21, 0xe1, 0x84, 0xbe, 0xe9, 0x86, 0x6e, 0x68, 0x4a, 0xb0, 0x5e, 0x3c, 0x90, 0x96, 0x34, 0xe4, 0x57,
0xbf, 0x12, 0x92, 0x8e, 0x22, 0x11, 0xa2, 0x7c, 0xdb, 0x39, 0xf7, 0x02, 0xa0, 0x2b, 0x33, 0x9a, 0x42, 0xd2, 0x50, 0x24, 0x42, 0x94, 0x6f, 0x3b, 0x57, 0x5e, 0x00, 0x74, 0x62, 0x46, 0x43, 0x37,
0xbb, 0x89, 0x4a, 0x1f, 0xb8, 0x6d, 0x2e, 0x0b, 0xd2, 0x3a, 0xe6, 0xbe, 0x2c, 0x1a, 0x07, 0xdc, 0x51, 0xe9, 0x03, 0xb7, 0xcd, 0xf1, 0x8a, 0xb4, 0x86, 0xb9, 0x29, 0x8b, 0xc6, 0x01, 0xf7, 0x7c,
0xf3, 0xa1, 0x90, 0xf0, 0xc5, 0x7f, 0x25, 0x30, 0xe7, 0x1c, 0x7c, 0xbb, 0x90, 0x37, 0x2c, 0x56, 0x58, 0x49, 0xf8, 0xfa, 0x6d, 0x09, 0xcc, 0xb9, 0x02, 0xdf, 0x5e, 0xc9, 0xeb, 0xac, 0x56, 0x52,
0x52, 0x89, 0x33, 0x29, 0xb0, 0x30, 0xa6, 0x4e, 0x91, 0xeb, 0xd3, 0xfd, 0x39, 0xf7, 0x3c, 0x65, 0x89, 0x33, 0x29, 0xb0, 0x30, 0xa6, 0xce, 0x2a, 0xd7, 0xe7, 0x9b, 0x73, 0xd6, 0x3c, 0xa5, 0xbd,
0x70, 0x7f, 0x74, 0xcc, 0xbd, 0x85, 0xe9, 0x05, 0x9c, 0x71, 0x7a, 0x37, 0xa5, 0xf7, 0x47, 0x19, 0x3e, 0x3a, 0xe6, 0xde, 0xc8, 0xf4, 0x02, 0xce, 0x38, 0x7d, 0x9c, 0xd2, 0xfa, 0x3b, 0x8f, 0x2a,
0x35, 0x46, 0x8b, 0x98, 0x71, 0xa0, 0xf8, 0x7b, 0xf4, 0x4c, 0x14, 0x69, 0x6a, 0x73, 0xbb, 0xad, 0xdd, 0x51, 0xcc, 0x38, 0x50, 0xfc, 0x0b, 0xda, 0x12, 0x45, 0xea, 0xdb, 0xdc, 0xae, 0x6b, 0xbb,
0xbd, 0xd0, 0xfa, 0x07, 0xc3, 0xbe, 0x51, 0xec, 0x5b, 0x34, 0x77, 0x45, 0xc3, 0x8c, 0xe5, 0xc0, 0xda, 0xde, 0x76, 0xe7, 0x4b, 0x43, 0xf5, 0x6d, 0xf9, 0xad, 0x46, 0x34, 0x74, 0x93, 0x96, 0x89,
0x38, 0x9e, 0xfc, 0x04, 0x0e, 0x3f, 0x02, 0x6e, 0x5b, 0xf8, 0x72, 0xdd, 0x2d, 0x6d, 0xd6, 0x5d, 0x68, 0x63, 0xdc, 0x36, 0xce, 0x7a, 0xbf, 0x82, 0xc3, 0x4f, 0x81, 0xdb, 0x16, 0xbe, 0x99, 0x36,
0xb4, 0xf5, 0x91, 0x0c, 0x0d, 0x3b, 0xa8, 0xca, 0x22, 0x70, 0xda, 0x65, 0x89, 0xfa, 0xda, 0x78, 0x73, 0xb3, 0x69, 0x13, 0x2d, 0x7c, 0x24, 0x45, 0xc5, 0x0e, 0x2a, 0xb2, 0x08, 0x9c, 0x7a, 0x5e,
0xcc, 0x34, 0x18, 0x4a, 0xe6, 0x49, 0x04, 0x8e, 0xf5, 0x8e, 0xa2, 0xab, 0x0a, 0x8b, 0x48, 0x70, 0xa2, 0x1f, 0x1a, 0x2f, 0x99, 0x0a, 0x43, 0xc9, 0x3d, 0x8f, 0xc0, 0xb1, 0xde, 0x53, 0x74, 0x45,
0x3c, 0x47, 0x75, 0xc6, 0x6d, 0x1e, 0xb3, 0x76, 0x45, 0xd2, 0x8c, 0x9e, 0x46, 0x23, 0xa1, 0xac, 0x61, 0x11, 0x09, 0x8e, 0x87, 0xa8, 0xcc, 0xb8, 0xcd, 0x63, 0x56, 0x2f, 0x48, 0x9a, 0xee, 0xeb,
0x77, 0x15, 0x51, 0x3d, 0xb1, 0x89, 0xa2, 0xe8, 0x5d, 0x57, 0xd0, 0x73, 0x15, 0x39, 0x0a, 0x83, 0x68, 0x24, 0x94, 0xf5, 0xbe, 0x22, 0x2a, 0x27, 0x36, 0x51, 0x14, 0xad, 0xbb, 0x02, 0xda, 0x51,
0xa9, 0x27, 0x20, 0xf0, 0x2b, 0x54, 0xe5, 0xab, 0x08, 0x64, 0xf1, 0x9a, 0xd6, 0x47, 0xa9, 0xc6, 0x91, 0xdd, 0x30, 0xe8, 0x7b, 0x02, 0x02, 0x1f, 0xa0, 0x22, 0x9f, 0x44, 0x20, 0x8b, 0x58, 0xb5,
0xd3, 0x55, 0x04, 0xb7, 0xeb, 0xee, 0xfb, 0x77, 0xe3, 0x85, 0x9f, 0xc8, 0x0c, 0xfc, 0x5d, 0xa6, 0x3e, 0x99, 0x6b, 0xbc, 0x98, 0x44, 0xf0, 0x30, 0x6d, 0x7e, 0xf8, 0x38, 0x5e, 0xf8, 0x89, 0xcc,
0xbd, 0x2c, 0x73, 0xbf, 0xce, 0xd3, 0xde, 0xae, 0xbb, 0x0f, 0x4e, 0x82, 0x91, 0x61, 0xe6, 0x65, 0xc0, 0x3f, 0xa6, 0xda, 0xf3, 0x32, 0xf7, 0xbb, 0x2c, 0xed, 0xc3, 0xb4, 0xf9, 0xe4, 0x44, 0x18,
0x62, 0x17, 0xb5, 0x16, 0x36, 0xe3, 0xdf, 0xd2, 0x70, 0x02, 0xa7, 0x9e, 0x0f, 0xaa, 0x34, 0x9f, 0x29, 0x66, 0x56, 0x26, 0x76, 0x51, 0x6d, 0x64, 0x33, 0xfe, 0x03, 0x0d, 0x7b, 0x70, 0xe1, 0xf9,
0xa4, 0xa5, 0xd9, 0x9d, 0xe1, 0xb4, 0xb3, 0xcc, 0x10, 0x7d, 0x13, 0xfd, 0x15, 0x19, 0xd6, 0x07, 0xa0, 0x4a, 0xf3, 0xd9, 0xf3, 0xfa, 0x2b, 0x32, 0xac, 0x8f, 0x94, 0x94, 0xda, 0xc9, 0x32, 0x10,
0x4a, 0x4a, 0x6b, 0xbc, 0x0b, 0x44, 0xf2, 0xb8, 0x78, 0x89, 0xb0, 0x70, 0x9c, 0x52, 0x3b, 0x60, 0xc9, 0xe2, 0xe2, 0x31, 0xc2, 0xc2, 0x71, 0x41, 0xed, 0x80, 0x25, 0x8f, 0x13, 0x6c, 0xc5, 0x77,
0xc9, 0xe3, 0x04, 0x5b, 0xf5, 0xad, 0xd9, 0x3a, 0x8a, 0x0d, 0x8f, 0x0b, 0x68, 0xe4, 0x1e, 0x06, 0x66, 0x6b, 0x28, 0x36, 0x7c, 0xb2, 0x82, 0x46, 0xd6, 0x30, 0xe0, 0x4f, 0x51, 0x99, 0x82, 0xcd,
0xfc, 0x31, 0xaa, 0x53, 0xb0, 0x59, 0x18, 0xb4, 0x6b, 0xb2, 0x70, 0x59, 0xbf, 0x88, 0xf4, 0x12, 0xc2, 0xa0, 0x5e, 0x92, 0x85, 0x4b, 0xfb, 0x45, 0xa4, 0x97, 0xa8, 0xbf, 0x78, 0x1f, 0x55, 0x7c,
0xf5, 0x17, 0xbf, 0x44, 0x0d, 0x1f, 0x18, 0xb3, 0x5d, 0x68, 0xd7, 0x65, 0xe0, 0x7b, 0x2a, 0xb0, 0x60, 0xcc, 0x76, 0xa1, 0x5e, 0x96, 0x81, 0x1f, 0xa8, 0xc0, 0xca, 0x69, 0xe2, 0x26, 0xf3, 0xff,
0x71, 0x94, 0xb8, 0x49, 0xfa, 0xbf, 0xf7, 0xa7, 0x86, 0x0e, 0x54, 0xab, 0xc6, 0x1e, 0xe3, 0xf8, 0xad, 0x7f, 0x34, 0xb4, 0xad, 0x5a, 0x75, 0xe2, 0x31, 0x8e, 0x7f, 0x5a, 0x59, 0x0f, 0xe3, 0x79,
0x87, 0xc2, 0x5a, 0x18, 0xff, 0xef, 0x41, 0x22, 0x5b, 0x2e, 0xc7, 0x73, 0xc5, 0xf5, 0x2c, 0xf5, 0x0f, 0x12, 0xd9, 0x72, 0x39, 0x76, 0x14, 0xd7, 0xd6, 0xdc, 0xb3, 0xb4, 0x1a, 0x3d, 0x54, 0xf2,
0xec, 0xac, 0xc6, 0x04, 0xd5, 0x3c, 0x0e, 0xbe, 0x68, 0x7c, 0xa5, 0x7f, 0x30, 0xfc, 0xea, 0x49, 0x38, 0xf8, 0xa2, 0xf1, 0x85, 0xbd, 0xed, 0xce, 0xb7, 0xaf, 0x1a, 0x5a, 0xab, 0xa6, 0x98, 0x4a,
0x43, 0x6b, 0xb5, 0x14, 0x53, 0xed, 0x50, 0x60, 0x92, 0x04, 0xba, 0xf7, 0x5b, 0x39, 0x7b, 0x91, 0xc7, 0x02, 0x93, 0x24, 0xd0, 0xad, 0x3f, 0xf3, 0xe9, 0x8b, 0xc4, 0xbe, 0xe0, 0xbf, 0x34, 0xd4,
0xd8, 0x17, 0xfc, 0xbb, 0x86, 0x3a, 0x0c, 0xe8, 0x12, 0xe8, 0xeb, 0xe9, 0x94, 0x02, 0x63, 0xd6, 0x60, 0x40, 0xc7, 0x40, 0x0f, 0xfb, 0x7d, 0x0a, 0x8c, 0x59, 0x93, 0xee, 0xc8, 0x83, 0x80, 0x77,
0x6a, 0xb4, 0xf0, 0x20, 0xe0, 0xa3, 0xc3, 0x37, 0x84, 0xb5, 0x35, 0xa9, 0xe4, 0xf8, 0x71, 0x4a, 0x8f, 0x8f, 0x08, 0xab, 0x6b, 0x52, 0xc9, 0xd9, 0xcb, 0x94, 0x9c, 0x6f, 0xc2, 0xb5, 0x5a, 0x4a,
0x4e, 0xf6, 0xe1, 0x5a, 0x3d, 0xa5, 0xad, 0xb3, 0x37, 0x84, 0x91, 0x07, 0x64, 0xe1, 0x1f, 0x51, 0x5b, 0x63, 0x63, 0x08, 0x23, 0x4f, 0xc8, 0xc2, 0x3f, 0xa3, 0x2a, 0x03, 0x87, 0x02, 0x27, 0x30,
0x93, 0x81, 0x43, 0x81, 0x13, 0x98, 0xa9, 0x4b, 0x32, 0x7c, 0xf8, 0x3e, 0x8d, 0x43, 0xc7, 0x5e, 0x50, 0x97, 0xa4, 0xb3, 0x46, 0xa3, 0x6a, 0x83, 0x6c, 0x40, 0xe8, 0xd8, 0xa3, 0xe4, 0x20, 0x11,
0x24, 0x07, 0x89, 0xc0, 0x0c, 0x28, 0x04, 0x0e, 0x58, 0xad, 0xcd, 0xba, 0xdb, 0x3c, 0x49, 0x81, 0x18, 0x00, 0x85, 0xc0, 0x01, 0xab, 0x36, 0x9b, 0x36, 0xab, 0xe7, 0x73, 0x20, 0xb2, 0xc0, 0x6c,
0xc8, 0x16, 0xb3, 0xf7, 0x97, 0x86, 0x5a, 0xb9, 0xed, 0xc7, 0x17, 0x08, 0x39, 0xe9, 0x66, 0xa5, 0xfd, 0xab, 0xa1, 0x5a, 0x66, 0xfb, 0xf1, 0x35, 0x42, 0xce, 0x7c, 0xb3, 0xe6, 0x75, 0xf9, 0xfe,
0x75, 0xf9, 0xe6, 0x49, 0x1d, 0xca, 0x16, 0x75, 0x7b, 0x31, 0x33, 0x17, 0x23, 0x3b, 0x6c, 0xb8, 0x55, 0x1d, 0x4a, 0x17, 0x75, 0x71, 0x31, 0x53, 0x17, 0x23, 0x4b, 0x6c, 0xb8, 0x89, 0x4a, 0xd7,
0x8b, 0x6a, 0x17, 0x61, 0x00, 0xac, 0x5d, 0x7b, 0x51, 0xe9, 0x37, 0xad, 0xa6, 0xe8, 0xea, 0x99, 0x61, 0x00, 0xac, 0x5e, 0xda, 0x2d, 0xec, 0x55, 0xad, 0xaa, 0xe8, 0xea, 0xa5, 0x70, 0x90, 0xc4,
0x70, 0x90, 0xc4, 0x9f, 0x8c, 0xbe, 0xeb, 0x85, 0x81, 0x9a, 0xe8, 0x9d, 0xd1, 0x17, 0x5e, 0xa2, 0x9f, 0x8c, 0xbe, 0xeb, 0x85, 0x81, 0x9a, 0xe8, 0xa5, 0xd1, 0x17, 0x5e, 0xa2, 0xfe, 0xb6, 0x7e,
0xfe, 0xf6, 0x7e, 0xd1, 0xd0, 0x87, 0x7b, 0x4b, 0x8e, 0x87, 0x08, 0x39, 0x99, 0xa5, 0x2e, 0xd7, 0xd7, 0xd0, 0xc7, 0x1b, 0x4b, 0x8e, 0x3b, 0x08, 0x39, 0xa9, 0xa5, 0x2e, 0xd7, 0x42, 0x5a, 0xfa,
0x56, 0x5a, 0xf6, 0x87, 0xec, 0x44, 0xe1, 0x2f, 0x51, 0x2b, 0xd7, 0x27, 0x75, 0xb4, 0xb2, 0x4b, 0x87, 0x2c, 0x45, 0xe1, 0x6f, 0x50, 0x2d, 0xd3, 0x27, 0x75, 0xb4, 0xd2, 0x4b, 0x91, 0x61, 0x23,
0x91, 0x63, 0x23, 0xf9, 0x58, 0xeb, 0xe5, 0xe5, 0x8d, 0x5e, 0xba, 0xba, 0xd1, 0x4b, 0xd7, 0x37, 0xd9, 0x58, 0x6b, 0xff, 0xe6, 0x5e, 0xcf, 0xdd, 0xde, 0xeb, 0xb9, 0xbb, 0x7b, 0x3d, 0xf7, 0xdb,
0x7a, 0xe9, 0xe7, 0x8d, 0xae, 0x5d, 0x6e, 0x74, 0xed, 0x6a, 0xa3, 0x6b, 0x7f, 0x6f, 0x74, 0xed, 0x4c, 0xd7, 0x6e, 0x66, 0xba, 0x76, 0x3b, 0xd3, 0xb5, 0xff, 0x66, 0xba, 0xf6, 0xc7, 0xff, 0x7a,
0xd7, 0x7f, 0xf4, 0xd2, 0x59, 0x43, 0xd5, 0xec, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x15, 0xe8, 0xee, 0xb2, 0xa2, 0x6a, 0xf6, 0x26, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x52, 0x01, 0x24, 0x84, 0x08,
0xc4, 0x9a, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x00,
} }

View File

@ -36,7 +36,7 @@ message Cluster {
// 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
// +optional // +optional
optional k8s.io.kubernetes.pkg.api.v1.ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the behavior of the Cluster. // Spec defines the behavior of the Cluster.
// +optional // +optional

View File

@ -1441,7 +1441,13 @@ func (x *Cluster) CodecEncodeSelf(e *codec1978.Encoder) {
z.EncSendContainerState(codecSelfer_containerArrayElem1234) z.EncSendContainerState(codecSelfer_containerArrayElem1234)
if yyq2[2] { if yyq2[2] {
yy10 := &x.ObjectMeta yy10 := &x.ObjectMeta
yy10.CodecEncodeSelf(e) yym11 := z.EncBinary()
_ = yym11
if false {
} else if z.HasExtensions() && z.EncExt(yy10) {
} else {
z.EncFallback(yy10)
}
} else { } else {
r.EncodeNil() r.EncodeNil()
} }
@ -1451,7 +1457,13 @@ func (x *Cluster) CodecEncodeSelf(e *codec1978.Encoder) {
r.EncodeString(codecSelferC_UTF81234, string("metadata")) r.EncodeString(codecSelferC_UTF81234, string("metadata"))
z.EncSendContainerState(codecSelfer_containerMapValue1234) z.EncSendContainerState(codecSelfer_containerMapValue1234)
yy12 := &x.ObjectMeta yy12 := &x.ObjectMeta
yy12.CodecEncodeSelf(e) yym13 := z.EncBinary()
_ = yym13
if false {
} else if z.HasExtensions() && z.EncExt(yy12) {
} else {
z.EncFallback(yy12)
}
} }
} }
if yyr2 || yy2arr2 { if yyr2 || yy2arr2 {
@ -1575,24 +1587,30 @@ func (x *Cluster) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
} }
case "metadata": case "metadata":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ObjectMeta = pkg1_v1.ObjectMeta{} x.ObjectMeta = pkg2_v1.ObjectMeta{}
} else { } else {
yyv8 := &x.ObjectMeta yyv8 := &x.ObjectMeta
yyv8.CodecDecodeSelf(d) yym9 := z.DecBinary()
_ = yym9
if false {
} else if z.HasExtensions() && z.DecExt(yyv8) {
} else {
z.DecFallback(yyv8, false)
}
} }
case "spec": case "spec":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Spec = ClusterSpec{} x.Spec = ClusterSpec{}
} else { } else {
yyv9 := &x.Spec yyv10 := &x.Spec
yyv9.CodecDecodeSelf(d) yyv10.CodecDecodeSelf(d)
} }
case "status": case "status":
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Status = ClusterStatus{} x.Status = ClusterStatus{}
} else { } else {
yyv10 := &x.Status yyv11 := &x.Status
yyv10.CodecDecodeSelf(d) yyv11.CodecDecodeSelf(d)
} }
default: default:
z.DecStructFieldNotFound(-1, yys3) z.DecStructFieldNotFound(-1, yys3)
@ -1605,16 +1623,16 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer1234 var h codecSelfer1234
z, r := codec1978.GenHelperDecoder(d) z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r _, _, _ = h, z, r
var yyj11 int var yyj12 int
var yyb11 bool var yyb12 bool
var yyhl11 bool = l >= 0 var yyhl12 bool = l >= 0
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1622,21 +1640,21 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Kind = "" x.Kind = ""
} else { } else {
yyv12 := &x.Kind yyv13 := &x.Kind
yym13 := z.DecBinary() yym14 := z.DecBinary()
_ = yym13 _ = yym14
if false { if false {
} else { } else {
*((*string)(yyv12)) = r.DecodeString() *((*string)(yyv13)) = r.DecodeString()
} }
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1644,38 +1662,44 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.APIVersion = "" x.APIVersion = ""
} else { } else {
yyv14 := &x.APIVersion yyv15 := &x.APIVersion
yym15 := z.DecBinary() yym16 := z.DecBinary()
_ = yym15 _ = yym16
if false { if false {
} else { } else {
*((*string)(yyv14)) = r.DecodeString() *((*string)(yyv15)) = r.DecodeString()
} }
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.ObjectMeta = pkg1_v1.ObjectMeta{} x.ObjectMeta = pkg2_v1.ObjectMeta{}
} else { } else {
yyv16 := &x.ObjectMeta yyv17 := &x.ObjectMeta
yyv16.CodecDecodeSelf(d) yym18 := z.DecBinary()
_ = yym18
if false {
} else if z.HasExtensions() && z.DecExt(yyv17) {
} else {
z.DecFallback(yyv17, false)
}
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1683,16 +1707,16 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Spec = ClusterSpec{} x.Spec = ClusterSpec{}
} else { } else {
yyv17 := &x.Spec yyv19 := &x.Spec
yyv17.CodecDecodeSelf(d) yyv19.CodecDecodeSelf(d)
} }
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
return return
} }
@ -1700,21 +1724,21 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
if r.TryDecodeAsNil() { if r.TryDecodeAsNil() {
x.Status = ClusterStatus{} x.Status = ClusterStatus{}
} else { } else {
yyv18 := &x.Status yyv20 := &x.Status
yyv18.CodecDecodeSelf(d) yyv20.CodecDecodeSelf(d)
} }
for { for {
yyj11++ yyj12++
if yyhl11 { if yyhl12 {
yyb11 = yyj11 > l yyb12 = yyj12 > l
} else { } else {
yyb11 = r.CheckBreak() yyb12 = r.CheckBreak()
} }
if yyb11 { if yyb12 {
break break
} }
z.DecSendContainerState(codecSelfer_containerArrayElem1234) z.DecSendContainerState(codecSelfer_containerArrayElem1234)
z.DecStructFieldNotFound(yyj11-1, "") z.DecStructFieldNotFound(yyj12-1, "")
} }
z.DecSendContainerState(codecSelfer_containerArrayEnd1234) z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
} }

View File

@ -99,7 +99,7 @@ type Cluster struct {
// 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
// +optional // +optional
v1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the behavior of the Cluster. // Spec defines the behavior of the Cluster.
// +optional // +optional

View File

@ -53,10 +53,7 @@ func RegisterConversions(scheme *runtime.Scheme) error {
} }
func autoConvert_v1beta1_Cluster_To_federation_Cluster(in *Cluster, out *federation.Cluster, s conversion.Scope) error { func autoConvert_v1beta1_Cluster_To_federation_Cluster(in *Cluster, out *federation.Cluster, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it? out.ObjectMeta = in.ObjectMeta
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_v1beta1_ClusterSpec_To_federation_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { if err := Convert_v1beta1_ClusterSpec_To_federation_ClusterSpec(&in.Spec, &out.Spec, s); err != nil {
return err return err
} }
@ -71,10 +68,7 @@ func Convert_v1beta1_Cluster_To_federation_Cluster(in *Cluster, out *federation.
} }
func autoConvert_federation_Cluster_To_v1beta1_Cluster(in *federation.Cluster, out *Cluster, s conversion.Scope) error { func autoConvert_federation_Cluster_To_v1beta1_Cluster(in *federation.Cluster, out *Cluster, s conversion.Scope) error {
// TODO: Inefficient conversion - can we improve it? out.ObjectMeta = in.ObjectMeta
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
return err
}
if err := Convert_federation_ClusterSpec_To_v1beta1_ClusterSpec(&in.Spec, &out.Spec, s); err != nil { if err := Convert_federation_ClusterSpec_To_v1beta1_ClusterSpec(&in.Spec, &out.Spec, s); err != nil {
return err return err
} }

View File

@ -21,9 +21,10 @@ limitations under the License.
package v1beta1 package v1beta1
import ( import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
v1 "k8s.io/kubernetes/pkg/api/v1" api_v1 "k8s.io/kubernetes/pkg/api/v1"
reflect "reflect" reflect "reflect"
) )
@ -49,8 +50,10 @@ func DeepCopy_v1beta1_Cluster(in interface{}, out interface{}, c *conversion.Clo
in := in.(*Cluster) in := in.(*Cluster)
out := out.(*Cluster) out := out.(*Cluster)
*out = *in *out = *in
if err := v1.DeepCopy_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
} }
if err := DeepCopy_v1beta1_ClusterSpec(&in.Spec, &out.Spec, c); err != nil { if err := DeepCopy_v1beta1_ClusterSpec(&in.Spec, &out.Spec, c); err != nil {
return err return err
@ -105,7 +108,7 @@ func DeepCopy_v1beta1_ClusterSpec(in interface{}, out interface{}, c *conversion
} }
if in.SecretRef != nil { if in.SecretRef != nil {
in, out := &in.SecretRef, &out.SecretRef in, out := &in.SecretRef, &out.SecretRef
*out = new(v1.LocalObjectReference) *out = new(api_v1.LocalObjectReference)
**out = **in **out = **in
} }
return nil return nil

View File

@ -27,6 +27,7 @@ go_test(
deps = [ deps = [
"//federation/apis/federation:go_default_library", "//federation/apis/federation:go_default_library",
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
], ],
) )

View File

@ -19,6 +19,7 @@ package validation
import ( import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/federation/apis/federation" "k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
) )
@ -26,7 +27,7 @@ import (
func TestValidateCluster(t *testing.T) { func TestValidateCluster(t *testing.T) {
successCases := []federation.Cluster{ successCases := []federation.Cluster{
{ {
ObjectMeta: api.ObjectMeta{Name: "cluster-s"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -46,15 +47,15 @@ func TestValidateCluster(t *testing.T) {
errorCases := map[string]federation.Cluster{ errorCases := map[string]federation.Cluster{
"missing cluster addresses": { "missing cluster addresses": {
ObjectMeta: api.ObjectMeta{Name: "cluster-f"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-f"},
}, },
"empty cluster addresses": { "empty cluster addresses": {
ObjectMeta: api.ObjectMeta{Name: "cluster-f"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-f"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{}, ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{},
}}, }},
"invalid_label": { "invalid_label": {
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "cluster-f", Name: "cluster-f",
Labels: map[string]string{ Labels: map[string]string{
"NoUppercaseOrSpecialCharsLike=Equals": "bar", "NoUppercaseOrSpecialCharsLike=Equals": "bar",
@ -62,7 +63,7 @@ func TestValidateCluster(t *testing.T) {
}, },
}, },
"invalid cluster name (is a subdomain)": { "invalid cluster name (is a subdomain)": {
ObjectMeta: api.ObjectMeta{Name: "mycluster.mycompany"}, ObjectMeta: metav1.ObjectMeta{Name: "mycluster.mycompany"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -89,7 +90,7 @@ func TestValidateClusterUpdate(t *testing.T) {
successCases := []clusterUpdateTest{ successCases := []clusterUpdateTest{
{ {
old: federation.Cluster{ old: federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "cluster-s"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -100,7 +101,7 @@ func TestValidateClusterUpdate(t *testing.T) {
}, },
}, },
update: federation.Cluster{ update: federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "cluster-s"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -124,7 +125,7 @@ func TestValidateClusterUpdate(t *testing.T) {
errorCases := map[string]clusterUpdateTest{ errorCases := map[string]clusterUpdateTest{
"cluster name changed": { "cluster name changed": {
old: federation.Cluster{ old: federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "cluster-s"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -135,7 +136,7 @@ func TestValidateClusterUpdate(t *testing.T) {
}, },
}, },
update: federation.Cluster{ update: federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "cluster-newname"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-newname"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -163,7 +164,7 @@ func TestValidateClusterStatusUpdate(t *testing.T) {
successCases := []clusterUpdateTest{ successCases := []clusterUpdateTest{
{ {
old: federation.Cluster{ old: federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "cluster-s"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {
@ -179,7 +180,7 @@ func TestValidateClusterStatusUpdate(t *testing.T) {
}, },
}, },
update: federation.Cluster{ update: federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "cluster-s"}, ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
Spec: federation.ClusterSpec{ Spec: federation.ClusterSpec{
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{ ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
{ {

View File

@ -21,6 +21,7 @@ limitations under the License.
package federation package federation
import ( import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion" conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime" runtime "k8s.io/apimachinery/pkg/runtime"
api "k8s.io/kubernetes/pkg/api" api "k8s.io/kubernetes/pkg/api"
@ -51,8 +52,10 @@ func DeepCopy_federation_Cluster(in interface{}, out interface{}, c *conversion.
in := in.(*Cluster) in := in.(*Cluster)
out := out.(*Cluster) out := out.(*Cluster)
*out = *in *out = *in
if err := api.DeepCopy_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, c); err != nil { if newVal, err := c.DeepCopy(&in.ObjectMeta); err != nil {
return err return err
} else {
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
} }
if err := DeepCopy_federation_ClusterSpec(&in.Spec, &out.Spec, c); err != nil { if err := DeepCopy_federation_ClusterSpec(&in.Spec, &out.Spec, c); err != nil {
return err return err

View File

@ -38,7 +38,7 @@ import (
func newCluster(clusterName string, serverUrl string) *federationv1beta1.Cluster { func newCluster(clusterName string, serverUrl string) *federationv1beta1.Cluster {
cluster := federationv1beta1.Cluster{ cluster := federationv1beta1.Cluster{
TypeMeta: metav1.TypeMeta{APIVersion: testapi.Federation.GroupVersion().String()}, TypeMeta: metav1.TypeMeta{APIVersion: testapi.Federation.GroupVersion().String()},
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
UID: uuid.NewUUID(), UID: uuid.NewUUID(),
Name: clusterName, Name: clusterName,
}, },

View File

@ -45,6 +45,7 @@ go_test(
"//pkg/client/clientset_generated/clientset:go_default_library", "//pkg/client/clientset_generated/clientset:go_default_library",
"//pkg/client/clientset_generated/clientset/fake:go_default_library", "//pkg/client/clientset_generated/clientset/fake:go_default_library",
"//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/assert",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",

View File

@ -21,6 +21,7 @@ import (
"testing" "testing"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -78,7 +79,7 @@ func TestConfigMapController(t *testing.T) {
configmapController.Run(stop) configmapController.Run(stop)
configmap1 := &apiv1.ConfigMap{ configmap1 := &apiv1.ConfigMap{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-configmap", Name: "test-configmap",
Namespace: "ns", Namespace: "ns",
SelfLink: "/api/v1/namespaces/ns/configmaps/test-configmap", SelfLink: "/api/v1/namespaces/ns/configmaps/test-configmap",

View File

@ -82,7 +82,7 @@ func TestDaemonSetController(t *testing.T) {
daemonsetController.Run(stop) daemonsetController.Run(stop)
daemonset1 := extensionsv1.DaemonSet{ daemonset1 := extensionsv1.DaemonSet{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-daemonset", Name: "test-daemonset",
Namespace: "ns", Namespace: "ns",
SelfLink: "/api/v1/namespaces/ns/daemonsets/test-daemonset", SelfLink: "/api/v1/namespaces/ns/daemonsets/test-daemonset",

View File

@ -53,6 +53,7 @@ go_test(
"//pkg/client/clientset_generated/clientset/fake:go_default_library", "//pkg/client/clientset_generated/clientset/fake:go_default_library",
"//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/assert",
"//vendor:k8s.io/apimachinery/pkg/api/meta", "//vendor:k8s.io/apimachinery/pkg/api/meta",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",

View File

@ -23,6 +23,7 @@ import (
"time" "time"
"k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -174,7 +175,7 @@ func GetDeploymentFromChan(c chan runtime.Object) *extensionsv1.Deployment {
func newDeploymentWithReplicas(name string, replicas int32) *extensionsv1.Deployment { func newDeploymentWithReplicas(name string, replicas int32) *extensionsv1.Deployment {
return &extensionsv1.Deployment{ return &extensionsv1.Deployment{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: apiv1.NamespaceDefault, Namespace: apiv1.NamespaceDefault,
SelfLink: "/api/v1/namespaces/default/deployments/name", SelfLink: "/api/v1/namespaces/default/deployments/name",

View File

@ -28,6 +28,7 @@ go_library(
"//pkg/util/flowcontrol:go_default_library", "//pkg/util/flowcontrol:go_default_library",
"//vendor:github.com/golang/glog", "//vendor:github.com/golang/glog",
"//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/runtime/schema", "//vendor:k8s.io/apimachinery/pkg/runtime/schema",
"//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/types",
@ -54,6 +55,7 @@ go_test(
"//vendor:github.com/golang/glog", "//vendor:github.com/golang/glog",
"//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/assert",
"//vendor:k8s.io/apimachinery/pkg/api/errors", "//vendor:k8s.io/apimachinery/pkg/api/errors",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",

View File

@ -22,6 +22,7 @@ import (
"time" "time"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkgruntime "k8s.io/apimachinery/pkg/runtime" pkgruntime "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -764,9 +765,9 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
if err != nil { if err != nil {
glog.Errorf("Error deep copying Spec: %v", err) glog.Errorf("Error deep copying Spec: %v", err)
} }
objMetaCopy, ok := objMeta.(*v1.ObjectMeta) objMetaCopy, ok := objMeta.(*metav1.ObjectMeta)
if !ok { if !ok {
glog.Errorf("Internal error: Failed to cast to *v1.ObjectMeta: %v", objMeta) glog.Errorf("Internal error: Failed to cast to *metav1.ObjectMeta: %v", objMeta)
} }
desiredIngress.ObjectMeta = *objMetaCopy desiredIngress.ObjectMeta = *objMetaCopy
objSpecCopy, ok := objSpec.(*extensionsv1beta1.IngressSpec) objSpecCopy, ok := objSpec.(*extensionsv1beta1.IngressSpec)
@ -857,9 +858,9 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
glog.Errorf("Error deep copying ObjectMeta: %v", err) glog.Errorf("Error deep copying ObjectMeta: %v", err)
ic.deliverIngress(ingress, ic.ingressReviewDelay, true) ic.deliverIngress(ingress, ic.ingressReviewDelay, true)
} }
objMetaCopy, ok := objMeta.(*v1.ObjectMeta) objMetaCopy, ok := objMeta.(*metav1.ObjectMeta)
if !ok { if !ok {
glog.Errorf("Internal error: Failed to cast to v1.ObjectMeta: %v", objMeta) glog.Errorf("Internal error: Failed to cast to metav1.ObjectMeta: %v", objMeta)
ic.deliverIngress(ingress, ic.ingressReviewDelay, true) ic.deliverIngress(ingress, ic.ingressReviewDelay, true)
} }
desiredIngress.ObjectMeta = *objMetaCopy desiredIngress.ObjectMeta = *objMetaCopy

View File

@ -23,6 +23,7 @@ import (
"time" "time"
"k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -108,7 +109,7 @@ func TestIngressController(t *testing.T) {
// Add another test without that annotation when // Add another test without that annotation when
// https://github.com/kubernetes/kubernetes/issues/36540 is fixed. // https://github.com/kubernetes/kubernetes/issues/36540 is fixed.
fedIngress := extensionsv1beta1.Ingress{ fedIngress := extensionsv1beta1.Ingress{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-ingress", Name: "test-ingress",
Namespace: "mynamespace", Namespace: "mynamespace",
SelfLink: "/api/v1/namespaces/mynamespace/ingress/test-ingress", SelfLink: "/api/v1/namespaces/mynamespace/ingress/test-ingress",
@ -282,7 +283,7 @@ func GetClusterFromChan(c chan runtime.Object) *federationapi.Cluster {
func NewConfigMap(uid string) *apiv1.ConfigMap { func NewConfigMap(uid string) *apiv1.ConfigMap {
return &apiv1.ConfigMap{ return &apiv1.ConfigMap{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: uidConfigMapName, Name: uidConfigMapName,
Namespace: uidConfigMapNamespace, Namespace: uidConfigMapNamespace,
SelfLink: "/api/v1/namespaces/" + uidConfigMapNamespace + "/configmap/" + uidConfigMapName, SelfLink: "/api/v1/namespaces/" + uidConfigMapNamespace + "/configmap/" + uidConfigMapName,

View File

@ -42,7 +42,7 @@ func TestNamespaceController(t *testing.T) {
cluster1 := NewCluster("cluster1", apiv1.ConditionTrue) cluster1 := NewCluster("cluster1", apiv1.ConditionTrue)
cluster2 := NewCluster("cluster2", apiv1.ConditionTrue) cluster2 := NewCluster("cluster2", apiv1.ConditionTrue)
ns1 := apiv1.Namespace{ ns1 := apiv1.Namespace{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-namespace", Name: "test-namespace",
SelfLink: "/api/v1/namespaces/test-namespace", SelfLink: "/api/v1/namespaces/test-namespace",
}, },
@ -71,19 +71,19 @@ func TestNamespaceController(t *testing.T) {
RegisterFakeList("replicasets", &fakeClient.Fake, &extensionsv1.ReplicaSetList{Items: []extensionsv1.ReplicaSet{ RegisterFakeList("replicasets", &fakeClient.Fake, &extensionsv1.ReplicaSetList{Items: []extensionsv1.ReplicaSet{
{ {
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-rs", Name: "test-rs",
Namespace: ns1.Namespace, Namespace: ns1.Namespace,
}}}}) }}}})
RegisterFakeList("secrets", &fakeClient.Fake, &apiv1.SecretList{Items: []apiv1.Secret{ RegisterFakeList("secrets", &fakeClient.Fake, &apiv1.SecretList{Items: []apiv1.Secret{
{ {
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-secret", Name: "test-secret",
Namespace: ns1.Namespace, Namespace: ns1.Namespace,
}}}}) }}}})
RegisterFakeList("services", &fakeClient.Fake, &apiv1.ServiceList{Items: []apiv1.Service{ RegisterFakeList("services", &fakeClient.Fake, &apiv1.ServiceList{Items: []apiv1.Service{
{ {
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-service", Name: "test-service",
Namespace: ns1.Namespace, Namespace: ns1.Namespace,
}}}}) }}}})

View File

@ -182,7 +182,7 @@ func TestReplicaSetController(t *testing.T) {
func newReplicaSetWithReplicas(name string, replicas int32) *extensionsv1.ReplicaSet { func newReplicaSetWithReplicas(name string, replicas int32) *extensionsv1.ReplicaSet {
return &extensionsv1.ReplicaSet{ return &extensionsv1.ReplicaSet{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: apiv1.NamespaceDefault, Namespace: apiv1.NamespaceDefault,
SelfLink: "/api/v1/namespaces/default/replicasets/name", SelfLink: "/api/v1/namespaces/default/replicasets/name",

View File

@ -49,6 +49,7 @@ go_test(
"//pkg/client/clientset_generated/clientset/fake:go_default_library", "//pkg/client/clientset_generated/clientset/fake:go_default_library",
"//vendor:github.com/golang/glog", "//vendor:github.com/golang/glog",
"//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/assert",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/types", "//vendor:k8s.io/apimachinery/pkg/types",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",

View File

@ -22,6 +22,7 @@ import (
"testing" "testing"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -82,7 +83,7 @@ func TestSecretController(t *testing.T) {
secretController.Run(stop) secretController.Run(stop)
secret1 := apiv1.Secret{ secret1 := apiv1.Secret{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-secret", Name: "test-secret",
Namespace: "ns", Namespace: "ns",
SelfLink: "/api/v1/namespaces/ns/secrets/test-secret", SelfLink: "/api/v1/namespaces/ns/secrets/test-secret",

View File

@ -61,6 +61,7 @@ go_test(
"//federation/apis/federation/v1beta1:go_default_library", "//federation/apis/federation/v1beta1:go_default_library",
"//federation/pkg/dnsprovider/providers/google/clouddns:go_default_library", "//federation/pkg/dnsprovider/providers/google/clouddns:go_default_library",
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/sets",
], ],
) )

View File

@ -24,6 +24,7 @@ import (
"reflect" "reflect"
"sort" "sort"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/federation/apis/federation/v1beta1" "k8s.io/kubernetes/federation/apis/federation/v1beta1"
"k8s.io/kubernetes/federation/pkg/dnsprovider/providers/google/clouddns" // Only for unit testing purposes. "k8s.io/kubernetes/federation/pkg/dnsprovider/providers/google/clouddns" // Only for unit testing purposes.
@ -40,7 +41,7 @@ func TestServiceController_ensureDnsRecords(t *testing.T) {
{ {
name: "withip", name: "withip",
service: v1.Service{ service: v1.Service{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "servicename", Name: "servicename",
Namespace: "servicenamespace", Namespace: "servicenamespace",
}, },
@ -58,7 +59,7 @@ func TestServiceController_ensureDnsRecords(t *testing.T) {
{ {
name: "withname", name: "withname",
service: v1.Service{ service: v1.Service{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "servicename", Name: "servicename",
Namespace: "servicenamespace", Namespace: "servicenamespace",
}, },
@ -74,7 +75,7 @@ func TestServiceController_ensureDnsRecords(t *testing.T) {
{ {
name: "noendpoints", name: "noendpoints",
service: v1.Service{ service: v1.Service{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "servicename", Name: "servicename",
Namespace: "servicenamespace", Namespace: "servicenamespace",
}, },

View File

@ -20,6 +20,7 @@ import (
"reflect" "reflect"
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/kubernetes/pkg/api/v1" "k8s.io/kubernetes/pkg/api/v1"
) )
@ -74,7 +75,7 @@ func TestProcessServiceUpdate(t *testing.T) {
"diff-cluster", "diff-cluster",
&cachedService{ &cachedService{
lastState: &v1.Service{ lastState: &v1.Service{
ObjectMeta: v1.ObjectMeta{Name: "bar1"}, ObjectMeta: metav1.ObjectMeta{Name: "bar1"},
}, },
serviceStatusMap: map[string]v1.LoadBalancerStatus{ serviceStatusMap: map[string]v1.LoadBalancerStatus{
"foo2": {Ingress: []v1.LoadBalancerIngress{{IP: "ip1", Hostname: ""}}}, "foo2": {Ingress: []v1.LoadBalancerIngress{{IP: "ip1", Hostname: ""}}},

View File

@ -70,6 +70,7 @@ go_test(
"//pkg/client/testing/core:go_default_library", "//pkg/client/testing/core:go_default_library",
"//pkg/controller/deployment/util:go_default_library", "//pkg/controller/deployment/util:go_default_library",
"//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/assert",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/watch", "//vendor:k8s.io/apimachinery/pkg/watch",
], ],

View File

@ -19,7 +19,7 @@ package util
import ( import (
"reflect" "reflect"
api_v1 "k8s.io/kubernetes/pkg/api/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
extensions_v1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" extensions_v1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
deputils "k8s.io/kubernetes/pkg/controller/deployment/util" deputils "k8s.io/kubernetes/pkg/controller/deployment/util"
) )
@ -60,7 +60,7 @@ func DeploymentEquivalent(a, b *extensions_v1.Deployment) bool {
} }
// Copies object meta for Deployment, skipping revision information. // Copies object meta for Deployment, skipping revision information.
func DeepCopyDeploymentObjectMeta(meta api_v1.ObjectMeta) api_v1.ObjectMeta { func DeepCopyDeploymentObjectMeta(meta metav1.ObjectMeta) metav1.ObjectMeta {
meta = DeepCopyRelevantObjectMeta(meta) meta = DeepCopyRelevantObjectMeta(meta)
delete(meta.Annotations, deputils.RevisionAnnotation) delete(meta.Annotations, deputils.RevisionAnnotation)
return meta return meta

View File

@ -19,6 +19,7 @@ package util
import ( import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
apiv1 "k8s.io/kubernetes/pkg/api/v1" apiv1 "k8s.io/kubernetes/pkg/api/v1"
extensionsv1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1" extensionsv1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
deputils "k8s.io/kubernetes/pkg/controller/deployment/util" deputils "k8s.io/kubernetes/pkg/controller/deployment/util"
@ -58,7 +59,7 @@ func TestDeploymentCopy(t *testing.T) {
func newDeployment() *extensionsv1.Deployment { func newDeployment() *extensionsv1.Deployment {
replicas := int32(5) replicas := int32(5)
return &extensionsv1.Deployment{ return &extensionsv1.Deployment{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "wrr", Name: "wrr",
Namespace: apiv1.NamespaceDefault, Namespace: apiv1.NamespaceDefault,
SelfLink: "/api/v1/namespaces/default/deployments/name123", SelfLink: "/api/v1/namespaces/default/deployments/name123",

View File

@ -31,6 +31,7 @@ go_test(
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/client/testing/core:go_default_library", "//pkg/client/testing/core:go_default_library",
"//vendor:github.com/stretchr/testify/assert", "//vendor:github.com/stretchr/testify/assert",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
], ],
) )

View File

@ -19,6 +19,7 @@ package eventsink
import ( import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
fakefedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/fake" fakefedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/fake"
. "k8s.io/kubernetes/federation/pkg/federation-controller/util/test" . "k8s.io/kubernetes/federation/pkg/federation-controller/util/test"
@ -46,7 +47,7 @@ func TestEventSink(t *testing.T) {
}) })
event := apiv1.Event{ event := apiv1.Event{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "bzium", Name: "bzium",
Namespace: "ns", Namespace: "ns",
}, },

View File

@ -20,6 +20,7 @@ import (
"testing" "testing"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1"
@ -40,7 +41,7 @@ func TestFederatedInformer(t *testing.T) {
// Add a single cluster to federation and remove it when needed. // Add a single cluster to federation and remove it when needed.
cluster := federationapi.Cluster{ cluster := federationapi.Cluster{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "mycluster", Name: "mycluster",
}, },
Status: federationapi.ClusterStatus{ Status: federationapi.ClusterStatus{
@ -65,7 +66,7 @@ func TestFederatedInformer(t *testing.T) {
fakeKubeClient := &fakekubeclientset.Clientset{} fakeKubeClient := &fakekubeclientset.Clientset{}
// There is a single service ns1/s1 in cluster mycluster. // There is a single service ns1/s1 in cluster mycluster.
service := apiv1.Service{ service := apiv1.Service{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
}, },

View File

@ -21,6 +21,7 @@ import (
"testing" "testing"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkgruntime "k8s.io/apimachinery/pkg/runtime" pkgruntime "k8s.io/apimachinery/pkg/runtime"
federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1" federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1"
apiv1 "k8s.io/kubernetes/pkg/api/v1" apiv1 "k8s.io/kubernetes/pkg/api/v1"
@ -136,7 +137,7 @@ func TestFederatedUpdaterTimeout(t *testing.T) {
func makeService(cluster, name string) *apiv1.Service { func makeService(cluster, name string) *apiv1.Service {
return &apiv1.Service{ return &apiv1.Service{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: name, Name: name,
}, },

View File

@ -20,8 +20,8 @@ import (
"fmt" "fmt"
"reflect" "reflect"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkgruntime "k8s.io/apimachinery/pkg/runtime" pkgruntime "k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/kubernetes/pkg/api/v1"
"k8s.io/kubernetes/pkg/client/cache" "k8s.io/kubernetes/pkg/client/cache"
) )
@ -68,8 +68,8 @@ func NewTriggerOnMetaAndSpecChanges(triggerFunc func(pkgruntime.Object)) *cache.
}, },
UpdateFunc: func(old, cur interface{}) { UpdateFunc: func(old, cur interface{}) {
curObj := cur.(pkgruntime.Object) curObj := cur.(pkgruntime.Object)
oldMeta := getFieldOrPanic(old, "ObjectMeta").(apiv1.ObjectMeta) oldMeta := getFieldOrPanic(old, "ObjectMeta").(metav1.ObjectMeta)
curMeta := getFieldOrPanic(cur, "ObjectMeta").(apiv1.ObjectMeta) curMeta := getFieldOrPanic(cur, "ObjectMeta").(metav1.ObjectMeta)
if !ObjectMetaEquivalent(oldMeta, curMeta) || if !ObjectMetaEquivalent(oldMeta, curMeta) ||
!reflect.DeepEqual(getFieldOrPanic(old, "Spec"), getFieldOrPanic(cur, "Spec")) { !reflect.DeepEqual(getFieldOrPanic(old, "Spec"), getFieldOrPanic(cur, "Spec")) {
triggerFunc(curObj) triggerFunc(curObj)

View File

@ -19,6 +19,7 @@ package util
import ( import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
pkgruntime "k8s.io/apimachinery/pkg/runtime" pkgruntime "k8s.io/apimachinery/pkg/runtime"
apiv1 "k8s.io/kubernetes/pkg/api/v1" apiv1 "k8s.io/kubernetes/pkg/api/v1"
@ -28,13 +29,13 @@ import (
func TestHandlers(t *testing.T) { func TestHandlers(t *testing.T) {
// There is a single service ns1/s1 in cluster mycluster. // There is a single service ns1/s1 in cluster mycluster.
service := apiv1.Service{ service := apiv1.Service{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
}, },
} }
service2 := apiv1.Service{ service2 := apiv1.Service{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
Annotations: map[string]string{ Annotations: map[string]string{
@ -82,7 +83,7 @@ func TestHandlers(t *testing.T) {
assert.True(t, triggered()) assert.True(t, triggered())
service3 := apiv1.Service{ service3 := apiv1.Service{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
}, },

View File

@ -19,16 +19,16 @@ package util
import ( import (
"reflect" "reflect"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
api_v1 "k8s.io/kubernetes/pkg/api/v1"
) )
// Copies cluster-independent, user provided data from the given ObjectMeta struct. If in // Copies cluster-independent, user provided data from the given ObjectMeta struct. If in
// the future the ObjectMeta structure is expanded then any field that is not populated // the future the ObjectMeta structure is expanded then any field that is not populated
// by the api server should be included here. // by the api server should be included here.
func copyObjectMeta(obj api_v1.ObjectMeta) api_v1.ObjectMeta { func copyObjectMeta(obj metav1.ObjectMeta) metav1.ObjectMeta {
return api_v1.ObjectMeta{ return metav1.ObjectMeta{
Name: obj.Name, Name: obj.Name,
Namespace: obj.Namespace, Namespace: obj.Namespace,
Labels: obj.Labels, Labels: obj.Labels,
@ -39,7 +39,7 @@ func copyObjectMeta(obj api_v1.ObjectMeta) api_v1.ObjectMeta {
// Deep copies cluster-independent, user provided data from the given ObjectMeta struct. If in // Deep copies cluster-independent, user provided data from the given ObjectMeta struct. If in
// the future the ObjectMeta structure is expanded then any field that is not populated // the future the ObjectMeta structure is expanded then any field that is not populated
// by the api server should be included here. // by the api server should be included here.
func DeepCopyRelevantObjectMeta(obj api_v1.ObjectMeta) api_v1.ObjectMeta { func DeepCopyRelevantObjectMeta(obj metav1.ObjectMeta) metav1.ObjectMeta {
copyMeta := copyObjectMeta(obj) copyMeta := copyObjectMeta(obj)
if obj.Labels != nil { if obj.Labels != nil {
copyMeta.Labels = make(map[string]string) copyMeta.Labels = make(map[string]string)
@ -59,7 +59,7 @@ func DeepCopyRelevantObjectMeta(obj api_v1.ObjectMeta) api_v1.ObjectMeta {
// Checks if cluster-independent, user provided data in two given ObjectMeta are equal. If in // Checks if cluster-independent, user provided data in two given ObjectMeta are equal. If in
// the future the ObjectMeta structure is expanded then any field that is not populated // the future the ObjectMeta structure is expanded then any field that is not populated
// by the api server should be included here. // by the api server should be included here.
func ObjectMetaEquivalent(a, b api_v1.ObjectMeta) bool { func ObjectMetaEquivalent(a, b metav1.ObjectMeta) bool {
if a.Name != b.Name { if a.Name != b.Name {
return false return false
} }
@ -78,8 +78,8 @@ func ObjectMetaEquivalent(a, b api_v1.ObjectMeta) bool {
// Checks if cluster-independent, user provided data in ObjectMeta and Spec in two given top // Checks if cluster-independent, user provided data in ObjectMeta and Spec in two given top
// level api objects are equivalent. // level api objects are equivalent.
func ObjectMetaAndSpecEquivalent(a, b runtime.Object) bool { func ObjectMetaAndSpecEquivalent(a, b runtime.Object) bool {
objectMetaA := reflect.ValueOf(a).Elem().FieldByName("ObjectMeta").Interface().(api_v1.ObjectMeta) objectMetaA := reflect.ValueOf(a).Elem().FieldByName("ObjectMeta").Interface().(metav1.ObjectMeta)
objectMetaB := reflect.ValueOf(b).Elem().FieldByName("ObjectMeta").Interface().(api_v1.ObjectMeta) objectMetaB := reflect.ValueOf(b).Elem().FieldByName("ObjectMeta").Interface().(metav1.ObjectMeta)
specA := reflect.ValueOf(a).Elem().FieldByName("Spec").Interface() specA := reflect.ValueOf(a).Elem().FieldByName("Spec").Interface()
specB := reflect.ValueOf(b).Elem().FieldByName("Spec").Interface() specB := reflect.ValueOf(b).Elem().FieldByName("Spec").Interface()
return ObjectMetaEquivalent(objectMetaA, objectMetaB) && reflect.DeepEqual(specA, specB) return ObjectMetaEquivalent(objectMetaA, objectMetaB) && reflect.DeepEqual(specA, specB)

View File

@ -19,51 +19,52 @@ package util
import ( import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
api_v1 "k8s.io/kubernetes/pkg/api/v1" api_v1 "k8s.io/kubernetes/pkg/api/v1"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
func TestObjectMeta(t *testing.T) { func TestObjectMeta(t *testing.T) {
o1 := api_v1.ObjectMeta{ o1 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
UID: "1231231412", UID: "1231231412",
ResourceVersion: "999", ResourceVersion: "999",
} }
o2 := copyObjectMeta(o1) o2 := copyObjectMeta(o1)
o3 := api_v1.ObjectMeta{ o3 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
UID: "1231231412", UID: "1231231412",
Annotations: map[string]string{"A": "B"}, Annotations: map[string]string{"A": "B"},
} }
o4 := api_v1.ObjectMeta{ o4 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
UID: "1231255531412", UID: "1231255531412",
Annotations: map[string]string{"A": "B"}, Annotations: map[string]string{"A": "B"},
} }
o5 := api_v1.ObjectMeta{ o5 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
ResourceVersion: "1231231412", ResourceVersion: "1231231412",
Annotations: map[string]string{"A": "B"}, Annotations: map[string]string{"A": "B"},
} }
o6 := api_v1.ObjectMeta{ o6 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
ResourceVersion: "1231255531412", ResourceVersion: "1231255531412",
Annotations: map[string]string{"A": "B"}, Annotations: map[string]string{"A": "B"},
} }
o7 := api_v1.ObjectMeta{ o7 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
ResourceVersion: "1231255531412", ResourceVersion: "1231255531412",
Annotations: map[string]string{}, Annotations: map[string]string{},
Labels: map[string]string{}, Labels: map[string]string{},
} }
o8 := api_v1.ObjectMeta{ o8 := metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
ResourceVersion: "1231255531412", ResourceVersion: "1231255531412",
@ -82,7 +83,7 @@ func TestObjectMeta(t *testing.T) {
func TestObjectMetaAndSpec(t *testing.T) { func TestObjectMetaAndSpec(t *testing.T) {
s1 := api_v1.Service{ s1 := api_v1.Service{
ObjectMeta: api_v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
}, },
@ -92,7 +93,7 @@ func TestObjectMetaAndSpec(t *testing.T) {
} }
s1b := s1 s1b := s1
s2 := api_v1.Service{ s2 := api_v1.Service{
ObjectMeta: api_v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s2", Name: "s2",
}, },
@ -101,7 +102,7 @@ func TestObjectMetaAndSpec(t *testing.T) {
}, },
} }
s3 := api_v1.Service{ s3 := api_v1.Service{
ObjectMeta: api_v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: "ns1", Namespace: "ns1",
Name: "s1", Name: "s1",
}, },

View File

@ -95,7 +95,7 @@ func TestAnalyze(t *testing.T) {
func newReplicaSet(selectorMap map[string]string) *v1beta1.ReplicaSet { func newReplicaSet(selectorMap map[string]string) *v1beta1.ReplicaSet {
replicas := int32(3) replicas := int32(3)
rs := &v1beta1.ReplicaSet{ rs := &v1beta1.ReplicaSet{
ObjectMeta: api_v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foobar", Name: "foobar",
Namespace: "default", Namespace: "default",
}, },
@ -109,7 +109,7 @@ func newReplicaSet(selectorMap map[string]string) *v1beta1.ReplicaSet {
func newPod(name string, rs *v1beta1.ReplicaSet, status api_v1.PodStatus) *api_v1.Pod { func newPod(name string, rs *v1beta1.ReplicaSet, status api_v1.PodStatus) *api_v1.Pod {
return &api_v1.Pod{ return &api_v1.Pod{
ObjectMeta: api_v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: rs.Namespace, Namespace: rs.Namespace,
Labels: rs.Spec.Selector.MatchLabels, Labels: rs.Spec.Selector.MatchLabels,

View File

@ -18,6 +18,7 @@ go_library(
"//pkg/api/v1:go_default_library", "//pkg/api/v1:go_default_library",
"//pkg/client/testing/core:go_default_library", "//pkg/client/testing/core:go_default_library",
"//vendor:github.com/golang/glog", "//vendor:github.com/golang/glog",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/apimachinery/pkg/watch", "//vendor:k8s.io/apimachinery/pkg/watch",

View File

@ -24,6 +24,7 @@ import (
"sync" "sync"
"time" "time"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/apimachinery/pkg/watch" "k8s.io/apimachinery/pkg/watch"
@ -264,7 +265,7 @@ func CheckObjectFromChan(c chan runtime.Object, checkFunction CheckingFunction)
} }
// CompareObjectMeta returns an error when the given objects are not equivalent. // CompareObjectMeta returns an error when the given objects are not equivalent.
func CompareObjectMeta(a, b apiv1.ObjectMeta) error { func CompareObjectMeta(a, b metav1.ObjectMeta) error {
if a.Namespace != b.Namespace { if a.Namespace != b.Namespace {
return fmt.Errorf("Different namespace expected:%s observed:%s", a.Namespace, b.Namespace) return fmt.Errorf("Different namespace expected:%s observed:%s", a.Namespace, b.Namespace)
} }
@ -288,7 +289,7 @@ func ToFederatedInformerForTestOnly(informer util.FederatedInformer) util.Federa
// NewCluster builds a new cluster object. // NewCluster builds a new cluster object.
func NewCluster(name string, readyStatus apiv1.ConditionStatus) *federationapi.Cluster { func NewCluster(name string, readyStatus apiv1.ConditionStatus) *federationapi.Cluster {
return &federationapi.Cluster{ return &federationapi.Cluster{
ObjectMeta: apiv1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Annotations: map[string]string{}, Annotations: map[string]string{},
}, },

View File

@ -250,7 +250,7 @@ func initFederation(cmdOut io.Writer, config util.AdminConfig, cmd *cobra.Comman
func createNamespace(clientset *client.Clientset, namespace string, dryRun bool) (*api.Namespace, error) { func createNamespace(clientset *client.Clientset, namespace string, dryRun bool) (*api.Namespace, error) {
ns := &api.Namespace{ ns := &api.Namespace{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: namespace, Name: namespace,
}, },
} }
@ -264,7 +264,7 @@ func createNamespace(clientset *client.Clientset, namespace string, dryRun bool)
func createService(clientset *client.Clientset, namespace, svcName string, dryRun bool) (*api.Service, error) { func createService(clientset *client.Clientset, namespace, svcName string, dryRun bool) (*api.Service, error) {
svc := &api.Service{ svc := &api.Service{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: svcName, Name: svcName,
Namespace: namespace, Namespace: namespace,
Labels: componentLabel, Labels: componentLabel,
@ -353,7 +353,7 @@ func genCerts(svcNamespace, name, svcName, localDNSZoneName string, ips, hostnam
func createAPIServerCredentialsSecret(clientset *client.Clientset, namespace, credentialsName string, entKeyPairs *entityKeyPairs, dryRun bool) (*api.Secret, error) { func createAPIServerCredentialsSecret(clientset *client.Clientset, namespace, credentialsName string, entKeyPairs *entityKeyPairs, dryRun bool) (*api.Secret, error) {
// Build the secret object with API server credentials. // Build the secret object with API server credentials.
secret := &api.Secret{ secret := &api.Secret{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: credentialsName, Name: credentialsName,
Namespace: namespace, Namespace: namespace,
}, },
@ -391,7 +391,7 @@ func createPVC(clientset *client.Clientset, namespace, svcName, etcdPVCapacity s
} }
pvc := &api.PersistentVolumeClaim{ pvc := &api.PersistentVolumeClaim{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-etcd-claim", svcName), Name: fmt.Sprintf("%s-etcd-claim", svcName),
Namespace: namespace, Namespace: namespace,
Labels: componentLabel, Labels: componentLabel,
@ -438,7 +438,7 @@ func createAPIServer(clientset *client.Clientset, namespace, name, image, creden
dataVolumeName := "etcddata" dataVolumeName := "etcddata"
dep := &extensions.Deployment{ dep := &extensions.Deployment{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: namespace, Namespace: namespace,
Labels: componentLabel, Labels: componentLabel,
@ -446,7 +446,7 @@ func createAPIServer(clientset *client.Clientset, namespace, name, image, creden
Spec: extensions.DeploymentSpec{ Spec: extensions.DeploymentSpec{
Replicas: 1, Replicas: 1,
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Labels: apiserverPodLabels, Labels: apiserverPodLabels,
}, },
@ -522,7 +522,7 @@ func createAPIServer(clientset *client.Clientset, namespace, name, image, creden
func createControllerManager(clientset *client.Clientset, namespace, name, svcName, cmName, image, kubeconfigName, dnsZoneName, dnsProvider string, dryRun bool) (*extensions.Deployment, error) { func createControllerManager(clientset *client.Clientset, namespace, name, svcName, cmName, image, kubeconfigName, dnsZoneName, dnsProvider string, dryRun bool) (*extensions.Deployment, error) {
dep := &extensions.Deployment{ dep := &extensions.Deployment{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cmName, Name: cmName,
Namespace: namespace, Namespace: namespace,
Labels: componentLabel, Labels: componentLabel,
@ -530,7 +530,7 @@ func createControllerManager(clientset *client.Clientset, namespace, name, svcNa
Spec: extensions.DeploymentSpec{ Spec: extensions.DeploymentSpec{
Replicas: 1, Replicas: 1,
Template: api.PodTemplateSpec{ Template: api.PodTemplateSpec{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cmName, Name: cmName,
Labels: controllerManagerPodLabels, Labels: controllerManagerPodLabels,
}, },

View File

@ -465,7 +465,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Namespace", Kind: "Namespace",
APIVersion: testapi.Default.GroupVersion().String(), APIVersion: testapi.Default.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: namespaceName, Name: namespaceName,
}, },
} }
@ -475,7 +475,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Service", Kind: "Service",
APIVersion: testapi.Default.GroupVersion().String(), APIVersion: testapi.Default.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Namespace: namespaceName, Namespace: namespaceName,
Name: svcName, Name: svcName,
Labels: componentLabel, Labels: componentLabel,
@ -510,7 +510,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Secret", Kind: "Secret",
APIVersion: testapi.Default.GroupVersion().String(), APIVersion: testapi.Default.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: credSecretName, Name: credSecretName,
Namespace: namespaceName, Namespace: namespaceName,
}, },
@ -522,7 +522,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Secret", Kind: "Secret",
APIVersion: testapi.Default.GroupVersion().String(), APIVersion: testapi.Default.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cmKubeconfigSecretName, Name: cmKubeconfigSecretName,
Namespace: namespaceName, Namespace: namespaceName,
}, },
@ -534,7 +534,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "PersistentVolumeClaim", Kind: "PersistentVolumeClaim",
APIVersion: testapi.Default.GroupVersion().String(), APIVersion: testapi.Default.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: pvcName, Name: pvcName,
Namespace: namespaceName, Namespace: namespaceName,
Labels: componentLabel, Labels: componentLabel,
@ -559,7 +559,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Deployment", Kind: "Deployment",
APIVersion: testapi.Extensions.GroupVersion().String(), APIVersion: testapi.Extensions.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: svcName, Name: svcName,
Namespace: namespaceName, Namespace: namespaceName,
Labels: componentLabel, Labels: componentLabel,
@ -568,7 +568,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Replicas: &replicas, Replicas: &replicas,
Selector: nil, Selector: nil,
Template: v1.PodTemplateSpec{ Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: svcName, Name: svcName,
Labels: apiserverPodLabels, Labels: apiserverPodLabels,
}, },
@ -652,7 +652,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Deployment", Kind: "Deployment",
APIVersion: testapi.Extensions.GroupVersion().String(), APIVersion: testapi.Extensions.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cmName, Name: cmName,
Namespace: namespaceName, Namespace: namespaceName,
Labels: componentLabel, Labels: componentLabel,
@ -661,7 +661,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Replicas: &replicas, Replicas: &replicas,
Selector: nil, Selector: nil,
Template: v1.PodTemplateSpec{ Template: v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cmName, Name: cmName,
Labels: controllerManagerPodLabels, Labels: controllerManagerPodLabels,
}, },
@ -720,7 +720,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Pod", Kind: "Pod",
APIVersion: testapi.Extensions.GroupVersion().String(), APIVersion: testapi.Extensions.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: svcName, Name: svcName,
Namespace: namespaceName, Namespace: namespaceName,
}, },
@ -734,7 +734,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
Kind: "Pod", Kind: "Pod",
APIVersion: testapi.Extensions.GroupVersion().String(), APIVersion: testapi.Extensions.GroupVersion().String(),
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: cmName, Name: cmName,
Namespace: namespaceName, Namespace: namespaceName,
}, },

View File

@ -237,7 +237,7 @@ func fakeJoinHostFactory(clusterName, clusterCtx, secretName, server, token stri
Kind: "Secret", Kind: "Secret",
APIVersion: "v1", APIVersion: "v1",
}, },
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: secretName, Name: secretName,
Namespace: util.DefaultFederationSystemNamespace, Namespace: util.DefaultFederationSystemNamespace,
}, },
@ -277,7 +277,7 @@ func fakeJoinHostFactory(clusterName, clusterCtx, secretName, server, token stri
func fakeCluster(clusterName, secretName, server string) federationapi.Cluster { func fakeCluster(clusterName, secretName, server string) federationapi.Cluster {
return federationapi.Cluster{ return federationapi.Cluster{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: clusterName, Name: clusterName,
}, },
Spec: federationapi.ClusterSpec{ Spec: federationapi.ClusterSpec{

View File

@ -20,6 +20,7 @@ go_library(
"//pkg/kubectl/cmd:go_default_library", "//pkg/kubectl/cmd:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library", "//pkg/kubectl/cmd/util:go_default_library",
"//vendor:github.com/spf13/cobra", "//vendor:github.com/spf13/cobra",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
], ],
) )

View File

@ -17,6 +17,7 @@ limitations under the License.
package util package util
import ( import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
fedclient "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset" fedclient "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
client "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset" client "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
@ -135,7 +136,7 @@ func CreateKubeconfigSecret(clientset *client.Clientset, kubeconfig *clientcmdap
// Build the secret object with the minified and flattened // Build the secret object with the minified and flattened
// kubeconfig content. // kubeconfig content.
secret := &api.Secret{ secret := &api.Secret{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: name, Name: name,
Namespace: namespace, Namespace: namespace,
}, },

View File

@ -43,6 +43,7 @@ go_test(
"//pkg/api:go_default_library", "//pkg/api:go_default_library",
"//pkg/api/testing:go_default_library", "//pkg/api/testing:go_default_library",
"//pkg/fields:go_default_library", "//pkg/fields:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/labels", "//vendor:k8s.io/apimachinery/pkg/labels",
"//vendor:k8s.io/apiserver/pkg/request", "//vendor:k8s.io/apiserver/pkg/request",
], ],

View File

@ -35,6 +35,7 @@ go_test(
"//pkg/registry/generic:go_default_library", "//pkg/registry/generic:go_default_library",
"//pkg/registry/registrytest:go_default_library", "//pkg/registry/registrytest:go_default_library",
"//pkg/storage/etcd/testing:go_default_library", "//pkg/storage/etcd/testing:go_default_library",
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
"//vendor:k8s.io/apimachinery/pkg/labels", "//vendor:k8s.io/apimachinery/pkg/labels",
"//vendor:k8s.io/apimachinery/pkg/runtime", "//vendor:k8s.io/apimachinery/pkg/runtime",
], ],

View File

@ -19,6 +19,7 @@ package etcd
import ( import (
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/federation/apis/federation" "k8s.io/kubernetes/federation/apis/federation"
@ -43,7 +44,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
func validNewCluster() *federation.Cluster { func validNewCluster() *federation.Cluster {
return &federation.Cluster{ return &federation.Cluster{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
Labels: map[string]string{ Labels: map[string]string{
"name": "foo", "name": "foo",
@ -70,11 +71,11 @@ func TestCreate(t *testing.T) {
defer server.Terminate(t) defer server.Terminate(t)
test := registrytest.New(t, storage.Store).ClusterScope() test := registrytest.New(t, storage.Store).ClusterScope()
cluster := validNewCluster() cluster := validNewCluster()
cluster.ObjectMeta = api.ObjectMeta{GenerateName: "foo"} cluster.ObjectMeta = metav1.ObjectMeta{GenerateName: "foo"}
test.TestCreate( test.TestCreate(
cluster, cluster,
&federation.Cluster{ &federation.Cluster{
ObjectMeta: api.ObjectMeta{Name: "-a123-a_"}, ObjectMeta: metav1.ObjectMeta{Name: "-a123-a_"},
}, },
) )
} }

View File

@ -21,6 +21,7 @@ import (
"reflect" "reflect"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
genericapirequest "k8s.io/apiserver/pkg/request" genericapirequest "k8s.io/apiserver/pkg/request"
"k8s.io/kubernetes/federation/apis/federation" "k8s.io/kubernetes/federation/apis/federation"
@ -31,7 +32,7 @@ import (
func validNewCluster() *federation.Cluster { func validNewCluster() *federation.Cluster {
return &federation.Cluster{ return &federation.Cluster{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
ResourceVersion: "4", ResourceVersion: "4",
Labels: map[string]string{ Labels: map[string]string{
@ -57,7 +58,7 @@ func validNewCluster() *federation.Cluster {
func invalidNewCluster() *federation.Cluster { func invalidNewCluster() *federation.Cluster {
// Create a cluster with empty ServerAddressByClientCIDRs (which is a required field). // Create a cluster with empty ServerAddressByClientCIDRs (which is a required field).
return &federation.Cluster{ return &federation.Cluster{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo2", Name: "foo2",
ResourceVersion: "5", ResourceVersion: "5",
}, },

View File

@ -324,6 +324,9 @@ kube::util::group-version-to-pkg-path() {
meta/v1) meta/v1)
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1" echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
;; ;;
meta/v1)
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
;;
unversioned) unversioned)
echo "pkg/api/unversioned" echo "pkg/api/unversioned"
;; ;;

View File

@ -41,7 +41,7 @@ var benchmarkPod api.Pod = api.Pod{
Kind: "Pod", Kind: "Pod",
APIVersion: "v1", APIVersion: "v1",
}, },
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "etcd-server-e2e-test-wojtekt-master", Name: "etcd-server-e2e-test-wojtekt-master",
Namespace: "default", Namespace: "default",
SelfLink: "/api/v1/namespaces/default/pods/etcd-server-e2e-test-wojtekt-master", SelfLink: "/api/v1/namespaces/default/pods/etcd-server-e2e-test-wojtekt-master",

View File

@ -24,6 +24,8 @@ import (
"strings" "strings"
"time" "time"
"github.com/davecgh/go-spew/spew"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion" "k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
@ -33,8 +35,6 @@ import (
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/fields"
"github.com/davecgh/go-spew/spew"
) )
// Conversion error conveniently packages up errors in conversions. // Conversion error conveniently packages up errors in conversions.
@ -272,7 +272,7 @@ func IsStandardFinalizerName(str string) bool {
} }
// SingleObject returns a ListOptions for watching a single object. // SingleObject returns a ListOptions for watching a single object.
func SingleObject(meta ObjectMeta) ListOptions { func SingleObject(meta metav1.ObjectMeta) ListOptions {
return ListOptions{ return ListOptions{
FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name), FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name),
ResourceVersion: meta.ResourceVersion, ResourceVersion: meta.ResourceVersion,

View File

@ -356,7 +356,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
}, },
{ {
node: &Node{ node: &Node{
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
PreferAvoidPodsAnnotationKey: ` PreferAvoidPodsAnnotationKey: `
{ {
@ -401,7 +401,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
{ {
node: &Node{ node: &Node{
// Missing end symbol of "podController" and "podSignature" // Missing end symbol of "podController" and "podSignature"
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
PreferAvoidPodsAnnotationKey: ` PreferAvoidPodsAnnotationKey: `
{ {

View File

@ -28,7 +28,7 @@ import (
) )
func TestResourceVersioner(t *testing.T) { func TestResourceVersioner(t *testing.T) {
pod := internal.Pod{ObjectMeta: internal.ObjectMeta{ResourceVersion: "10"}} pod := internal.Pod{ObjectMeta: metav1.ObjectMeta{ResourceVersion: "10"}}
version, err := accessor.ResourceVersion(&pod) version, err := accessor.ResourceVersion(&pod)
if err != nil { if err != nil {
t.Fatalf("unexpected error: %v", err) t.Fatalf("unexpected error: %v", err)
@ -106,7 +106,7 @@ func TestRESTMapper(t *testing.T) {
t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces) t.Errorf("unexpected: %#v, expected: %#v", mapping, interfaces)
} }
rc := &internal.ReplicationController{ObjectMeta: internal.ObjectMeta{Name: "foo"}} rc := &internal.ReplicationController{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
name, err := mapping.MetadataAccessor.Name(rc) name, err := mapping.MetadataAccessor.Name(rc)
if err != nil { if err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)

View File

@ -17,109 +17,11 @@ limitations under the License.
package api package api
import ( import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/conversion"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
) )
// HasObjectMetaSystemFieldValues returns true if fields that are managed by the system on ObjectMeta have values. // HasObjectMetaSystemFieldValues returns true if fields that are managed by the system on ObjectMeta have values.
func HasObjectMetaSystemFieldValues(meta *ObjectMeta) bool { func HasObjectMetaSystemFieldValues(meta *metav1.ObjectMeta) bool {
return !meta.CreationTimestamp.Time.IsZero() || return !meta.CreationTimestamp.Time.IsZero() ||
len(meta.UID) != 0 len(meta.UID) != 0
} }
// ObjectMetaFor returns a pointer to a provided object's ObjectMeta.
// TODO: allow runtime.Unknown to extract this object
// TODO: Remove this function and use meta.Accessor() instead.
func ObjectMetaFor(obj runtime.Object) (*ObjectMeta, error) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return nil, err
}
var meta *ObjectMeta
err = runtime.FieldPtr(v, "ObjectMeta", &meta)
return meta, err
}
// ListMetaFor returns a pointer to a provided object's ListMeta,
// or an error if the object does not have that pointer.
// TODO: allow runtime.Unknown to extract this object
func ListMetaFor(obj runtime.Object) (*metav1.ListMeta, error) {
v, err := conversion.EnforcePtr(obj)
if err != nil {
return nil, err
}
var meta *metav1.ListMeta
err = runtime.FieldPtr(v, "ListMeta", &meta)
return meta, err
}
func (obj *ObjectMeta) GetObjectMeta() meta.Object { return obj }
// Namespace implements meta.Object for any object with an ObjectMeta typed field. Allows
// fast, direct access to metadata fields for API objects.
func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace }
func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace }
func (meta *ObjectMeta) GetName() string { return meta.Name }
func (meta *ObjectMeta) SetName(name string) { meta.Name = name }
func (meta *ObjectMeta) GetGenerateName() string { return meta.GenerateName }
func (meta *ObjectMeta) SetGenerateName(generateName string) { meta.GenerateName = generateName }
func (meta *ObjectMeta) GetUID() types.UID { return meta.UID }
func (meta *ObjectMeta) SetUID(uid types.UID) { meta.UID = uid }
func (meta *ObjectMeta) GetResourceVersion() string { return meta.ResourceVersion }
func (meta *ObjectMeta) SetResourceVersion(version string) { meta.ResourceVersion = version }
func (meta *ObjectMeta) GetSelfLink() string { return meta.SelfLink }
func (meta *ObjectMeta) SetSelfLink(selfLink string) { meta.SelfLink = selfLink }
func (meta *ObjectMeta) GetCreationTimestamp() metav1.Time { return meta.CreationTimestamp }
func (meta *ObjectMeta) SetCreationTimestamp(creationTimestamp metav1.Time) {
meta.CreationTimestamp = creationTimestamp
}
func (meta *ObjectMeta) GetDeletionTimestamp() *metav1.Time { return meta.DeletionTimestamp }
func (meta *ObjectMeta) SetDeletionTimestamp(deletionTimestamp *metav1.Time) {
meta.DeletionTimestamp = deletionTimestamp
}
func (meta *ObjectMeta) GetLabels() map[string]string { return meta.Labels }
func (meta *ObjectMeta) SetLabels(labels map[string]string) { meta.Labels = labels }
func (meta *ObjectMeta) GetAnnotations() map[string]string { return meta.Annotations }
func (meta *ObjectMeta) SetAnnotations(annotations map[string]string) { meta.Annotations = annotations }
func (meta *ObjectMeta) GetFinalizers() []string { return meta.Finalizers }
func (meta *ObjectMeta) SetFinalizers(finalizers []string) { meta.Finalizers = finalizers }
func (meta *ObjectMeta) GetOwnerReferences() []metav1.OwnerReference {
ret := make([]metav1.OwnerReference, len(meta.OwnerReferences))
for i := 0; i < len(meta.OwnerReferences); i++ {
ret[i].Kind = meta.OwnerReferences[i].Kind
ret[i].Name = meta.OwnerReferences[i].Name
ret[i].UID = meta.OwnerReferences[i].UID
ret[i].APIVersion = meta.OwnerReferences[i].APIVersion
if meta.OwnerReferences[i].Controller != nil {
value := *meta.OwnerReferences[i].Controller
ret[i].Controller = &value
}
}
return ret
}
func (meta *ObjectMeta) SetOwnerReferences(references []metav1.OwnerReference) {
newReferences := make([]metav1.OwnerReference, len(references))
for i := 0; i < len(references); i++ {
newReferences[i].Kind = references[i].Kind
newReferences[i].Name = references[i].Name
newReferences[i].UID = references[i].UID
newReferences[i].APIVersion = references[i].APIVersion
if references[i].Controller != nil {
value := *references[i].Controller
newReferences[i].Controller = &value
}
}
meta.OwnerReferences = newReferences
}
func (meta *ObjectMeta) GetClusterName() string {
return meta.ClusterName
}
func (meta *ObjectMeta) SetClusterName(clusterName string) {
meta.ClusterName = clusterName
}

View File

@ -29,9 +29,9 @@ import (
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
) )
var _ meta.Object = &api.ObjectMeta{} var _ metav1.Object = &metav1.ObjectMeta{}
func getObjectMetaAndOwnerReferences() (objectMeta api.ObjectMeta, metaOwnerReferences []metav1.OwnerReference) { func getObjectMetaAndOwnerReferences() (objectMeta metav1.ObjectMeta, metaOwnerReferences []metav1.OwnerReference) {
fuzz.New().NilChance(.5).NumElements(1, 5).Fuzz(&objectMeta) fuzz.New().NilChance(.5).NumElements(1, 5).Fuzz(&objectMeta)
references := objectMeta.OwnerReferences references := objectMeta.OwnerReferences
metaOwnerReferences = make([]metav1.OwnerReference, 0) metaOwnerReferences = make([]metav1.OwnerReference, 0)
@ -60,7 +60,7 @@ func testGetOwnerReferences(t *testing.T) {
func testSetOwnerReferences(t *testing.T) { func testSetOwnerReferences(t *testing.T) {
expected, newRefs := getObjectMetaAndOwnerReferences() expected, newRefs := getObjectMetaAndOwnerReferences()
objectMeta := &api.ObjectMeta{} objectMeta := &metav1.ObjectMeta{}
objectMeta.SetOwnerReferences(newRefs) objectMeta.SetOwnerReferences(newRefs)
if !reflect.DeepEqual(expected.OwnerReferences, objectMeta.OwnerReferences) { if !reflect.DeepEqual(expected.OwnerReferences, objectMeta.OwnerReferences) {
t.Errorf("expect: %#v\n got: %#v", expected.OwnerReferences, objectMeta.OwnerReferences) t.Errorf("expect: %#v\n got: %#v", expected.OwnerReferences, objectMeta.OwnerReferences)
@ -86,7 +86,7 @@ func TestAccessorImplementations(t *testing.T) {
t.Errorf("%v (%v) does not implement runtime.Object", gv.WithKind(kind), knownType) t.Errorf("%v (%v) does not implement runtime.Object", gv.WithKind(kind), knownType)
} }
lm, isLM := obj.(meta.ListMetaAccessor) lm, isLM := obj.(meta.ListMetaAccessor)
om, isOM := obj.(meta.ObjectMetaAccessor) om, isOM := obj.(metav1.ObjectMetaAccessor)
switch { switch {
case isLM && isOM: case isLM && isOM:
t.Errorf("%v (%v) implements ListMetaAccessor and ObjectMetaAccessor", gv.WithKind(kind), knownType) t.Errorf("%v (%v) implements ListMetaAccessor and ObjectMetaAccessor", gv.WithKind(kind), knownType)

View File

@ -31,7 +31,7 @@ func (obj *FakeAPIObject) GetObjectKind() schema.ObjectKind { return schema.Empt
type ExtensionAPIObject struct { type ExtensionAPIObject struct {
metav1.TypeMeta metav1.TypeMeta
ObjectMeta metav1.ObjectMeta
} }
func (obj *ExtensionAPIObject) GetObjectKind() schema.ObjectKind { return &obj.TypeMeta } func (obj *ExtensionAPIObject) GetObjectKind() schema.ObjectKind { return &obj.TypeMeta }
@ -53,7 +53,7 @@ func TestGetReference(t *testing.T) {
}{ }{
"pod": { "pod": {
obj: &Pod{ obj: &Pod{
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
UID: "bar", UID: "bar",
ResourceVersion: "42", ResourceVersion: "42",
@ -88,7 +88,7 @@ func TestGetReference(t *testing.T) {
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
Kind: "ExtensionAPIObject", Kind: "ExtensionAPIObject",
}, },
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "foo", Name: "foo",
UID: "bar", UID: "bar",
ResourceVersion: "42", ResourceVersion: "42",

View File

@ -23,6 +23,7 @@ import (
"testing" "testing"
"github.com/gogo/protobuf/proto" "github.com/gogo/protobuf/proto"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf" "k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
@ -51,7 +52,7 @@ func init() {
} }
func TestUniversalDeserializer(t *testing.T) { func TestUniversalDeserializer(t *testing.T) {
expected := &v1.Pod{ObjectMeta: v1.ObjectMeta{Name: "test"}} expected := &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "test"}}
d := api.Codecs.UniversalDeserializer() d := api.Codecs.UniversalDeserializer()
for _, mediaType := range []string{"application/json", "application/yaml", "application/vnd.kubernetes.protobuf"} { for _, mediaType := range []string{"application/json", "application/yaml", "application/vnd.kubernetes.protobuf"} {
info, ok := runtime.SerializerInfoForMediaType(api.Codecs.SupportedMediaTypes(), mediaType) info, ok := runtime.SerializerInfoForMediaType(api.Codecs.SupportedMediaTypes(), mediaType)

View File

@ -356,7 +356,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
func TestEncodePtr(t *testing.T) { func TestEncodePtr(t *testing.T) {
grace := int64(30) grace := int64(30)
pod := &api.Pod{ pod := &api.Pod{
ObjectMeta: api.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{"name": "foo"}, Labels: map[string]string{"name": "foo"},
}, },
Spec: api.PodSpec{ Spec: api.PodSpec{

View File

@ -23,6 +23,8 @@ import (
"strconv" "strconv"
"testing" "testing"
"github.com/google/gofuzz"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
@ -40,8 +42,6 @@ import (
"k8s.io/kubernetes/pkg/apis/rbac" "k8s.io/kubernetes/pkg/apis/rbac"
"k8s.io/kubernetes/pkg/fields" "k8s.io/kubernetes/pkg/fields"
"k8s.io/kubernetes/pkg/util/intstr" "k8s.io/kubernetes/pkg/util/intstr"
"github.com/google/gofuzz"
) )
// FuzzerFor can randomly populate api objects that are destined for version. // FuzzerFor can randomly populate api objects that are destined for version.
@ -77,7 +77,7 @@ func FuzzerFor(t *testing.T, version schema.GroupVersion, src rand.Source) *fuzz
j.APIVersion = "" j.APIVersion = ""
j.Kind = "" j.Kind = ""
}, },
func(j *api.ObjectMeta, c fuzz.Continue) { func(j *metav1.ObjectMeta, c fuzz.Continue) {
j.Name = c.RandString() j.Name = c.RandString()
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10) j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
j.SelfLink = c.RandString() j.SelfLink = c.RandString()

View File

@ -57,6 +57,7 @@ import (
// 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.
// DEPRECATED: Use k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta instead - this type will be removed soon.
type ObjectMeta struct { type ObjectMeta struct {
// Name is unique within a namespace. Name is required when creating resources, although // Name is unique within a namespace. Name is required when creating resources, although
// some resources may allow a client to request the generation of an appropriate name // some resources may allow a client to request the generation of an appropriate name
@ -370,7 +371,7 @@ type PersistentVolumeClaimVolumeSource struct {
type PersistentVolume struct { type PersistentVolume struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
//Spec defines a persistent volume owned by the cluster //Spec defines a persistent volume owned by the cluster
// +optional // +optional
@ -441,7 +442,7 @@ type PersistentVolumeList struct {
type PersistentVolumeClaim struct { type PersistentVolumeClaim struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the volume requested by a pod author // Spec defines the volume requested by a pod author
// +optional // +optional
@ -1981,7 +1982,7 @@ type PodStatus struct {
type PodStatusResult struct { type PodStatusResult struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// 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.
// +optional // +optional
@ -1994,7 +1995,7 @@ type PodStatusResult struct {
type Pod struct { type Pod struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the behavior of a pod. // Spec defines the behavior of a pod.
// +optional // +optional
@ -2010,7 +2011,7 @@ type Pod struct {
type PodTemplateSpec struct { type PodTemplateSpec struct {
// Metadata of the pods created from this template. // Metadata of the pods created from this template.
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the behavior of a pod. // Spec defines the behavior of a pod.
// +optional // +optional
@ -2023,7 +2024,7 @@ type PodTemplateSpec struct {
type PodTemplate struct { type PodTemplate struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Template defines the pods that will be created from this pod template // Template defines the pods that will be created from this pod template
// +optional // +optional
@ -2128,7 +2129,7 @@ type ReplicationControllerCondition struct {
type ReplicationController struct { type ReplicationController struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the desired behavior of this replication controller. // Spec defines the desired behavior of this replication controller.
// +optional // +optional
@ -2333,7 +2334,7 @@ type ServicePort struct {
type Service struct { type Service struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the behavior of a service. // Spec defines the behavior of a service.
// +optional // +optional
@ -2353,7 +2354,7 @@ type Service struct {
type ServiceAccount struct { type ServiceAccount struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// 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 Secrets []ObjectReference
@ -2391,7 +2392,7 @@ type ServiceAccountList struct {
type Endpoints struct { type Endpoints struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// 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
@ -2713,7 +2714,7 @@ type ResourceList map[ResourceName]resource.Quantity
type Node struct { type Node struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the behavior of a node. // Spec defines the behavior of a node.
// +optional // +optional
@ -2773,7 +2774,7 @@ const (
type Namespace struct { type Namespace struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the behavior of the Namespace. // Spec defines the behavior of the Namespace.
// +optional // +optional
@ -2798,7 +2799,7 @@ type Binding struct {
metav1.TypeMeta metav1.TypeMeta
// ObjectMeta describes the object that is being bound. // ObjectMeta describes the object that is being bound.
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Target is the object to bind to. // Target is the object to bind to.
Target ObjectReference Target ObjectReference
@ -3026,7 +3027,7 @@ const (
type Event struct { type Event struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Required. The object that this event is about. // Required. The object that this event is about.
// +optional // +optional
@ -3129,7 +3130,7 @@ type LimitRangeSpec struct {
type LimitRange struct { type LimitRange struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the limits enforced // Spec defines the limits enforced
// +optional // +optional
@ -3219,7 +3220,7 @@ type ResourceQuotaStatus struct {
type ResourceQuota struct { type ResourceQuota struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Spec defines the desired quota // Spec defines the desired quota
// +optional // +optional
@ -3247,7 +3248,7 @@ type ResourceQuotaList struct {
type Secret struct { type Secret struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// 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.
@ -3362,7 +3363,7 @@ type SecretList struct {
type ConfigMap struct { type ConfigMap struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// Data contains the configuration data. // Data contains the configuration data.
// Each key must be a valid DNS_SUBDOMAIN with an optional leading dot. // Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.
@ -3445,7 +3446,7 @@ type ComponentCondition struct {
type ComponentStatus struct { type ComponentStatus struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// +optional // +optional
Conditions []ComponentCondition Conditions []ComponentCondition
@ -3524,7 +3525,7 @@ type SELinuxOptions struct {
type RangeAllocation struct { type RangeAllocation struct {
metav1.TypeMeta metav1.TypeMeta
// +optional // +optional
ObjectMeta metav1.ObjectMeta
// 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.

View File

@ -269,9 +269,7 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
} }
func Convert_v1_ReplicationController_to_extensions_ReplicaSet(in *ReplicationController, out *extensions.ReplicaSet, s conversion.Scope) error { func Convert_v1_ReplicationController_to_extensions_ReplicaSet(in *ReplicationController, out *extensions.ReplicaSet, s conversion.Scope) error {
if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { out.ObjectMeta = in.ObjectMeta
return err
}
if err := Convert_v1_ReplicationControllerSpec_to_extensions_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil { if err := Convert_v1_ReplicationControllerSpec_to_extensions_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil {
return err return err
} }
@ -304,9 +302,7 @@ func Convert_v1_ReplicationControllerStatus_to_extensions_ReplicaSetStatus(in *R
} }
func Convert_extensions_ReplicaSet_to_v1_ReplicationController(in *extensions.ReplicaSet, out *ReplicationController, s conversion.Scope) error { func Convert_extensions_ReplicaSet_to_v1_ReplicationController(in *extensions.ReplicaSet, out *ReplicationController, s conversion.Scope) error {
if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil { out.ObjectMeta = in.ObjectMeta
return err
}
if err := Convert_extensions_ReplicaSetSpec_to_v1_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil { if err := Convert_extensions_ReplicaSetSpec_to_v1_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil {
fieldErr, ok := err.(*field.Error) fieldErr, ok := err.(*field.Error)
if !ok { if !ok {

View File

@ -21,6 +21,7 @@ import (
"reflect" "reflect"
"testing" "testing"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/kubernetes/pkg/api" "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource" "k8s.io/kubernetes/pkg/api/resource"
@ -59,7 +60,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
rc: &v1.ReplicationController{ rc: &v1.ReplicationController{
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -72,14 +73,14 @@ func TestSetDefaultReplicationController(t *testing.T) {
}, },
{ {
rc: &v1.ReplicationController{ rc: &v1.ReplicationController{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"bar": "foo", "bar": "foo",
}, },
}, },
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -92,7 +93,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
}, },
{ {
rc: &v1.ReplicationController{ rc: &v1.ReplicationController{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"bar": "foo", "bar": "foo",
}, },
@ -102,7 +103,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
"some": "other", "some": "other",
}, },
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -120,7 +121,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
"some": "other", "some": "other",
}, },
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -173,7 +174,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
rc: v1.ReplicationController{ rc: v1.ReplicationController{
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -188,7 +189,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Replicas: newInt(0), Replicas: newInt(0),
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -203,7 +204,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Replicas: newInt(3), Replicas: newInt(3),
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -254,7 +255,7 @@ func TestSetDefaultReplicationControllerImagePullPolicy(t *testing.T) {
rc: v1.ReplicationController{ rc: v1.ReplicationController{
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"pod.beta.kubernetes.io/init-containers": string(containersWithoutPullPolicy), "pod.beta.kubernetes.io/init-containers": string(containersWithoutPullPolicy),
}, },
@ -268,7 +269,7 @@ func TestSetDefaultReplicationControllerImagePullPolicy(t *testing.T) {
rc: v1.ReplicationController{ rc: v1.ReplicationController{
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
"pod.beta.kubernetes.io/init-containers": string(containersWithPullPolicy), "pod.beta.kubernetes.io/init-containers": string(containersWithPullPolicy),
}, },
@ -724,7 +725,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
Spec: v1.ReplicationControllerSpec{ Spec: v1.ReplicationControllerSpec{
Replicas: newInt(3), Replicas: newInt(3),
Template: &v1.PodTemplateSpec{ Template: &v1.PodTemplateSpec{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
"foo": "bar", "foo": "bar",
}, },
@ -744,7 +745,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
func TestSetDefaultLimitRangeItem(t *testing.T) { func TestSetDefaultLimitRangeItem(t *testing.T) {
limitRange := &v1.LimitRange{ limitRange := &v1.LimitRange{
ObjectMeta: v1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: "test-defaults", Name: "test-defaults",
}, },
Spec: v1.LimitRangeSpec{ Spec: v1.LimitRangeSpec{

File diff suppressed because it is too large Load Diff

View File

@ -141,7 +141,7 @@ message Binding {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// The target object that you want to bind to the standard object. // The target object that you want to bind to the standard object.
optional ObjectReference target = 2; optional ObjectReference target = 2;
@ -240,7 +240,7 @@ message ComponentStatus {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// List of component conditions observed // List of component conditions observed
// +optional // +optional
@ -263,7 +263,7 @@ message ConfigMap {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Data contains the configuration data. // Data contains the configuration data.
// Each key must be a valid DNS_SUBDOMAIN with an optional leading dot. // Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.
@ -767,7 +767,7 @@ message Endpoints {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// The set of all endpoints is the union of all subsets. Addresses are placed into // The set of all endpoints is the union of all subsets. Addresses are placed into
// subsets according to the IPs they share. A single address with multiple ports, // subsets according to the IPs they share. A single address with multiple ports,
@ -848,7 +848,7 @@ message EnvVarSource {
message Event { message Event {
// 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
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// The object that this event is about. // The object that this event is about.
optional ObjectReference involvedObject = 2; optional ObjectReference involvedObject = 2;
@ -1195,7 +1195,7 @@ message LimitRange {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the limits enforced. // Spec defines the limits enforced.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -1347,7 +1347,7 @@ message Namespace {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the behavior of the Namespace. // Spec defines the behavior of the Namespace.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -1394,7 +1394,7 @@ message Node {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the behavior of a node. // Spec defines the behavior of a node.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -1652,6 +1652,8 @@ message ObjectFieldSelector {
// 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.
// DEPRECATED: Use k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta instead - this type will be removed soon.
// +k8s:openapi-gen=false
message ObjectMeta { message ObjectMeta {
// Name must be unique within a namespace. Is required when creating resources, although // Name must be unique within a namespace. Is required when creating resources, although
// some resources may allow a client to request the generation of an appropriate name // some resources may allow a client to request the generation of an appropriate name
@ -1848,7 +1850,7 @@ message PersistentVolume {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines a specification of a persistent volume owned by the cluster. // Spec defines a specification of a persistent volume owned by the cluster.
// Provisioned by an administrator. // Provisioned by an administrator.
@ -1869,7 +1871,7 @@ message PersistentVolumeClaim {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the desired characteristics of a volume requested by a pod author. // Spec defines the desired characteristics of a volume requested by a pod author.
// More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims // More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims
@ -2111,7 +2113,7 @@ message Pod {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Specification of the desired behavior of the pod. // Specification of the desired behavior of the pod.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2607,7 +2609,7 @@ message PodStatusResult {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Most recently observed status of the pod. // Most recently observed status of the pod.
// This data may not be up to date. // This data may not be up to date.
@ -2623,7 +2625,7 @@ message PodTemplate {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Template defines the pods that will be created from this pod template. // Template defines the pods that will be created from this pod template.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2647,7 +2649,7 @@ message PodTemplateSpec {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Specification of the desired behavior of the pod. // Specification of the desired behavior of the pod.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2806,7 +2808,7 @@ message RangeAllocation {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Range is string that identifies the range represented by 'data'. // Range is string that identifies the range represented by 'data'.
optional string range = 2; optional string range = 2;
@ -2821,7 +2823,7 @@ message ReplicationController {
// be the same as the Pod(s) that the replication controller manages. // be the same as the Pod(s) that the replication controller manages.
// Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the specification of the desired behavior of the replication controller. // Spec defines the specification of the desired behavior of the replication controller.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2947,7 +2949,7 @@ message ResourceQuota {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the desired quota. // Spec defines the desired quota.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -3037,7 +3039,7 @@ message Secret {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// 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.
@ -3169,7 +3171,7 @@ message Service {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Spec defines the behavior of a service. // Spec defines the behavior of a service.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -3192,7 +3194,7 @@ message ServiceAccount {
// 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
// +optional // +optional
optional ObjectMeta metadata = 1; optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// 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.
// More info: http://kubernetes.io/docs/user-guide/secrets // More info: http://kubernetes.io/docs/user-guide/secrets

View File

@ -21,6 +21,7 @@ import (
"fmt" "fmt"
"strings" "strings"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection" "k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -86,26 +87,12 @@ var standardFinalizers = sets.NewString(
FinalizerOrphan, FinalizerOrphan,
) )
// HasAnnotation returns a bool if passed in annotation exists
func HasAnnotation(obj ObjectMeta, ann string) bool {
_, found := obj.Annotations[ann]
return found
}
// SetMetaDataAnnotation sets the annotation and value
func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) {
if obj.Annotations == nil {
obj.Annotations = make(map[string]string)
}
obj.Annotations[ann] = value
}
func IsStandardFinalizerName(str string) bool { func IsStandardFinalizerName(str string) bool {
return standardFinalizers.Has(str) return standardFinalizers.Has(str)
} }
// SingleObject returns a ListOptions for watching a single object. // SingleObject returns a ListOptions for watching a single object.
func SingleObject(meta ObjectMeta) ListOptions { func SingleObject(meta metav1.ObjectMeta) ListOptions {
return ListOptions{ return ListOptions{
FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name).String(), FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name).String(),
ResourceVersion: meta.ResourceVersion, ResourceVersion: meta.ResourceVersion,

View File

@ -190,7 +190,7 @@ func TestGetAffinityFromPod(t *testing.T) {
}, },
{ {
pod: &Pod{ pod: &Pod{
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
AffinityAnnotationKey: ` AffinityAnnotationKey: `
{"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": { {"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": {
@ -209,7 +209,7 @@ func TestGetAffinityFromPod(t *testing.T) {
}, },
{ {
pod: &Pod{ pod: &Pod{
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
AffinityAnnotationKey: ` AffinityAnnotationKey: `
{"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": { {"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": {
@ -350,7 +350,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
}, },
{ {
node: &Node{ node: &Node{
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
PreferAvoidPodsAnnotationKey: ` PreferAvoidPodsAnnotationKey: `
{ {
@ -395,7 +395,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
{ {
node: &Node{ node: &Node{
// Missing end symbol of "podController" and "podSignature" // Missing end symbol of "podController" and "podSignature"
ObjectMeta: ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Annotations: map[string]string{ Annotations: map[string]string{
PreferAvoidPodsAnnotationKey: ` PreferAvoidPodsAnnotationKey: `
{ {

View File

@ -17,14 +17,13 @@ limitations under the License.
package v1 package v1
import ( import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
) )
func (obj *ObjectMeta) GetObjectMeta() meta.Object { return obj } func (obj *ObjectMeta) GetObjectMeta() metav1.Object { return obj }
// Namespace implements meta.Object for any object with an ObjectMeta typed field. Allows // Namespace implements metav1.Object for any object with an ObjectMeta typed field. Allows
// fast, direct access to metadata fields for API objects. // fast, direct access to metadata fields for API objects.
func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace } func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace }
func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace } func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace }

File diff suppressed because it is too large Load Diff

View File

@ -65,6 +65,8 @@ import (
// 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.
// DEPRECATED: Use k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta instead - this type will be removed soon.
// +k8s:openapi-gen=false
type ObjectMeta struct { type ObjectMeta struct {
// Name must be unique within a namespace. Is required when creating resources, although // Name must be unique within a namespace. Is required when creating resources, although
// some resources may allow a client to request the generation of an appropriate name // some resources may allow a client to request the generation of an appropriate name
@ -422,7 +424,7 @@ type PersistentVolume struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines a specification of a persistent volume owned by the cluster. // Spec defines a specification of a persistent volume owned by the cluster.
// Provisioned by an administrator. // Provisioned by an administrator.
@ -514,7 +516,7 @@ type PersistentVolumeClaim struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the desired characteristics of a volume requested by a pod author. // Spec defines the desired characteristics of a volume requested by a pod author.
// More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims // More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims
@ -2252,7 +2254,7 @@ type PodStatusResult struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Most recently observed status of the pod. // Most recently observed status of the pod.
// This data may not be up to date. // This data may not be up to date.
// Populated by the system. // Populated by the system.
@ -2271,7 +2273,7 @@ type Pod struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the pod. // Specification of the desired behavior of the pod.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2305,7 +2307,7 @@ type PodTemplateSpec struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the pod. // Specification of the desired behavior of the pod.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2321,7 +2323,7 @@ type PodTemplate struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Template defines the pods that will be created from this pod template. // Template defines the pods that will be created from this pod template.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2442,7 +2444,7 @@ type ReplicationController struct {
// be the same as the Pod(s) that the replication controller manages. // be the same as the Pod(s) that the replication controller manages.
// Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata // Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the specification of the desired behavior of the replication controller. // Spec defines the specification of the desired behavior of the replication controller.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2675,7 +2677,7 @@ type Service struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the behavior of a service. // Spec defines the behavior of a service.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -2719,7 +2721,7 @@ type ServiceAccount struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// 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.
// More info: http://kubernetes.io/docs/user-guide/secrets // More info: http://kubernetes.io/docs/user-guide/secrets
@ -2766,7 +2768,7 @@ type Endpoints struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// The set of all endpoints is the union of all subsets. Addresses are placed into // The set of all endpoints is the union of all subsets. Addresses are placed into
// subsets according to the IPs they share. A single address with multiple ports, // subsets according to the IPs they share. A single address with multiple ports,
@ -3124,7 +3126,7 @@ type Node struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the behavior of a node. // Spec defines the behavior of a node.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -3196,7 +3198,7 @@ type Namespace struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the behavior of the Namespace. // Spec defines the behavior of the Namespace.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -3229,7 +3231,7 @@ type Binding struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// The target object that you want to bind to the standard object. // The target object that you want to bind to the standard object.
Target ObjectReference `json:"target" protobuf:"bytes,2,opt,name=target"` Target ObjectReference `json:"target" protobuf:"bytes,2,opt,name=target"`
@ -3517,7 +3519,7 @@ type Event struct {
metav1.TypeMeta `json:",inline"` metav1.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" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
// The object that this event is about. // The object that this event is about.
InvolvedObject ObjectReference `json:"involvedObject" protobuf:"bytes,2,opt,name=involvedObject"` InvolvedObject ObjectReference `json:"involvedObject" protobuf:"bytes,2,opt,name=involvedObject"`
@ -3626,7 +3628,7 @@ type LimitRange struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the limits enforced. // Spec defines the limits enforced.
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -3724,7 +3726,7 @@ type ResourceQuota struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Spec defines the desired quota. // Spec defines the desired quota.
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status // http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
@ -3759,7 +3761,7 @@ type Secret struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// 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.
@ -3886,7 +3888,7 @@ type ConfigMap struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Data contains the configuration data. // Data contains the configuration data.
// Each key must be a valid DNS_SUBDOMAIN with an optional leading dot. // Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.
@ -3941,7 +3943,7 @@ type ComponentStatus struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// List of component conditions observed // List of component conditions observed
// +optional // +optional
@ -4059,7 +4061,7 @@ type RangeAllocation struct {
// 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
// +optional // +optional
ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Range is string that identifies the range represented by 'data'. // Range is string that identifies the range represented by 'data'.
Range string `json:"range" protobuf:"bytes,2,opt,name=range"` Range string `json:"range" protobuf:"bytes,2,opt,name=range"`

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