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:
commit
627e1e8174
@ -32,6 +32,7 @@ go_library(
|
||||
"//vendor:github.com/prometheus/client_golang/prometheus",
|
||||
"//vendor:github.com/spf13/cobra",
|
||||
"//vendor:github.com/spf13/pflag",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
"//vendor:k8s.io/apiserver/pkg/healthz",
|
||||
],
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/healthz"
|
||||
"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
|
||||
rl := resourcelock.EndpointsLock{
|
||||
EndpointsMeta: v1.ObjectMeta{
|
||||
EndpointsMeta: metav1.ObjectMeta{
|
||||
Namespace: "kube-system",
|
||||
Name: "cloud-controller-manager",
|
||||
},
|
||||
|
@ -16,10 +16,7 @@ limitations under the License.
|
||||
|
||||
package apiregistration
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kapi "k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// APIServiceList is a list of APIService objects.
|
||||
type APIServiceList struct {
|
||||
@ -75,7 +72,7 @@ type APIServiceStatus struct {
|
||||
// Name must be "version.group".
|
||||
type APIService struct {
|
||||
metav1.TypeMeta
|
||||
kapi.ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec contains information for locating and communicating with a server
|
||||
Spec APIServiceSpec
|
||||
|
@ -26,8 +26,7 @@ import (
|
||||
"fmt"
|
||||
codec1978 "github.com/ugorji/go/codec"
|
||||
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkg3_types "k8s.io/apimachinery/pkg/types"
|
||||
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
pkg2_types "k8s.io/apimachinery/pkg/types"
|
||||
"reflect"
|
||||
"runtime"
|
||||
time "time"
|
||||
@ -64,10 +63,9 @@ func init() {
|
||||
}
|
||||
if false { // reference the types, but skip this branch at build/run time
|
||||
var v0 pkg1_v1.TypeMeta
|
||||
var v1 pkg3_types.UID
|
||||
var v2 pkg2_v1.ObjectMeta
|
||||
var v3 time.Time
|
||||
_, _, _, _ = v0, v1, v2, v3
|
||||
var v1 pkg2_types.UID
|
||||
var v2 time.Time
|
||||
_, _, _ = v0, v1, v2
|
||||
}
|
||||
}
|
||||
|
||||
@ -1340,7 +1338,13 @@ func (x *APIService) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[2] {
|
||||
yy10 := &x.ObjectMeta
|
||||
yy10.CodecEncodeSelf(e)
|
||||
yym11 := z.EncBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy10) {
|
||||
} else {
|
||||
z.EncFallback(yy10)
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
@ -1350,7 +1354,13 @@ func (x *APIService) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
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 {
|
||||
@ -1474,24 +1484,30 @@ func (x *APIService) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
case "metadata":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ObjectMeta = pkg2_v1.ObjectMeta{}
|
||||
x.ObjectMeta = pkg1_v1.ObjectMeta{}
|
||||
} else {
|
||||
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":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = APIServiceSpec{}
|
||||
} else {
|
||||
yyv9 := &x.Spec
|
||||
yyv9.CodecDecodeSelf(d)
|
||||
yyv10 := &x.Spec
|
||||
yyv10.CodecDecodeSelf(d)
|
||||
}
|
||||
case "status":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = APIServiceStatus{}
|
||||
} else {
|
||||
yyv10 := &x.Status
|
||||
yyv10.CodecDecodeSelf(d)
|
||||
yyv11 := &x.Status
|
||||
yyv11.CodecDecodeSelf(d)
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys3)
|
||||
@ -1504,16 +1520,16 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj11 int
|
||||
var yyb11 bool
|
||||
var yyhl11 bool = l >= 0
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
var yyj12 int
|
||||
var yyb12 bool
|
||||
var yyhl12 bool = l >= 0
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1521,21 +1537,21 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
yyv12 := &x.Kind
|
||||
yym13 := z.DecBinary()
|
||||
_ = yym13
|
||||
yyv13 := &x.Kind
|
||||
yym14 := z.DecBinary()
|
||||
_ = yym14
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv12)) = r.DecodeString()
|
||||
*((*string)(yyv13)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1543,38 +1559,44 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
yyv14 := &x.APIVersion
|
||||
yym15 := z.DecBinary()
|
||||
_ = yym15
|
||||
yyv15 := &x.APIVersion
|
||||
yym16 := z.DecBinary()
|
||||
_ = yym16
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv14)) = r.DecodeString()
|
||||
*((*string)(yyv15)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ObjectMeta = pkg2_v1.ObjectMeta{}
|
||||
x.ObjectMeta = pkg1_v1.ObjectMeta{}
|
||||
} else {
|
||||
yyv16 := &x.ObjectMeta
|
||||
yyv16.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyv17 := &x.ObjectMeta
|
||||
yym18 := z.DecBinary()
|
||||
_ = yym18
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(yyv17) {
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
z.DecFallback(yyv17, false)
|
||||
}
|
||||
if yyb11 {
|
||||
}
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1582,16 +1604,16 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = APIServiceSpec{}
|
||||
} else {
|
||||
yyv17 := &x.Spec
|
||||
yyv17.CodecDecodeSelf(d)
|
||||
yyv19 := &x.Spec
|
||||
yyv19.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1599,21 +1621,21 @@ func (x *APIService) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = APIServiceStatus{}
|
||||
} else {
|
||||
yyv18 := &x.Status
|
||||
yyv18.CodecDecodeSelf(d)
|
||||
yyv20 := &x.Status
|
||||
yyv20.CodecDecodeSelf(d)
|
||||
}
|
||||
for {
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj11-1, "")
|
||||
z.DecStructFieldNotFound(yyj12-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
@ -16,10 +16,7 @@ limitations under the License.
|
||||
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
kapi "k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// APIServiceList is a list of APIService objects.
|
||||
type APIServiceList struct {
|
||||
@ -75,7 +72,7 @@ type APIServiceStatus struct {
|
||||
// Name must be "version.group".
|
||||
type APIService struct {
|
||||
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 APIServiceSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
|
||||
|
@ -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 {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1alpha1_APIServiceSpec_To_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
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 {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_apiregistration_APIServiceSpec_To_v1alpha1_APIServiceSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -21,9 +21,9 @@ limitations under the License.
|
||||
package v1alpha1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
@ -48,8 +48,10 @@ func DeepCopy_v1alpha1_APIService(in interface{}, out interface{}, c *conversion
|
||||
in := in.(*APIService)
|
||||
out := out.(*APIService)
|
||||
*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
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
if err := DeepCopy_v1alpha1_APIServiceSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
|
@ -21,9 +21,9 @@ limitations under the License.
|
||||
package apiregistration
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
@ -48,8 +48,10 @@ func DeepCopy_apiregistration_APIService(in interface{}, out interface{}, c *con
|
||||
in := in.(*APIService)
|
||||
out := out.(*APIService)
|
||||
*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
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
if err := DeepCopy_apiregistration_APIServiceSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
|
@ -111,7 +111,7 @@ func TestAPIs(t *testing.T) {
|
||||
name: "simple add",
|
||||
apiservices: []*apiregistration.APIService{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "v1.foo"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
|
||||
Spec: apiregistration.APIServiceSpec{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
Namespace: "ns",
|
||||
@ -172,7 +172,7 @@ func TestAPIs(t *testing.T) {
|
||||
name: "sorting",
|
||||
apiservices: []*apiregistration.APIService{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "v1.foo"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
|
||||
Spec: apiregistration.APIServiceSpec{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
Namespace: "ns",
|
||||
@ -277,9 +277,9 @@ func TestAPIs(t *testing.T) {
|
||||
for _, o := range tc.apiservices {
|
||||
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{
|
||||
ObjectMeta: corev1.ObjectMeta{Namespace: "ns", Name: "api"},
|
||||
ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "api"},
|
||||
Subsets: []corev1.EndpointSubset{
|
||||
{Addresses: []corev1.EndpointAddress{{}}},
|
||||
},
|
||||
@ -352,7 +352,7 @@ func TestAPIGroup(t *testing.T) {
|
||||
group: "foo",
|
||||
apiservices: []*apiregistration.APIService{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "v1.foo"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
|
||||
Spec: apiregistration.APIServiceSpec{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
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{
|
||||
Service: apiregistration.ServiceReference{
|
||||
Namespace: "ns",
|
||||
@ -434,9 +434,9 @@ func TestAPIGroup(t *testing.T) {
|
||||
for _, o := range tc.apiservices {
|
||||
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{
|
||||
ObjectMeta: corev1.ObjectMeta{Namespace: "ns", Name: "api"},
|
||||
ObjectMeta: metav1.ObjectMeta{Namespace: "ns", Name: "api"},
|
||||
Subsets: []corev1.EndpointSubset{
|
||||
{Addresses: []corev1.EndpointAddress{{}}},
|
||||
},
|
||||
|
@ -25,10 +25,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apiserver/pkg/authentication/user"
|
||||
genericapirequest "k8s.io/apiserver/pkg/request"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
|
||||
"k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
|
||||
)
|
||||
@ -103,7 +103,7 @@ func TestProxyHandler(t *testing.T) {
|
||||
},
|
||||
"no user": {
|
||||
apiService: &apiregistration.APIService{
|
||||
ObjectMeta: api.ObjectMeta{Name: "v1.foo"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
|
||||
Spec: apiregistration.APIServiceSpec{
|
||||
Group: "foo",
|
||||
Version: "v1",
|
||||
@ -119,7 +119,7 @@ func TestProxyHandler(t *testing.T) {
|
||||
},
|
||||
path: "/request/path",
|
||||
apiService: &apiregistration.APIService{
|
||||
ObjectMeta: api.ObjectMeta{Name: "v1.foo"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
|
||||
Spec: apiregistration.APIServiceSpec{
|
||||
Group: "foo",
|
||||
Version: "v1",
|
||||
@ -144,7 +144,7 @@ func TestProxyHandler(t *testing.T) {
|
||||
},
|
||||
path: "/request/path",
|
||||
apiService: &apiregistration.APIService{
|
||||
ObjectMeta: api.ObjectMeta{Name: "v1.foo"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "v1.foo"},
|
||||
Spec: apiregistration.APIServiceSpec{
|
||||
Group: "foo",
|
||||
Version: "v1",
|
||||
|
@ -16,9 +16,9 @@ go_library(
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//cmd/kube-aggregator/pkg/apis/apiregistration:go_default_library",
|
||||
"//pkg/api:go_default_library",
|
||||
"//pkg/client/cache:go_default_library",
|
||||
"//vendor:k8s.io/apimachinery/pkg/api/errors",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/labels",
|
||||
],
|
||||
)
|
||||
|
@ -20,9 +20,9 @@ package internalversion
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
"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.
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -17,9 +17,9 @@ go_library(
|
||||
deps = [
|
||||
"//cmd/kube-aggregator/pkg/apis/apiregistration: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",
|
||||
"//vendor:k8s.io/apimachinery/pkg/api/errors",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/labels",
|
||||
],
|
||||
)
|
||||
|
@ -20,10 +20,10 @@ package v1alpha1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
apiregistration "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
|
||||
v1alpha1 "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration/v1alpha1"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/cache"
|
||||
)
|
||||
|
||||
|
@ -31,6 +31,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@ -178,7 +179,7 @@ func Run(s *options.CMServer) error {
|
||||
|
||||
// TODO: enable other lock types
|
||||
rl := resourcelock.EndpointsLock{
|
||||
EndpointsMeta: v1.ObjectMeta{
|
||||
EndpointsMeta: metav1.ObjectMeta{
|
||||
Namespace: "kube-system",
|
||||
Name: "kube-controller-manager",
|
||||
},
|
||||
|
@ -127,11 +127,11 @@ func standardLabels(n string) map[string]string {
|
||||
func NewDaemonSet(daemonName string, podSpec v1.PodSpec) *extensions.DaemonSet {
|
||||
l := standardLabels(daemonName)
|
||||
return &extensions.DaemonSet{
|
||||
ObjectMeta: v1.ObjectMeta{Name: daemonName},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: daemonName},
|
||||
Spec: extensions.DaemonSetSpec{
|
||||
Selector: &metav1.LabelSelector{MatchLabels: l},
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{Labels: l},
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: l},
|
||||
Spec: podSpec,
|
||||
},
|
||||
},
|
||||
@ -141,7 +141,7 @@ func NewDaemonSet(daemonName string, podSpec v1.PodSpec) *extensions.DaemonSet {
|
||||
func NewService(serviceName string, spec v1.ServiceSpec) *v1.Service {
|
||||
l := standardLabels(serviceName)
|
||||
return &v1.Service{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: serviceName,
|
||||
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 {
|
||||
l := standardLabels(deploymentName)
|
||||
return &extensions.Deployment{
|
||||
ObjectMeta: v1.ObjectMeta{Name: deploymentName},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: deploymentName},
|
||||
Spec: extensions.DeploymentSpec{
|
||||
Replicas: &replicas,
|
||||
Selector: &metav1.LabelSelector{MatchLabels: l},
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{Labels: l},
|
||||
ObjectMeta: metav1.ObjectMeta{Labels: l},
|
||||
Spec: podSpec,
|
||||
},
|
||||
},
|
||||
@ -213,7 +213,7 @@ func UpdateMasterRoleLabelsAndTaints(client *clientset.Clientset, schedulable bo
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetMasterTaintTolerations(meta *v1.ObjectMeta) {
|
||||
func SetMasterTaintTolerations(meta *metav1.ObjectMeta) {
|
||||
tolerationsAnnotation, _ := json.Marshal([]v1.Toleration{{Key: "dedicated", Value: "master", Effect: "NoSchedule"}})
|
||||
if meta.Annotations == nil {
|
||||
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)
|
||||
func SetNodeAffinity(meta *v1.ObjectMeta, expr ...v1.NodeSelectorRequirement) {
|
||||
func SetNodeAffinity(meta *metav1.ObjectMeta, expr ...v1.NodeSelectorRequirement) {
|
||||
nodeAffinity := &v1.NodeAffinity{
|
||||
RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{
|
||||
NodeSelectorTerms: []v1.NodeSelectorTerm{{MatchExpressions: expr}},
|
||||
|
@ -109,7 +109,7 @@ func newKubeDiscovery(cfg *kubeadmapi.MasterConfiguration, caCert *x509.Certific
|
||||
kd := kubeDiscovery{
|
||||
Deployment: NewDeployment(kubeDiscoveryName, 1, newKubeDiscoveryPodSpec(cfg)),
|
||||
Secret: &v1.Secret{
|
||||
ObjectMeta: v1.ObjectMeta{Name: kubeDiscoverySecretName},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: kubeDiscoverySecretName},
|
||||
Type: v1.SecretTypeOpaque,
|
||||
Data: encodeKubeDiscoverySecretData(cfg.Discovery.Token, cfg.API, caCert),
|
||||
},
|
||||
|
@ -261,7 +261,7 @@ func componentPod(container api.Container, volumes ...api.Volume) api.Pod {
|
||||
APIVersion: "v1",
|
||||
Kind: "Pod",
|
||||
},
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: container.Name,
|
||||
Namespace: "kube-system",
|
||||
Labels: map[string]string{"component": container.Name, "tier": "control-plane"},
|
||||
|
@ -151,7 +151,7 @@ func UpdateOrCreateToken(client *clientset.Clientset, d *kubeadmapi.TokenDiscove
|
||||
// Secret does not already exist:
|
||||
if apierrors.IsNotFound(err) {
|
||||
secret = &v1.Secret{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: secretName,
|
||||
},
|
||||
Type: api.SecretTypeBootstrapToken,
|
||||
|
@ -16,16 +16,13 @@ limitations under the License.
|
||||
|
||||
package testgroup
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// +genclient=true
|
||||
|
||||
type TestType struct {
|
||||
metav1.TypeMeta
|
||||
api.ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
Status TestTypeStatus
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ import (
|
||||
"fmt"
|
||||
codec1978 "github.com/ugorji/go/codec"
|
||||
pkg1_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkg3_types "k8s.io/apimachinery/pkg/types"
|
||||
pkg2_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
pkg2_types "k8s.io/apimachinery/pkg/types"
|
||||
"reflect"
|
||||
"runtime"
|
||||
time "time"
|
||||
@ -64,10 +63,9 @@ func init() {
|
||||
}
|
||||
if false { // reference the types, but skip this branch at build/run time
|
||||
var v0 pkg1_v1.TypeMeta
|
||||
var v1 pkg3_types.UID
|
||||
var v2 pkg2_v1.ObjectMeta
|
||||
var v3 time.Time
|
||||
_, _, _, _ = v0, v1, v2, v3
|
||||
var v1 pkg2_types.UID
|
||||
var v2 time.Time
|
||||
_, _, _ = v0, v1, v2
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,7 +157,13 @@ func (x *TestType) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[2] {
|
||||
yy10 := &x.ObjectMeta
|
||||
yy10.CodecEncodeSelf(e)
|
||||
yym11 := z.EncBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy10) {
|
||||
} else {
|
||||
z.EncFallback(yy10)
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
@ -169,7 +173,13 @@ func (x *TestType) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
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 {
|
||||
@ -276,17 +286,23 @@ func (x *TestType) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
case "metadata":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ObjectMeta = pkg2_v1.ObjectMeta{}
|
||||
x.ObjectMeta = pkg1_v1.ObjectMeta{}
|
||||
} else {
|
||||
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":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = TestTypeStatus{}
|
||||
} else {
|
||||
yyv9 := &x.Status
|
||||
yyv9.CodecDecodeSelf(d)
|
||||
yyv10 := &x.Status
|
||||
yyv10.CodecDecodeSelf(d)
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys3)
|
||||
@ -299,16 +315,16 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj10 int
|
||||
var yyb10 bool
|
||||
var yyhl10 bool = l >= 0
|
||||
yyj10++
|
||||
if yyhl10 {
|
||||
yyb10 = yyj10 > l
|
||||
var yyj11 int
|
||||
var yyb11 bool
|
||||
var yyhl11 bool = l >= 0
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
} else {
|
||||
yyb10 = r.CheckBreak()
|
||||
yyb11 = r.CheckBreak()
|
||||
}
|
||||
if yyb10 {
|
||||
if yyb11 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -316,21 +332,21 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
yyv11 := &x.Kind
|
||||
yym12 := z.DecBinary()
|
||||
_ = yym12
|
||||
yyv12 := &x.Kind
|
||||
yym13 := z.DecBinary()
|
||||
_ = yym13
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv11)) = r.DecodeString()
|
||||
*((*string)(yyv12)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj10++
|
||||
if yyhl10 {
|
||||
yyb10 = yyj10 > l
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
} else {
|
||||
yyb10 = r.CheckBreak()
|
||||
yyb11 = r.CheckBreak()
|
||||
}
|
||||
if yyb10 {
|
||||
if yyb11 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -338,38 +354,44 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
yyv13 := &x.APIVersion
|
||||
yym14 := z.DecBinary()
|
||||
_ = yym14
|
||||
yyv14 := &x.APIVersion
|
||||
yym15 := z.DecBinary()
|
||||
_ = yym15
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv13)) = r.DecodeString()
|
||||
*((*string)(yyv14)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj10++
|
||||
if yyhl10 {
|
||||
yyb10 = yyj10 > l
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
} else {
|
||||
yyb10 = r.CheckBreak()
|
||||
yyb11 = r.CheckBreak()
|
||||
}
|
||||
if yyb10 {
|
||||
if yyb11 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ObjectMeta = pkg2_v1.ObjectMeta{}
|
||||
x.ObjectMeta = pkg1_v1.ObjectMeta{}
|
||||
} else {
|
||||
yyv15 := &x.ObjectMeta
|
||||
yyv15.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj10++
|
||||
if yyhl10 {
|
||||
yyb10 = yyj10 > l
|
||||
yyv16 := &x.ObjectMeta
|
||||
yym17 := z.DecBinary()
|
||||
_ = yym17
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(yyv16) {
|
||||
} else {
|
||||
yyb10 = r.CheckBreak()
|
||||
z.DecFallback(yyv16, false)
|
||||
}
|
||||
if yyb10 {
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -377,21 +399,21 @@ func (x *TestType) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = TestTypeStatus{}
|
||||
} else {
|
||||
yyv16 := &x.Status
|
||||
yyv16.CodecDecodeSelf(d)
|
||||
yyv18 := &x.Status
|
||||
yyv18.CodecDecodeSelf(d)
|
||||
}
|
||||
for {
|
||||
yyj10++
|
||||
if yyhl10 {
|
||||
yyb10 = yyj10 > l
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
} else {
|
||||
yyb10 = r.CheckBreak()
|
||||
yyb11 = r.CheckBreak()
|
||||
}
|
||||
if yyb10 {
|
||||
if yyb11 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj10-1, "")
|
||||
z.DecStructFieldNotFound(yyj11-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
@ -16,10 +16,7 @@ limitations under the License.
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
// +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.
|
||||
// +k8s:openapi-gen=false
|
||||
// +optional
|
||||
apiv1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
// +optional
|
||||
Status TestTypeStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ func (g *genConversion) doSlice(inType, outType *types.Type, sw *generator.Snipp
|
||||
} 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))
|
||||
} 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
|
||||
// we really don't know which package will have the conversion
|
||||
// function defined. This fires on basically every object
|
||||
|
@ -74,7 +74,7 @@ func generatedBy() string {
|
||||
}
|
||||
|
||||
// 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
|
||||
for _, t := range p.Types {
|
||||
// filter out types which dont have genclient=true.
|
||||
@ -84,19 +84,19 @@ func objectMetaForPackage(p *types.Package) (*types.Type, error) {
|
||||
generatingForPackage = true
|
||||
for _, member := range t.Members {
|
||||
if member.Name == "ObjectMeta" {
|
||||
return member.Type, nil
|
||||
return member.Type, isInternal(member), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
||||
func isInternal(t *types.Type) bool {
|
||||
return t.Name.Package == "k8s.io/kubernetes/pkg/api"
|
||||
// isInternal returns true if the tags for a member do not contain a json tag
|
||||
func isInternal(m types.Member) bool {
|
||||
return !strings.Contains(m.Tags, "json")
|
||||
}
|
||||
|
||||
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 {
|
||||
p := context.Universe.Package(inputDir)
|
||||
|
||||
objectMeta, err := objectMetaForPackage(p)
|
||||
objectMeta, internal, err := objectMetaForPackage(p)
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
}
|
||||
@ -139,7 +139,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
|
||||
var gv clientgentypes.GroupVersion
|
||||
|
||||
if isInternal(objectMeta) {
|
||||
if internal {
|
||||
lastSlash := strings.LastIndex(p.Path, "/")
|
||||
if lastSlash == -1 {
|
||||
glog.Fatalf("error constructing internal group version for package %q", p.Path)
|
||||
|
@ -87,7 +87,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
for _, inputDir := range arguments.InputDirs {
|
||||
p := context.Universe.Package(inputDir)
|
||||
|
||||
objectMeta, err := objectMetaForPackage(p)
|
||||
objectMeta, internal, err := objectMetaForPackage(p)
|
||||
if err != nil {
|
||||
glog.Fatal(err)
|
||||
}
|
||||
@ -99,7 +99,7 @@ func Packages(context *generator.Context, arguments *args.GeneratorArgs) generat
|
||||
var gv clientgentypes.GroupVersion
|
||||
var internalGVPkg string
|
||||
|
||||
if isInternal(objectMeta) {
|
||||
if internal {
|
||||
lastSlash := strings.LastIndex(p.Path, "/")
|
||||
if lastSlash == -1 {
|
||||
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.
|
||||
func objectMetaForPackage(p *types.Package) (*types.Type, error) {
|
||||
func objectMetaForPackage(p *types.Package) (*types.Type, bool, error) {
|
||||
generatingForPackage := false
|
||||
for _, t := range p.Types {
|
||||
// filter out types which dont have genclient=true.
|
||||
@ -175,19 +175,19 @@ func objectMetaForPackage(p *types.Package) (*types.Type, error) {
|
||||
generatingForPackage = true
|
||||
for _, member := range t.Members {
|
||||
if member.Name == "ObjectMeta" {
|
||||
return member.Type, nil
|
||||
return member.Type, isInternal(member), nil
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
||||
func isInternal(t *types.Type) bool {
|
||||
return t.Name.Package == "k8s.io/kubernetes/pkg/api"
|
||||
// isInternal returns true if the tags for a member do not contain a json tag
|
||||
func isInternal(m types.Member) bool {
|
||||
return !strings.Contains(m.Tags, "json")
|
||||
}
|
||||
|
||||
// listerGenerator produces a file of listers for a given GroupVersion and
|
||||
|
@ -21,6 +21,7 @@ go_library(
|
||||
deps = [
|
||||
"//pkg/api:go_default_library",
|
||||
"//pkg/api/install:go_default_library",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/runtime",
|
||||
],
|
||||
)
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
|
||||
@ -57,7 +58,7 @@ func main() {
|
||||
nginxCrt := read(*crt)
|
||||
nginxKey := read(*key)
|
||||
secret := &api.Secret{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "nginxsecret",
|
||||
},
|
||||
Data: map[string][]byte{
|
||||
|
@ -20,6 +20,7 @@ go_library(
|
||||
tags = ["automanaged"],
|
||||
deps = [
|
||||
"//pkg/api:go_default_library",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/runtime",
|
||||
],
|
||||
)
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
@ -50,7 +51,7 @@ func main() {
|
||||
}
|
||||
cfg := read(*kubeconfig)
|
||||
secret := &api.Secret{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: *name,
|
||||
Namespace: *ns,
|
||||
},
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
@ -105,7 +105,7 @@ func TestRESTMapper(t *testing.T) {
|
||||
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)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
|
@ -99,7 +99,7 @@ type Cluster struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
api.ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the behavior of the Cluster.
|
||||
// +optional
|
||||
|
@ -468,7 +468,7 @@ func (this *Cluster) String() string {
|
||||
return "nil"
|
||||
}
|
||||
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) + `,`,
|
||||
`Status:` + strings.Replace(strings.Replace(this.Status.String(), "ClusterStatus", "ClusterStatus", 1), `&`, ``, 1) + `,`,
|
||||
`}`,
|
||||
@ -1487,56 +1487,56 @@ var (
|
||||
)
|
||||
|
||||
var fileDescriptorGenerated = []byte{
|
||||
// 806 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0xcd, 0x6a, 0xeb, 0x46,
|
||||
0x14, 0xb6, 0xfc, 0x7b, 0x3d, 0xa9, 0xdb, 0xcb, 0xd0, 0x82, 0xeb, 0x85, 0x7c, 0x31, 0xa5, 0xf8,
|
||||
0x96, 0x56, 0xc2, 0xa6, 0x94, 0x0b, 0xa5, 0x85, 0x2b, 0x5f, 0x0a, 0x01, 0x87, 0x94, 0x49, 0x28,
|
||||
0x25, 0x14, 0x8a, 0x2c, 0x1f, 0x2b, 0xaa, 0xad, 0x1f, 0x66, 0x46, 0x06, 0x67, 0xd5, 0x07, 0xe8,
|
||||
0xa2, 0x0f, 0xd1, 0x37, 0x28, 0x7d, 0x87, 0xec, 0x9a, 0x45, 0x17, 0x59, 0x99, 0xc6, 0x7d, 0x8b,
|
||||
0xac, 0xca, 0x8c, 0x46, 0xb2, 0x15, 0xc5, 0x69, 0x6f, 0xb2, 0xd3, 0x39, 0x3a, 0xe7, 0xfb, 0xbe,
|
||||
0x39, 0x7f, 0xe8, 0xcd, 0xfc, 0x15, 0x33, 0xbc, 0xd0, 0x9c, 0xc7, 0x13, 0xa0, 0x01, 0x70, 0x60,
|
||||
0xe6, 0x0c, 0xa6, 0x40, 0x6d, 0xee, 0x85, 0x81, 0x69, 0x47, 0x5e, 0xce, 0x5e, 0x0e, 0x26, 0xc0,
|
||||
0xed, 0x81, 0xe9, 0x42, 0x20, 0x5c, 0x30, 0x35, 0x22, 0x1a, 0xf2, 0x10, 0x7f, 0x9e, 0xa0, 0x18,
|
||||
0x5b, 0x14, 0x63, 0x9b, 0x65, 0x08, 0x94, 0x5d, 0x5b, 0xa1, 0x74, 0x3e, 0x73, 0x3d, 0x7e, 0x1e,
|
||||
0x4f, 0x0c, 0x27, 0xf4, 0x4d, 0x37, 0x74, 0x43, 0x53, 0x82, 0x4d, 0xe2, 0x99, 0xb4, 0xa4, 0x21,
|
||||
0xbf, 0x12, 0x92, 0x8e, 0x22, 0x11, 0xa2, 0x7c, 0xdb, 0x39, 0xf7, 0x02, 0xa0, 0x2b, 0x33, 0x9a,
|
||||
0xbb, 0x89, 0x4a, 0x1f, 0xb8, 0x6d, 0x2e, 0x0b, 0xd2, 0x3a, 0xe6, 0xbe, 0x2c, 0x1a, 0x07, 0xdc,
|
||||
0xf3, 0xa1, 0x90, 0xf0, 0xc5, 0x7f, 0x25, 0x30, 0xe7, 0x1c, 0x7c, 0xbb, 0x90, 0x37, 0x2c, 0x56,
|
||||
0x52, 0x89, 0x33, 0x29, 0xb0, 0x30, 0xa6, 0x4e, 0x91, 0xeb, 0xd3, 0xfd, 0x39, 0xf7, 0x3c, 0x65,
|
||||
0x70, 0x7f, 0x74, 0xcc, 0xbd, 0x85, 0xe9, 0x05, 0x9c, 0x71, 0x7a, 0x37, 0xa5, 0xf7, 0x47, 0x19,
|
||||
0x35, 0x46, 0x8b, 0x98, 0x71, 0xa0, 0xf8, 0x7b, 0xf4, 0x4c, 0x14, 0x69, 0x6a, 0x73, 0xbb, 0xad,
|
||||
0xbd, 0xd0, 0xfa, 0x07, 0xc3, 0xbe, 0x51, 0xec, 0x5b, 0x34, 0x77, 0x45, 0xc3, 0x8c, 0xe5, 0xc0,
|
||||
0x38, 0x9e, 0xfc, 0x04, 0x0e, 0x3f, 0x02, 0x6e, 0x5b, 0xf8, 0x72, 0xdd, 0x2d, 0x6d, 0xd6, 0x5d,
|
||||
0xb4, 0xf5, 0x91, 0x0c, 0x0d, 0x3b, 0xa8, 0xca, 0x22, 0x70, 0xda, 0x65, 0x89, 0xfa, 0xda, 0x78,
|
||||
0xcc, 0x34, 0x18, 0x4a, 0xe6, 0x49, 0x04, 0x8e, 0xf5, 0x8e, 0xa2, 0xab, 0x0a, 0x8b, 0x48, 0x70,
|
||||
0x3c, 0x47, 0x75, 0xc6, 0x6d, 0x1e, 0xb3, 0x76, 0x45, 0xd2, 0x8c, 0x9e, 0x46, 0x23, 0xa1, 0xac,
|
||||
0x77, 0x15, 0x51, 0x3d, 0xb1, 0x89, 0xa2, 0xe8, 0x5d, 0x57, 0xd0, 0x73, 0x15, 0x39, 0x0a, 0x83,
|
||||
0xa9, 0x27, 0x20, 0xf0, 0x2b, 0x54, 0xe5, 0xab, 0x08, 0x64, 0xf1, 0x9a, 0xd6, 0x47, 0xa9, 0xc6,
|
||||
0xd3, 0x55, 0x04, 0xb7, 0xeb, 0xee, 0xfb, 0x77, 0xe3, 0x85, 0x9f, 0xc8, 0x0c, 0xfc, 0x5d, 0xa6,
|
||||
0xbd, 0x2c, 0x73, 0xbf, 0xce, 0xd3, 0xde, 0xae, 0xbb, 0x0f, 0x4e, 0x82, 0x91, 0x61, 0xe6, 0x65,
|
||||
0x62, 0x17, 0xb5, 0x16, 0x36, 0xe3, 0xdf, 0xd2, 0x70, 0x02, 0xa7, 0x9e, 0x0f, 0xaa, 0x34, 0x9f,
|
||||
0xa4, 0xa5, 0xd9, 0x9d, 0xe1, 0xb4, 0xb3, 0xcc, 0x10, 0x7d, 0x13, 0xfd, 0x15, 0x19, 0xd6, 0x07,
|
||||
0x4a, 0x4a, 0x6b, 0xbc, 0x0b, 0x44, 0xf2, 0xb8, 0x78, 0x89, 0xb0, 0x70, 0x9c, 0x52, 0x3b, 0x60,
|
||||
0xc9, 0xe3, 0x04, 0x5b, 0xf5, 0xad, 0xd9, 0x3a, 0x8a, 0x0d, 0x8f, 0x0b, 0x68, 0xe4, 0x1e, 0x06,
|
||||
0xfc, 0x31, 0xaa, 0x53, 0xb0, 0x59, 0x18, 0xb4, 0x6b, 0xb2, 0x70, 0x59, 0xbf, 0x88, 0xf4, 0x12,
|
||||
0xf5, 0x17, 0xbf, 0x44, 0x0d, 0x1f, 0x18, 0xb3, 0x5d, 0x68, 0xd7, 0x65, 0xe0, 0x7b, 0x2a, 0xb0,
|
||||
0x71, 0x94, 0xb8, 0x49, 0xfa, 0xbf, 0xf7, 0xa7, 0x86, 0x0e, 0x54, 0xab, 0xc6, 0x1e, 0xe3, 0xf8,
|
||||
0x87, 0xc2, 0x5a, 0x18, 0xff, 0xef, 0x41, 0x22, 0x5b, 0x2e, 0xc7, 0x73, 0xc5, 0xf5, 0x2c, 0xf5,
|
||||
0xec, 0xac, 0xc6, 0x04, 0xd5, 0x3c, 0x0e, 0xbe, 0x68, 0x7c, 0xa5, 0x7f, 0x30, 0xfc, 0xea, 0x49,
|
||||
0x43, 0x6b, 0xb5, 0x14, 0x53, 0xed, 0x50, 0x60, 0x92, 0x04, 0xba, 0xf7, 0x5b, 0x39, 0x7b, 0x91,
|
||||
0xd8, 0x17, 0xfc, 0xbb, 0x86, 0x3a, 0x0c, 0xe8, 0x12, 0xe8, 0xeb, 0xe9, 0x94, 0x02, 0x63, 0xd6,
|
||||
0x6a, 0xb4, 0xf0, 0x20, 0xe0, 0xa3, 0xc3, 0x37, 0x84, 0xb5, 0x35, 0xa9, 0xe4, 0xf8, 0x71, 0x4a,
|
||||
0x4e, 0xf6, 0xe1, 0x5a, 0x3d, 0xa5, 0xad, 0xb3, 0x37, 0x84, 0x91, 0x07, 0x64, 0xe1, 0x1f, 0x51,
|
||||
0x93, 0x81, 0x43, 0x81, 0x13, 0x98, 0xa9, 0x4b, 0x32, 0x7c, 0xf8, 0x3e, 0x8d, 0x43, 0xc7, 0x5e,
|
||||
0x24, 0x07, 0x89, 0xc0, 0x0c, 0x28, 0x04, 0x0e, 0x58, 0xad, 0xcd, 0xba, 0xdb, 0x3c, 0x49, 0x81,
|
||||
0xc8, 0x16, 0xb3, 0xf7, 0x97, 0x86, 0x5a, 0xb9, 0xed, 0xc7, 0x17, 0x08, 0x39, 0xe9, 0x66, 0xa5,
|
||||
0x75, 0xf9, 0xe6, 0x49, 0x1d, 0xca, 0x16, 0x75, 0x7b, 0x31, 0x33, 0x17, 0x23, 0x3b, 0x6c, 0xb8,
|
||||
0x8b, 0x6a, 0x17, 0x61, 0x00, 0xac, 0x5d, 0x7b, 0x51, 0xe9, 0x37, 0xad, 0xa6, 0xe8, 0xea, 0x99,
|
||||
0x70, 0x90, 0xc4, 0x9f, 0x8c, 0xbe, 0xeb, 0x85, 0x81, 0x9a, 0xe8, 0x9d, 0xd1, 0x17, 0x5e, 0xa2,
|
||||
0xfe, 0xf6, 0x7e, 0xd1, 0xd0, 0x87, 0x7b, 0x4b, 0x8e, 0x87, 0x08, 0x39, 0x99, 0xa5, 0x2e, 0xd7,
|
||||
0x56, 0x5a, 0xf6, 0x87, 0xec, 0x44, 0xe1, 0x2f, 0x51, 0x2b, 0xd7, 0x27, 0x75, 0xb4, 0xb2, 0x4b,
|
||||
0x91, 0x63, 0x23, 0xf9, 0x58, 0xeb, 0xe5, 0xe5, 0x8d, 0x5e, 0xba, 0xba, 0xd1, 0x4b, 0xd7, 0x37,
|
||||
0x7a, 0xe9, 0xe7, 0x8d, 0xae, 0x5d, 0x6e, 0x74, 0xed, 0x6a, 0xa3, 0x6b, 0x7f, 0x6f, 0x74, 0xed,
|
||||
0xd7, 0x7f, 0xf4, 0xd2, 0x59, 0x43, 0xd5, 0xec, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x15, 0xe8,
|
||||
0xc4, 0x9a, 0x7c, 0x08, 0x00, 0x00,
|
||||
// 802 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6b, 0x33, 0x55,
|
||||
0x14, 0xce, 0xe4, 0xb3, 0xb9, 0x35, 0x5a, 0x2e, 0x0a, 0x31, 0x8b, 0x49, 0x09, 0x22, 0xad, 0xe8,
|
||||
0x8c, 0x09, 0x22, 0x05, 0x51, 0xe8, 0xa4, 0x08, 0x85, 0x96, 0xca, 0x6d, 0x71, 0x51, 0x04, 0x9d,
|
||||
0x4c, 0x4e, 0xa6, 0x63, 0x32, 0x1f, 0xdc, 0x7b, 0x27, 0x90, 0xae, 0xfc, 0x01, 0x2e, 0xfc, 0x11,
|
||||
0xfe, 0x03, 0xd7, 0xee, 0xbb, 0xb3, 0x0b, 0x17, 0x5d, 0x05, 0x1b, 0xff, 0x45, 0x57, 0x2f, 0xf7,
|
||||
0xce, 0xcd, 0x24, 0xd3, 0x24, 0x7d, 0xfb, 0xb6, 0xbb, 0x39, 0x67, 0xce, 0x79, 0x9e, 0xe7, 0x9e,
|
||||
0x2f, 0x74, 0x34, 0x3c, 0x60, 0x86, 0x17, 0x9a, 0xc3, 0xb8, 0x07, 0x34, 0x00, 0x0e, 0xcc, 0x1c,
|
||||
0x40, 0x1f, 0xa8, 0xcd, 0xbd, 0x30, 0x30, 0xed, 0xc8, 0xcb, 0xd8, 0xe3, 0x76, 0x0f, 0xb8, 0xdd,
|
||||
0x36, 0x5d, 0x08, 0x84, 0x0b, 0xfa, 0x46, 0x44, 0x43, 0x1e, 0xe2, 0xaf, 0x12, 0x14, 0x63, 0x81,
|
||||
0x62, 0x2c, 0xb2, 0x0c, 0x81, 0xb2, 0x6c, 0x2b, 0x94, 0xc6, 0x17, 0xae, 0xc7, 0xaf, 0xe2, 0x9e,
|
||||
0xe1, 0x84, 0xbe, 0xe9, 0x86, 0x6e, 0x68, 0x4a, 0xb0, 0x5e, 0x3c, 0x90, 0x96, 0x34, 0xe4, 0x57,
|
||||
0x42, 0xd2, 0x50, 0x24, 0x42, 0x94, 0x6f, 0x3b, 0x57, 0x5e, 0x00, 0x74, 0x62, 0x46, 0x43, 0x37,
|
||||
0x51, 0xe9, 0x03, 0xb7, 0xcd, 0xf1, 0x8a, 0xb4, 0x86, 0xb9, 0x29, 0x8b, 0xc6, 0x01, 0xf7, 0x7c,
|
||||
0x58, 0x49, 0xf8, 0xfa, 0x6d, 0x09, 0xcc, 0xb9, 0x02, 0xdf, 0x5e, 0xc9, 0xeb, 0xac, 0x56, 0x52,
|
||||
0x89, 0x33, 0x29, 0xb0, 0x30, 0xa6, 0xce, 0x2a, 0xd7, 0xe7, 0x9b, 0x73, 0xd6, 0x3c, 0xa5, 0xbd,
|
||||
0x3e, 0x3a, 0xe6, 0xde, 0xc8, 0xf4, 0x02, 0xce, 0x38, 0x7d, 0x9c, 0xd2, 0xfa, 0x3b, 0x8f, 0x2a,
|
||||
0xdd, 0x51, 0xcc, 0x38, 0x50, 0xfc, 0x0b, 0xda, 0x12, 0x45, 0xea, 0xdb, 0xdc, 0xae, 0x6b, 0xbb,
|
||||
0xda, 0xde, 0x76, 0xe7, 0x4b, 0x43, 0xf5, 0x6d, 0xf9, 0xad, 0x46, 0x34, 0x74, 0x93, 0x96, 0x89,
|
||||
0x68, 0x63, 0xdc, 0x36, 0xce, 0x7a, 0xbf, 0x82, 0xc3, 0x4f, 0x81, 0xdb, 0x16, 0xbe, 0x99, 0x36,
|
||||
0x73, 0xb3, 0x69, 0x13, 0x2d, 0x7c, 0x24, 0x45, 0xc5, 0x0e, 0x2a, 0xb2, 0x08, 0x9c, 0x7a, 0x5e,
|
||||
0xa2, 0x1f, 0x1a, 0x2f, 0x99, 0x0a, 0x43, 0xc9, 0x3d, 0x8f, 0xc0, 0xb1, 0xde, 0x53, 0x74, 0x45,
|
||||
0x61, 0x11, 0x09, 0x8e, 0x87, 0xa8, 0xcc, 0xb8, 0xcd, 0x63, 0x56, 0x2f, 0x48, 0x9a, 0xee, 0xeb,
|
||||
0x68, 0x24, 0x94, 0xf5, 0xbe, 0x22, 0x2a, 0x27, 0x36, 0x51, 0x14, 0xad, 0xbb, 0x02, 0xda, 0x51,
|
||||
0x91, 0xdd, 0x30, 0xe8, 0x7b, 0x02, 0x02, 0x1f, 0xa0, 0x22, 0x9f, 0x44, 0x20, 0x8b, 0x58, 0xb5,
|
||||
0x3e, 0x99, 0x6b, 0xbc, 0x98, 0x44, 0xf0, 0x30, 0x6d, 0x7e, 0xf8, 0x38, 0x5e, 0xf8, 0x89, 0xcc,
|
||||
0xc0, 0x3f, 0xa6, 0xda, 0xf3, 0x32, 0xf7, 0xbb, 0x2c, 0xed, 0xc3, 0xb4, 0xf9, 0xe4, 0x44, 0x18,
|
||||
0x29, 0x66, 0x56, 0x26, 0x76, 0x51, 0x6d, 0x64, 0x33, 0xfe, 0x03, 0x0d, 0x7b, 0x70, 0xe1, 0xf9,
|
||||
0xa0, 0x4a, 0xf3, 0xd9, 0xf3, 0xfa, 0x2b, 0x32, 0xac, 0x8f, 0x94, 0x94, 0xda, 0xc9, 0x32, 0x10,
|
||||
0xc9, 0xe2, 0xe2, 0x31, 0xc2, 0xc2, 0x71, 0x41, 0xed, 0x80, 0x25, 0x8f, 0x13, 0x6c, 0xc5, 0x77,
|
||||
0x66, 0x6b, 0x28, 0x36, 0x7c, 0xb2, 0x82, 0x46, 0xd6, 0x30, 0xe0, 0x4f, 0x51, 0x99, 0x82, 0xcd,
|
||||
0xc2, 0xa0, 0x5e, 0x92, 0x85, 0x4b, 0xfb, 0x45, 0xa4, 0x97, 0xa8, 0xbf, 0x78, 0x1f, 0x55, 0x7c,
|
||||
0x60, 0xcc, 0x76, 0xa1, 0x5e, 0x96, 0x81, 0x1f, 0xa8, 0xc0, 0xca, 0x69, 0xe2, 0x26, 0xf3, 0xff,
|
||||
0xad, 0x7f, 0x34, 0xb4, 0xad, 0x5a, 0x75, 0xe2, 0x31, 0x8e, 0x7f, 0x5a, 0x59, 0x0f, 0xe3, 0x79,
|
||||
0x0f, 0x12, 0xd9, 0x72, 0x39, 0x76, 0x14, 0xd7, 0xd6, 0xdc, 0xb3, 0xb4, 0x1a, 0x3d, 0x54, 0xf2,
|
||||
0x38, 0xf8, 0xa2, 0xf1, 0x85, 0xbd, 0xed, 0xce, 0xb7, 0xaf, 0x1a, 0x5a, 0xab, 0xa6, 0x98, 0x4a,
|
||||
0xc7, 0x02, 0x93, 0x24, 0xd0, 0xad, 0x3f, 0xf3, 0xe9, 0x8b, 0xc4, 0xbe, 0xe0, 0xbf, 0x34, 0xd4,
|
||||
0x60, 0x40, 0xc7, 0x40, 0x0f, 0xfb, 0x7d, 0x0a, 0x8c, 0x59, 0x93, 0xee, 0xc8, 0x83, 0x80, 0x77,
|
||||
0x8f, 0x8f, 0x08, 0xab, 0x6b, 0x52, 0xc9, 0xd9, 0xcb, 0x94, 0x9c, 0x6f, 0xc2, 0xb5, 0x5a, 0x4a,
|
||||
0x5b, 0x63, 0x63, 0x08, 0x23, 0x4f, 0xc8, 0xc2, 0x3f, 0xa3, 0x2a, 0x03, 0x87, 0x02, 0x27, 0x30,
|
||||
0x50, 0x97, 0xa4, 0xb3, 0x46, 0xa3, 0x6a, 0x83, 0x6c, 0x40, 0xe8, 0xd8, 0xa3, 0xe4, 0x20, 0x11,
|
||||
0x18, 0x00, 0x85, 0xc0, 0x01, 0xab, 0x36, 0x9b, 0x36, 0xab, 0xe7, 0x73, 0x20, 0xb2, 0xc0, 0x6c,
|
||||
0xfd, 0xab, 0xa1, 0x5a, 0x66, 0xfb, 0xf1, 0x35, 0x42, 0xce, 0x7c, 0xb3, 0xe6, 0x75, 0xf9, 0xfe,
|
||||
0x55, 0x1d, 0x4a, 0x17, 0x75, 0x71, 0x31, 0x53, 0x17, 0x23, 0x4b, 0x6c, 0xb8, 0x89, 0x4a, 0xd7,
|
||||
0x61, 0x00, 0xac, 0x5e, 0xda, 0x2d, 0xec, 0x55, 0xad, 0xaa, 0xe8, 0xea, 0xa5, 0x70, 0x90, 0xc4,
|
||||
0x9f, 0x8c, 0xbe, 0xeb, 0x85, 0x81, 0x9a, 0xe8, 0xa5, 0xd1, 0x17, 0x5e, 0xa2, 0xfe, 0xb6, 0x7e,
|
||||
0xd7, 0xd0, 0xc7, 0x1b, 0x4b, 0x8e, 0x3b, 0x08, 0x39, 0xa9, 0xa5, 0x2e, 0xd7, 0x42, 0x5a, 0xfa,
|
||||
0x87, 0x2c, 0x45, 0xe1, 0x6f, 0x50, 0x2d, 0xd3, 0x27, 0x75, 0xb4, 0xd2, 0x4b, 0x91, 0x61, 0x23,
|
||||
0xd9, 0x58, 0x6b, 0xff, 0xe6, 0x5e, 0xcf, 0xdd, 0xde, 0xeb, 0xb9, 0xbb, 0x7b, 0x3d, 0xf7, 0xdb,
|
||||
0x4c, 0xd7, 0x6e, 0x66, 0xba, 0x76, 0x3b, 0xd3, 0xb5, 0xff, 0x66, 0xba, 0xf6, 0xc7, 0xff, 0x7a,
|
||||
0xee, 0xb2, 0xa2, 0x6a, 0xf6, 0x26, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x52, 0x01, 0x24, 0x84, 0x08,
|
||||
0x00, 0x00,
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ message Cluster {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// +optional
|
||||
|
@ -1441,7 +1441,13 @@ func (x *Cluster) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
z.EncSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if yyq2[2] {
|
||||
yy10 := &x.ObjectMeta
|
||||
yy10.CodecEncodeSelf(e)
|
||||
yym11 := z.EncBinary()
|
||||
_ = yym11
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.EncExt(yy10) {
|
||||
} else {
|
||||
z.EncFallback(yy10)
|
||||
}
|
||||
} else {
|
||||
r.EncodeNil()
|
||||
}
|
||||
@ -1451,7 +1457,13 @@ func (x *Cluster) CodecEncodeSelf(e *codec1978.Encoder) {
|
||||
r.EncodeString(codecSelferC_UTF81234, string("metadata"))
|
||||
z.EncSendContainerState(codecSelfer_containerMapValue1234)
|
||||
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 {
|
||||
@ -1575,24 +1587,30 @@ func (x *Cluster) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
|
||||
}
|
||||
case "metadata":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ObjectMeta = pkg1_v1.ObjectMeta{}
|
||||
x.ObjectMeta = pkg2_v1.ObjectMeta{}
|
||||
} else {
|
||||
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":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = ClusterSpec{}
|
||||
} else {
|
||||
yyv9 := &x.Spec
|
||||
yyv9.CodecDecodeSelf(d)
|
||||
yyv10 := &x.Spec
|
||||
yyv10.CodecDecodeSelf(d)
|
||||
}
|
||||
case "status":
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = ClusterStatus{}
|
||||
} else {
|
||||
yyv10 := &x.Status
|
||||
yyv10.CodecDecodeSelf(d)
|
||||
yyv11 := &x.Status
|
||||
yyv11.CodecDecodeSelf(d)
|
||||
}
|
||||
default:
|
||||
z.DecStructFieldNotFound(-1, yys3)
|
||||
@ -1605,16 +1623,16 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
var h codecSelfer1234
|
||||
z, r := codec1978.GenHelperDecoder(d)
|
||||
_, _, _ = h, z, r
|
||||
var yyj11 int
|
||||
var yyb11 bool
|
||||
var yyhl11 bool = l >= 0
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
var yyj12 int
|
||||
var yyb12 bool
|
||||
var yyhl12 bool = l >= 0
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1622,21 +1640,21 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Kind = ""
|
||||
} else {
|
||||
yyv12 := &x.Kind
|
||||
yym13 := z.DecBinary()
|
||||
_ = yym13
|
||||
yyv13 := &x.Kind
|
||||
yym14 := z.DecBinary()
|
||||
_ = yym14
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv12)) = r.DecodeString()
|
||||
*((*string)(yyv13)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1644,38 +1662,44 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.APIVersion = ""
|
||||
} else {
|
||||
yyv14 := &x.APIVersion
|
||||
yym15 := z.DecBinary()
|
||||
_ = yym15
|
||||
yyv15 := &x.APIVersion
|
||||
yym16 := z.DecBinary()
|
||||
_ = yym16
|
||||
if false {
|
||||
} else {
|
||||
*((*string)(yyv14)) = r.DecodeString()
|
||||
*((*string)(yyv15)) = r.DecodeString()
|
||||
}
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
if r.TryDecodeAsNil() {
|
||||
x.ObjectMeta = pkg1_v1.ObjectMeta{}
|
||||
x.ObjectMeta = pkg2_v1.ObjectMeta{}
|
||||
} else {
|
||||
yyv16 := &x.ObjectMeta
|
||||
yyv16.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyv17 := &x.ObjectMeta
|
||||
yym18 := z.DecBinary()
|
||||
_ = yym18
|
||||
if false {
|
||||
} else if z.HasExtensions() && z.DecExt(yyv17) {
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
z.DecFallback(yyv17, false)
|
||||
}
|
||||
if yyb11 {
|
||||
}
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1683,16 +1707,16 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Spec = ClusterSpec{}
|
||||
} else {
|
||||
yyv17 := &x.Spec
|
||||
yyv17.CodecDecodeSelf(d)
|
||||
yyv19 := &x.Spec
|
||||
yyv19.CodecDecodeSelf(d)
|
||||
}
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
return
|
||||
}
|
||||
@ -1700,21 +1724,21 @@ func (x *Cluster) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
|
||||
if r.TryDecodeAsNil() {
|
||||
x.Status = ClusterStatus{}
|
||||
} else {
|
||||
yyv18 := &x.Status
|
||||
yyv18.CodecDecodeSelf(d)
|
||||
yyv20 := &x.Status
|
||||
yyv20.CodecDecodeSelf(d)
|
||||
}
|
||||
for {
|
||||
yyj11++
|
||||
if yyhl11 {
|
||||
yyb11 = yyj11 > l
|
||||
yyj12++
|
||||
if yyhl12 {
|
||||
yyb12 = yyj12 > l
|
||||
} else {
|
||||
yyb11 = r.CheckBreak()
|
||||
yyb12 = r.CheckBreak()
|
||||
}
|
||||
if yyb11 {
|
||||
if yyb12 {
|
||||
break
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayElem1234)
|
||||
z.DecStructFieldNotFound(yyj11-1, "")
|
||||
z.DecStructFieldNotFound(yyj12-1, "")
|
||||
}
|
||||
z.DecSendContainerState(codecSelfer_containerArrayEnd1234)
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ type Cluster struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// +optional
|
||||
|
@ -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 {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta1_ClusterSpec_To_federation_ClusterSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
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 {
|
||||
// TODO: Inefficient conversion - can we improve it?
|
||||
if err := s.Convert(&in.ObjectMeta, &out.ObjectMeta, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_federation_ClusterSpec_To_v1beta1_ClusterSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -21,9 +21,10 @@ limitations under the License.
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
api_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
reflect "reflect"
|
||||
)
|
||||
|
||||
@ -49,8 +50,10 @@ func DeepCopy_v1beta1_Cluster(in interface{}, out interface{}, c *conversion.Clo
|
||||
in := in.(*Cluster)
|
||||
out := out.(*Cluster)
|
||||
*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
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
if err := DeepCopy_v1beta1_ClusterSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
@ -105,7 +108,7 @@ func DeepCopy_v1beta1_ClusterSpec(in interface{}, out interface{}, c *conversion
|
||||
}
|
||||
if in.SecretRef != nil {
|
||||
in, out := &in.SecretRef, &out.SecretRef
|
||||
*out = new(v1.LocalObjectReference)
|
||||
*out = new(api_v1.LocalObjectReference)
|
||||
**out = **in
|
||||
}
|
||||
return nil
|
||||
|
@ -27,6 +27,7 @@ go_test(
|
||||
deps = [
|
||||
"//federation/apis/federation:go_default_library",
|
||||
"//pkg/api:go_default_library",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -19,6 +19,7 @@ package validation
|
||||
import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/federation/apis/federation"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
)
|
||||
@ -26,7 +27,7 @@ import (
|
||||
func TestValidateCluster(t *testing.T) {
|
||||
successCases := []federation.Cluster{
|
||||
{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-s"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -46,15 +47,15 @@ func TestValidateCluster(t *testing.T) {
|
||||
|
||||
errorCases := map[string]federation.Cluster{
|
||||
"missing cluster addresses": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-f"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-f"},
|
||||
},
|
||||
"empty cluster addresses": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-f"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-f"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{},
|
||||
}},
|
||||
"invalid_label": {
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "cluster-f",
|
||||
Labels: map[string]string{
|
||||
"NoUppercaseOrSpecialCharsLike=Equals": "bar",
|
||||
@ -62,7 +63,7 @@ func TestValidateCluster(t *testing.T) {
|
||||
},
|
||||
},
|
||||
"invalid cluster name (is a subdomain)": {
|
||||
ObjectMeta: api.ObjectMeta{Name: "mycluster.mycompany"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "mycluster.mycompany"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -89,7 +90,7 @@ func TestValidateClusterUpdate(t *testing.T) {
|
||||
successCases := []clusterUpdateTest{
|
||||
{
|
||||
old: federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-s"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -100,7 +101,7 @@ func TestValidateClusterUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
update: federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-s"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -124,7 +125,7 @@ func TestValidateClusterUpdate(t *testing.T) {
|
||||
errorCases := map[string]clusterUpdateTest{
|
||||
"cluster name changed": {
|
||||
old: federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-s"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -135,7 +136,7 @@ func TestValidateClusterUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
update: federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-newname"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-newname"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -163,7 +164,7 @@ func TestValidateClusterStatusUpdate(t *testing.T) {
|
||||
successCases := []clusterUpdateTest{
|
||||
{
|
||||
old: federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-s"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
@ -179,7 +180,7 @@ func TestValidateClusterStatusUpdate(t *testing.T) {
|
||||
},
|
||||
},
|
||||
update: federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "cluster-s"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "cluster-s"},
|
||||
Spec: federation.ClusterSpec{
|
||||
ServerAddressByClientCIDRs: []federation.ServerAddressByClientCIDR{
|
||||
{
|
||||
|
@ -21,6 +21,7 @@ limitations under the License.
|
||||
package federation
|
||||
|
||||
import (
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
conversion "k8s.io/apimachinery/pkg/conversion"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
api "k8s.io/kubernetes/pkg/api"
|
||||
@ -51,8 +52,10 @@ func DeepCopy_federation_Cluster(in interface{}, out interface{}, c *conversion.
|
||||
in := in.(*Cluster)
|
||||
out := out.(*Cluster)
|
||||
*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
|
||||
} else {
|
||||
out.ObjectMeta = *newVal.(*v1.ObjectMeta)
|
||||
}
|
||||
if err := DeepCopy_federation_ClusterSpec(&in.Spec, &out.Spec, c); err != nil {
|
||||
return err
|
||||
|
@ -38,7 +38,7 @@ import (
|
||||
func newCluster(clusterName string, serverUrl string) *federationv1beta1.Cluster {
|
||||
cluster := federationv1beta1.Cluster{
|
||||
TypeMeta: metav1.TypeMeta{APIVersion: testapi.Federation.GroupVersion().String()},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
UID: uuid.NewUUID(),
|
||||
Name: clusterName,
|
||||
},
|
||||
|
@ -45,6 +45,7 @@ go_test(
|
||||
"//pkg/client/clientset_generated/clientset:go_default_library",
|
||||
"//pkg/client/clientset_generated/clientset/fake:go_default_library",
|
||||
"//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/types",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@ -78,7 +79,7 @@ func TestConfigMapController(t *testing.T) {
|
||||
configmapController.Run(stop)
|
||||
|
||||
configmap1 := &apiv1.ConfigMap{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-configmap",
|
||||
Namespace: "ns",
|
||||
SelfLink: "/api/v1/namespaces/ns/configmaps/test-configmap",
|
||||
|
@ -82,7 +82,7 @@ func TestDaemonSetController(t *testing.T) {
|
||||
daemonsetController.Run(stop)
|
||||
|
||||
daemonset1 := extensionsv1.DaemonSet{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-daemonset",
|
||||
Namespace: "ns",
|
||||
SelfLink: "/api/v1/namespaces/ns/daemonsets/test-daemonset",
|
||||
|
@ -53,6 +53,7 @@ go_test(
|
||||
"//pkg/client/clientset_generated/clientset/fake:go_default_library",
|
||||
"//vendor:github.com/stretchr/testify/assert",
|
||||
"//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/types",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"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 {
|
||||
return &extensionsv1.Deployment{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: apiv1.NamespaceDefault,
|
||||
SelfLink: "/api/v1/namespaces/default/deployments/name",
|
||||
|
@ -28,6 +28,7 @@ go_library(
|
||||
"//pkg/util/flowcontrol:go_default_library",
|
||||
"//vendor:github.com/golang/glog",
|
||||
"//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/schema",
|
||||
"//vendor:k8s.io/apimachinery/pkg/types",
|
||||
@ -54,6 +55,7 @@ go_test(
|
||||
"//vendor:github.com/golang/glog",
|
||||
"//vendor:github.com/stretchr/testify/assert",
|
||||
"//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/types",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -764,9 +765,9 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
|
||||
if err != nil {
|
||||
glog.Errorf("Error deep copying Spec: %v", err)
|
||||
}
|
||||
objMetaCopy, ok := objMeta.(*v1.ObjectMeta)
|
||||
objMetaCopy, ok := objMeta.(*metav1.ObjectMeta)
|
||||
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
|
||||
objSpecCopy, ok := objSpec.(*extensionsv1beta1.IngressSpec)
|
||||
@ -857,9 +858,9 @@ func (ic *IngressController) reconcileIngress(ingress types.NamespacedName) {
|
||||
glog.Errorf("Error deep copying ObjectMeta: %v", err)
|
||||
ic.deliverIngress(ingress, ic.ingressReviewDelay, true)
|
||||
}
|
||||
objMetaCopy, ok := objMeta.(*v1.ObjectMeta)
|
||||
objMetaCopy, ok := objMeta.(*metav1.ObjectMeta)
|
||||
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)
|
||||
}
|
||||
desiredIngress.ObjectMeta = *objMetaCopy
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@ -108,7 +109,7 @@ func TestIngressController(t *testing.T) {
|
||||
// Add another test without that annotation when
|
||||
// https://github.com/kubernetes/kubernetes/issues/36540 is fixed.
|
||||
fedIngress := extensionsv1beta1.Ingress{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-ingress",
|
||||
Namespace: "mynamespace",
|
||||
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 {
|
||||
return &apiv1.ConfigMap{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: uidConfigMapName,
|
||||
Namespace: uidConfigMapNamespace,
|
||||
SelfLink: "/api/v1/namespaces/" + uidConfigMapNamespace + "/configmap/" + uidConfigMapName,
|
||||
|
@ -42,7 +42,7 @@ func TestNamespaceController(t *testing.T) {
|
||||
cluster1 := NewCluster("cluster1", apiv1.ConditionTrue)
|
||||
cluster2 := NewCluster("cluster2", apiv1.ConditionTrue)
|
||||
ns1 := apiv1.Namespace{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "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{
|
||||
{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-rs",
|
||||
Namespace: ns1.Namespace,
|
||||
}}}})
|
||||
RegisterFakeList("secrets", &fakeClient.Fake, &apiv1.SecretList{Items: []apiv1.Secret{
|
||||
{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-secret",
|
||||
Namespace: ns1.Namespace,
|
||||
}}}})
|
||||
RegisterFakeList("services", &fakeClient.Fake, &apiv1.ServiceList{Items: []apiv1.Service{
|
||||
{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-service",
|
||||
Namespace: ns1.Namespace,
|
||||
}}}})
|
||||
|
@ -182,7 +182,7 @@ func TestReplicaSetController(t *testing.T) {
|
||||
|
||||
func newReplicaSetWithReplicas(name string, replicas int32) *extensionsv1.ReplicaSet {
|
||||
return &extensionsv1.ReplicaSet{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: apiv1.NamespaceDefault,
|
||||
SelfLink: "/api/v1/namespaces/default/replicasets/name",
|
||||
|
@ -49,6 +49,7 @@ go_test(
|
||||
"//pkg/client/clientset_generated/clientset/fake:go_default_library",
|
||||
"//vendor:github.com/golang/glog",
|
||||
"//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/types",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
|
@ -22,6 +22,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@ -82,7 +83,7 @@ func TestSecretController(t *testing.T) {
|
||||
secretController.Run(stop)
|
||||
|
||||
secret1 := apiv1.Secret{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-secret",
|
||||
Namespace: "ns",
|
||||
SelfLink: "/api/v1/namespaces/ns/secrets/test-secret",
|
||||
|
@ -61,6 +61,7 @@ go_test(
|
||||
"//federation/apis/federation/v1beta1:go_default_library",
|
||||
"//federation/pkg/dnsprovider/providers/google/clouddns:go_default_library",
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/sets",
|
||||
],
|
||||
)
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"reflect"
|
||||
"sort"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/kubernetes/federation/apis/federation/v1beta1"
|
||||
"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",
|
||||
service: v1.Service{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "servicename",
|
||||
Namespace: "servicenamespace",
|
||||
},
|
||||
@ -58,7 +59,7 @@ func TestServiceController_ensureDnsRecords(t *testing.T) {
|
||||
{
|
||||
name: "withname",
|
||||
service: v1.Service{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "servicename",
|
||||
Namespace: "servicenamespace",
|
||||
},
|
||||
@ -74,7 +75,7 @@ func TestServiceController_ensureDnsRecords(t *testing.T) {
|
||||
{
|
||||
name: "noendpoints",
|
||||
service: v1.Service{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "servicename",
|
||||
Namespace: "servicenamespace",
|
||||
},
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/kubernetes/pkg/api/v1"
|
||||
)
|
||||
|
||||
@ -74,7 +75,7 @@ func TestProcessServiceUpdate(t *testing.T) {
|
||||
"diff-cluster",
|
||||
&cachedService{
|
||||
lastState: &v1.Service{
|
||||
ObjectMeta: v1.ObjectMeta{Name: "bar1"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "bar1"},
|
||||
},
|
||||
serviceStatusMap: map[string]v1.LoadBalancerStatus{
|
||||
"foo2": {Ingress: []v1.LoadBalancerIngress{{IP: "ip1", Hostname: ""}}},
|
||||
|
@ -70,6 +70,7 @@ go_test(
|
||||
"//pkg/client/testing/core:go_default_library",
|
||||
"//pkg/controller/deployment/util:go_default_library",
|
||||
"//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/watch",
|
||||
],
|
||||
|
@ -19,7 +19,7 @@ package util
|
||||
import (
|
||||
"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"
|
||||
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.
|
||||
func DeepCopyDeploymentObjectMeta(meta api_v1.ObjectMeta) api_v1.ObjectMeta {
|
||||
func DeepCopyDeploymentObjectMeta(meta metav1.ObjectMeta) metav1.ObjectMeta {
|
||||
meta = DeepCopyRelevantObjectMeta(meta)
|
||||
delete(meta.Annotations, deputils.RevisionAnnotation)
|
||||
return meta
|
||||
|
@ -19,6 +19,7 @@ package util
|
||||
import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
apiv1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
extensionsv1 "k8s.io/kubernetes/pkg/apis/extensions/v1beta1"
|
||||
deputils "k8s.io/kubernetes/pkg/controller/deployment/util"
|
||||
@ -58,7 +59,7 @@ func TestDeploymentCopy(t *testing.T) {
|
||||
func newDeployment() *extensionsv1.Deployment {
|
||||
replicas := int32(5)
|
||||
return &extensionsv1.Deployment{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "wrr",
|
||||
Namespace: apiv1.NamespaceDefault,
|
||||
SelfLink: "/api/v1/namespaces/default/deployments/name123",
|
||||
|
@ -31,6 +31,7 @@ go_test(
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/client/testing/core:go_default_library",
|
||||
"//vendor:github.com/stretchr/testify/assert",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/runtime",
|
||||
],
|
||||
)
|
||||
|
@ -19,6 +19,7 @@ package eventsink
|
||||
import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
fakefedclientset "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset/fake"
|
||||
. "k8s.io/kubernetes/federation/pkg/federation-controller/util/test"
|
||||
@ -46,7 +47,7 @@ func TestEventSink(t *testing.T) {
|
||||
})
|
||||
|
||||
event := apiv1.Event{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "bzium",
|
||||
Namespace: "ns",
|
||||
},
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
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.
|
||||
cluster := federationapi.Cluster{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "mycluster",
|
||||
},
|
||||
Status: federationapi.ClusterStatus{
|
||||
@ -65,7 +66,7 @@ func TestFederatedInformer(t *testing.T) {
|
||||
fakeKubeClient := &fakekubeclientset.Clientset{}
|
||||
// There is a single service ns1/s1 in cluster mycluster.
|
||||
service := apiv1.Service{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
},
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
federationapi "k8s.io/kubernetes/federation/apis/federation/v1beta1"
|
||||
apiv1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
@ -136,7 +137,7 @@ func TestFederatedUpdaterTimeout(t *testing.T) {
|
||||
|
||||
func makeService(cluster, name string) *apiv1.Service {
|
||||
return &apiv1.Service{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: name,
|
||||
},
|
||||
|
@ -20,8 +20,8 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
apiv1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
"k8s.io/kubernetes/pkg/client/cache"
|
||||
)
|
||||
|
||||
@ -68,8 +68,8 @@ func NewTriggerOnMetaAndSpecChanges(triggerFunc func(pkgruntime.Object)) *cache.
|
||||
},
|
||||
UpdateFunc: func(old, cur interface{}) {
|
||||
curObj := cur.(pkgruntime.Object)
|
||||
oldMeta := getFieldOrPanic(old, "ObjectMeta").(apiv1.ObjectMeta)
|
||||
curMeta := getFieldOrPanic(cur, "ObjectMeta").(apiv1.ObjectMeta)
|
||||
oldMeta := getFieldOrPanic(old, "ObjectMeta").(metav1.ObjectMeta)
|
||||
curMeta := getFieldOrPanic(cur, "ObjectMeta").(metav1.ObjectMeta)
|
||||
if !ObjectMetaEquivalent(oldMeta, curMeta) ||
|
||||
!reflect.DeepEqual(getFieldOrPanic(old, "Spec"), getFieldOrPanic(cur, "Spec")) {
|
||||
triggerFunc(curObj)
|
||||
|
@ -19,6 +19,7 @@ package util
|
||||
import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
pkgruntime "k8s.io/apimachinery/pkg/runtime"
|
||||
apiv1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
|
||||
@ -28,13 +29,13 @@ import (
|
||||
func TestHandlers(t *testing.T) {
|
||||
// There is a single service ns1/s1 in cluster mycluster.
|
||||
service := apiv1.Service{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
},
|
||||
}
|
||||
service2 := apiv1.Service{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
Annotations: map[string]string{
|
||||
@ -82,7 +83,7 @@ func TestHandlers(t *testing.T) {
|
||||
assert.True(t, triggered())
|
||||
|
||||
service3 := apiv1.Service{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
},
|
||||
|
@ -19,16 +19,16 @@ package util
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"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
|
||||
// the future the ObjectMeta structure is expanded then any field that is not populated
|
||||
// by the api server should be included here.
|
||||
func copyObjectMeta(obj api_v1.ObjectMeta) api_v1.ObjectMeta {
|
||||
return api_v1.ObjectMeta{
|
||||
func copyObjectMeta(obj metav1.ObjectMeta) metav1.ObjectMeta {
|
||||
return metav1.ObjectMeta{
|
||||
Name: obj.Name,
|
||||
Namespace: obj.Namespace,
|
||||
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
|
||||
// the future the ObjectMeta structure is expanded then any field that is not populated
|
||||
// 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)
|
||||
if obj.Labels != nil {
|
||||
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
|
||||
// the future the ObjectMeta structure is expanded then any field that is not populated
|
||||
// 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 {
|
||||
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
|
||||
// level api objects are equivalent.
|
||||
func ObjectMetaAndSpecEquivalent(a, b runtime.Object) bool {
|
||||
objectMetaA := reflect.ValueOf(a).Elem().FieldByName("ObjectMeta").Interface().(api_v1.ObjectMeta)
|
||||
objectMetaB := reflect.ValueOf(b).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().(metav1.ObjectMeta)
|
||||
specA := reflect.ValueOf(a).Elem().FieldByName("Spec").Interface()
|
||||
specB := reflect.ValueOf(b).Elem().FieldByName("Spec").Interface()
|
||||
return ObjectMetaEquivalent(objectMetaA, objectMetaB) && reflect.DeepEqual(specA, specB)
|
||||
|
@ -19,51 +19,52 @@ package util
|
||||
import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
api_v1 "k8s.io/kubernetes/pkg/api/v1"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestObjectMeta(t *testing.T) {
|
||||
o1 := api_v1.ObjectMeta{
|
||||
o1 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
UID: "1231231412",
|
||||
ResourceVersion: "999",
|
||||
}
|
||||
o2 := copyObjectMeta(o1)
|
||||
o3 := api_v1.ObjectMeta{
|
||||
o3 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
UID: "1231231412",
|
||||
Annotations: map[string]string{"A": "B"},
|
||||
}
|
||||
o4 := api_v1.ObjectMeta{
|
||||
o4 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
UID: "1231255531412",
|
||||
Annotations: map[string]string{"A": "B"},
|
||||
}
|
||||
o5 := api_v1.ObjectMeta{
|
||||
o5 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
ResourceVersion: "1231231412",
|
||||
Annotations: map[string]string{"A": "B"},
|
||||
}
|
||||
o6 := api_v1.ObjectMeta{
|
||||
o6 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
ResourceVersion: "1231255531412",
|
||||
Annotations: map[string]string{"A": "B"},
|
||||
}
|
||||
o7 := api_v1.ObjectMeta{
|
||||
o7 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
ResourceVersion: "1231255531412",
|
||||
Annotations: map[string]string{},
|
||||
Labels: map[string]string{},
|
||||
}
|
||||
o8 := api_v1.ObjectMeta{
|
||||
o8 := metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
ResourceVersion: "1231255531412",
|
||||
@ -82,7 +83,7 @@ func TestObjectMeta(t *testing.T) {
|
||||
|
||||
func TestObjectMetaAndSpec(t *testing.T) {
|
||||
s1 := api_v1.Service{
|
||||
ObjectMeta: api_v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
},
|
||||
@ -92,7 +93,7 @@ func TestObjectMetaAndSpec(t *testing.T) {
|
||||
}
|
||||
s1b := s1
|
||||
s2 := api_v1.Service{
|
||||
ObjectMeta: api_v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s2",
|
||||
},
|
||||
@ -101,7 +102,7 @@ func TestObjectMetaAndSpec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
s3 := api_v1.Service{
|
||||
ObjectMeta: api_v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "ns1",
|
||||
Name: "s1",
|
||||
},
|
||||
|
@ -95,7 +95,7 @@ func TestAnalyze(t *testing.T) {
|
||||
func newReplicaSet(selectorMap map[string]string) *v1beta1.ReplicaSet {
|
||||
replicas := int32(3)
|
||||
rs := &v1beta1.ReplicaSet{
|
||||
ObjectMeta: api_v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foobar",
|
||||
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 {
|
||||
return &api_v1.Pod{
|
||||
ObjectMeta: api_v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: rs.Namespace,
|
||||
Labels: rs.Spec.Selector.MatchLabels,
|
||||
|
@ -18,6 +18,7 @@ go_library(
|
||||
"//pkg/api/v1:go_default_library",
|
||||
"//pkg/client/testing/core:go_default_library",
|
||||
"//vendor:github.com/golang/glog",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
"//vendor:k8s.io/apimachinery/pkg/runtime",
|
||||
"//vendor:k8s.io/apimachinery/pkg/util/wait",
|
||||
"//vendor:k8s.io/apimachinery/pkg/watch",
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"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.
|
||||
func CompareObjectMeta(a, b apiv1.ObjectMeta) error {
|
||||
func CompareObjectMeta(a, b metav1.ObjectMeta) error {
|
||||
if 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.
|
||||
func NewCluster(name string, readyStatus apiv1.ConditionStatus) *federationapi.Cluster {
|
||||
return &federationapi.Cluster{
|
||||
ObjectMeta: apiv1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Annotations: map[string]string{},
|
||||
},
|
||||
|
@ -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) {
|
||||
ns := &api.Namespace{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
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) {
|
||||
svc := &api.Service{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
Namespace: namespace,
|
||||
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) {
|
||||
// Build the secret object with API server credentials.
|
||||
secret := &api.Secret{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: credentialsName,
|
||||
Namespace: namespace,
|
||||
},
|
||||
@ -391,7 +391,7 @@ func createPVC(clientset *client.Clientset, namespace, svcName, etcdPVCapacity s
|
||||
}
|
||||
|
||||
pvc := &api.PersistentVolumeClaim{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: fmt.Sprintf("%s-etcd-claim", svcName),
|
||||
Namespace: namespace,
|
||||
Labels: componentLabel,
|
||||
@ -438,7 +438,7 @@ func createAPIServer(clientset *client.Clientset, namespace, name, image, creden
|
||||
dataVolumeName := "etcddata"
|
||||
|
||||
dep := &extensions.Deployment{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
Labels: componentLabel,
|
||||
@ -446,7 +446,7 @@ func createAPIServer(clientset *client.Clientset, namespace, name, image, creden
|
||||
Spec: extensions.DeploymentSpec{
|
||||
Replicas: 1,
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
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) {
|
||||
dep := &extensions.Deployment{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cmName,
|
||||
Namespace: namespace,
|
||||
Labels: componentLabel,
|
||||
@ -530,7 +530,7 @@ func createControllerManager(clientset *client.Clientset, namespace, name, svcNa
|
||||
Spec: extensions.DeploymentSpec{
|
||||
Replicas: 1,
|
||||
Template: api.PodTemplateSpec{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cmName,
|
||||
Labels: controllerManagerPodLabels,
|
||||
},
|
||||
|
@ -465,7 +465,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Namespace",
|
||||
APIVersion: testapi.Default.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: namespaceName,
|
||||
},
|
||||
}
|
||||
@ -475,7 +475,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Service",
|
||||
APIVersion: testapi.Default.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: namespaceName,
|
||||
Name: svcName,
|
||||
Labels: componentLabel,
|
||||
@ -510,7 +510,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Secret",
|
||||
APIVersion: testapi.Default.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: credSecretName,
|
||||
Namespace: namespaceName,
|
||||
},
|
||||
@ -522,7 +522,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Secret",
|
||||
APIVersion: testapi.Default.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cmKubeconfigSecretName,
|
||||
Namespace: namespaceName,
|
||||
},
|
||||
@ -534,7 +534,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "PersistentVolumeClaim",
|
||||
APIVersion: testapi.Default.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: pvcName,
|
||||
Namespace: namespaceName,
|
||||
Labels: componentLabel,
|
||||
@ -559,7 +559,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Deployment",
|
||||
APIVersion: testapi.Extensions.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
Namespace: namespaceName,
|
||||
Labels: componentLabel,
|
||||
@ -568,7 +568,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Replicas: &replicas,
|
||||
Selector: nil,
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
Labels: apiserverPodLabels,
|
||||
},
|
||||
@ -652,7 +652,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Deployment",
|
||||
APIVersion: testapi.Extensions.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cmName,
|
||||
Namespace: namespaceName,
|
||||
Labels: componentLabel,
|
||||
@ -661,7 +661,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Replicas: &replicas,
|
||||
Selector: nil,
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cmName,
|
||||
Labels: controllerManagerPodLabels,
|
||||
},
|
||||
@ -720,7 +720,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Pod",
|
||||
APIVersion: testapi.Extensions.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: svcName,
|
||||
Namespace: namespaceName,
|
||||
},
|
||||
@ -734,7 +734,7 @@ func fakeInitHostFactory(federationName, namespaceName, ip, dnsZoneName, image,
|
||||
Kind: "Pod",
|
||||
APIVersion: testapi.Extensions.GroupVersion().String(),
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: cmName,
|
||||
Namespace: namespaceName,
|
||||
},
|
||||
|
@ -237,7 +237,7 @@ func fakeJoinHostFactory(clusterName, clusterCtx, secretName, server, token stri
|
||||
Kind: "Secret",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: secretName,
|
||||
Namespace: util.DefaultFederationSystemNamespace,
|
||||
},
|
||||
@ -277,7 +277,7 @@ func fakeJoinHostFactory(clusterName, clusterCtx, secretName, server, token stri
|
||||
|
||||
func fakeCluster(clusterName, secretName, server string) federationapi.Cluster {
|
||||
return federationapi.Cluster{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: clusterName,
|
||||
},
|
||||
Spec: federationapi.ClusterSpec{
|
||||
|
@ -20,6 +20,7 @@ go_library(
|
||||
"//pkg/kubectl/cmd:go_default_library",
|
||||
"//pkg/kubectl/cmd/util:go_default_library",
|
||||
"//vendor:github.com/spf13/cobra",
|
||||
"//vendor:k8s.io/apimachinery/pkg/apis/meta/v1",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||
package util
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
fedclient "k8s.io/kubernetes/federation/client/clientset_generated/federation_clientset"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
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
|
||||
// kubeconfig content.
|
||||
secret := &api.Secret{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: name,
|
||||
Namespace: namespace,
|
||||
},
|
||||
|
@ -43,6 +43,7 @@ go_test(
|
||||
"//pkg/api:go_default_library",
|
||||
"//pkg/api/testing: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/apiserver/pkg/request",
|
||||
],
|
||||
|
@ -35,6 +35,7 @@ go_test(
|
||||
"//pkg/registry/generic:go_default_library",
|
||||
"//pkg/registry/registrytest: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/runtime",
|
||||
],
|
||||
|
@ -19,6 +19,7 @@ package etcd
|
||||
import (
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/kubernetes/federation/apis/federation"
|
||||
@ -43,7 +44,7 @@ func newStorage(t *testing.T) (*REST, *etcdtesting.EtcdTestServer) {
|
||||
|
||||
func validNewCluster() *federation.Cluster {
|
||||
return &federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
Labels: map[string]string{
|
||||
"name": "foo",
|
||||
@ -70,11 +71,11 @@ func TestCreate(t *testing.T) {
|
||||
defer server.Terminate(t)
|
||||
test := registrytest.New(t, storage.Store).ClusterScope()
|
||||
cluster := validNewCluster()
|
||||
cluster.ObjectMeta = api.ObjectMeta{GenerateName: "foo"}
|
||||
cluster.ObjectMeta = metav1.ObjectMeta{GenerateName: "foo"}
|
||||
test.TestCreate(
|
||||
cluster,
|
||||
&federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{Name: "-a123-a_"},
|
||||
ObjectMeta: metav1.ObjectMeta{Name: "-a123-a_"},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
|
||||
"reflect"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
genericapirequest "k8s.io/apiserver/pkg/request"
|
||||
"k8s.io/kubernetes/federation/apis/federation"
|
||||
@ -31,7 +32,7 @@ import (
|
||||
|
||||
func validNewCluster() *federation.Cluster {
|
||||
return &federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
ResourceVersion: "4",
|
||||
Labels: map[string]string{
|
||||
@ -57,7 +58,7 @@ func validNewCluster() *federation.Cluster {
|
||||
func invalidNewCluster() *federation.Cluster {
|
||||
// Create a cluster with empty ServerAddressByClientCIDRs (which is a required field).
|
||||
return &federation.Cluster{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo2",
|
||||
ResourceVersion: "5",
|
||||
},
|
||||
|
@ -324,6 +324,9 @@ kube::util::group-version-to-pkg-path() {
|
||||
meta/v1)
|
||||
echo "vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
;;
|
||||
meta/v1)
|
||||
echo "../vendor/k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
;;
|
||||
unversioned)
|
||||
echo "pkg/api/unversioned"
|
||||
;;
|
||||
|
@ -41,7 +41,7 @@ var benchmarkPod api.Pod = api.Pod{
|
||||
Kind: "Pod",
|
||||
APIVersion: "v1",
|
||||
},
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "etcd-server-e2e-test-wojtekt-master",
|
||||
Namespace: "default",
|
||||
SelfLink: "/api/v1/namespaces/default/pods/etcd-server-e2e-test-wojtekt-master",
|
||||
|
@ -24,6 +24,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/conversion"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
@ -33,8 +35,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
)
|
||||
|
||||
// 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.
|
||||
func SingleObject(meta ObjectMeta) ListOptions {
|
||||
func SingleObject(meta metav1.ObjectMeta) ListOptions {
|
||||
return ListOptions{
|
||||
FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name),
|
||||
ResourceVersion: meta.ResourceVersion,
|
||||
|
@ -356,7 +356,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
node: &Node{
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
PreferAvoidPodsAnnotationKey: `
|
||||
{
|
||||
@ -401,7 +401,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
|
||||
{
|
||||
node: &Node{
|
||||
// Missing end symbol of "podController" and "podSignature"
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
PreferAvoidPodsAnnotationKey: `
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
)
|
||||
|
||||
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)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
@ -106,7 +106,7 @@ func TestRESTMapper(t *testing.T) {
|
||||
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)
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error: %v", err)
|
||||
|
100
pkg/api/meta.go
100
pkg/api/meta.go
@ -17,109 +17,11 @@ limitations under the License.
|
||||
package api
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
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.
|
||||
func HasObjectMetaSystemFieldValues(meta *ObjectMeta) bool {
|
||||
func HasObjectMetaSystemFieldValues(meta *metav1.ObjectMeta) bool {
|
||||
return !meta.CreationTimestamp.Time.IsZero() ||
|
||||
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
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ import (
|
||||
"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)
|
||||
references := objectMeta.OwnerReferences
|
||||
metaOwnerReferences = make([]metav1.OwnerReference, 0)
|
||||
@ -60,7 +60,7 @@ func testGetOwnerReferences(t *testing.T) {
|
||||
|
||||
func testSetOwnerReferences(t *testing.T) {
|
||||
expected, newRefs := getObjectMetaAndOwnerReferences()
|
||||
objectMeta := &api.ObjectMeta{}
|
||||
objectMeta := &metav1.ObjectMeta{}
|
||||
objectMeta.SetOwnerReferences(newRefs)
|
||||
if !reflect.DeepEqual(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)
|
||||
}
|
||||
lm, isLM := obj.(meta.ListMetaAccessor)
|
||||
om, isOM := obj.(meta.ObjectMetaAccessor)
|
||||
om, isOM := obj.(metav1.ObjectMetaAccessor)
|
||||
switch {
|
||||
case isLM && isOM:
|
||||
t.Errorf("%v (%v) implements ListMetaAccessor and ObjectMetaAccessor", gv.WithKind(kind), knownType)
|
||||
|
@ -31,7 +31,7 @@ func (obj *FakeAPIObject) GetObjectKind() schema.ObjectKind { return schema.Empt
|
||||
|
||||
type ExtensionAPIObject struct {
|
||||
metav1.TypeMeta
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
}
|
||||
|
||||
func (obj *ExtensionAPIObject) GetObjectKind() schema.ObjectKind { return &obj.TypeMeta }
|
||||
@ -53,7 +53,7 @@ func TestGetReference(t *testing.T) {
|
||||
}{
|
||||
"pod": {
|
||||
obj: &Pod{
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
UID: "bar",
|
||||
ResourceVersion: "42",
|
||||
@ -88,7 +88,7 @@ func TestGetReference(t *testing.T) {
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
Kind: "ExtensionAPIObject",
|
||||
},
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "foo",
|
||||
UID: "bar",
|
||||
ResourceVersion: "42",
|
||||
|
@ -23,6 +23,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||
"k8s.io/apimachinery/pkg/runtime/serializer/protobuf"
|
||||
@ -51,7 +52,7 @@ func init() {
|
||||
}
|
||||
|
||||
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()
|
||||
for _, mediaType := range []string{"application/json", "application/yaml", "application/vnd.kubernetes.protobuf"} {
|
||||
info, ok := runtime.SerializerInfoForMediaType(api.Codecs.SupportedMediaTypes(), mediaType)
|
||||
|
@ -356,7 +356,7 @@ func roundTrip(t *testing.T, codec runtime.Codec, item runtime.Object) {
|
||||
func TestEncodePtr(t *testing.T) {
|
||||
grace := int64(30)
|
||||
pod := &api.Pod{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{"name": "foo"},
|
||||
},
|
||||
Spec: api.PodSpec{
|
||||
|
@ -23,6 +23,8 @@ import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/google/gofuzz"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
@ -40,8 +42,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/apis/rbac"
|
||||
"k8s.io/kubernetes/pkg/fields"
|
||||
"k8s.io/kubernetes/pkg/util/intstr"
|
||||
|
||||
"github.com/google/gofuzz"
|
||||
)
|
||||
|
||||
// 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.Kind = ""
|
||||
},
|
||||
func(j *api.ObjectMeta, c fuzz.Continue) {
|
||||
func(j *metav1.ObjectMeta, c fuzz.Continue) {
|
||||
j.Name = c.RandString()
|
||||
j.ResourceVersion = strconv.FormatUint(c.RandUint64(), 10)
|
||||
j.SelfLink = c.RandString()
|
||||
|
@ -57,6 +57,7 @@ import (
|
||||
|
||||
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||
// users must create.
|
||||
// DEPRECATED: Use k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta instead - this type will be removed soon.
|
||||
type ObjectMeta struct {
|
||||
// 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
|
||||
@ -370,7 +371,7 @@ type PersistentVolumeClaimVolumeSource struct {
|
||||
type PersistentVolume struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
//Spec defines a persistent volume owned by the cluster
|
||||
// +optional
|
||||
@ -441,7 +442,7 @@ type PersistentVolumeList struct {
|
||||
type PersistentVolumeClaim struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the volume requested by a pod author
|
||||
// +optional
|
||||
@ -1981,7 +1982,7 @@ type PodStatus struct {
|
||||
type PodStatusResult struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
// Status represents the current information about a pod. This data may not be up
|
||||
// to date.
|
||||
// +optional
|
||||
@ -1994,7 +1995,7 @@ type PodStatusResult struct {
|
||||
type Pod struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the behavior of a pod.
|
||||
// +optional
|
||||
@ -2010,7 +2011,7 @@ type Pod struct {
|
||||
type PodTemplateSpec struct {
|
||||
// Metadata of the pods created from this template.
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the behavior of a pod.
|
||||
// +optional
|
||||
@ -2023,7 +2024,7 @@ type PodTemplateSpec struct {
|
||||
type PodTemplate struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Template defines the pods that will be created from this pod template
|
||||
// +optional
|
||||
@ -2128,7 +2129,7 @@ type ReplicationControllerCondition struct {
|
||||
type ReplicationController struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the desired behavior of this replication controller.
|
||||
// +optional
|
||||
@ -2333,7 +2334,7 @@ type ServicePort struct {
|
||||
type Service struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the behavior of a service.
|
||||
// +optional
|
||||
@ -2353,7 +2354,7 @@ type Service struct {
|
||||
type ServiceAccount struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Secrets is the list of secrets allowed to be used by pods running using this ServiceAccount
|
||||
Secrets []ObjectReference
|
||||
@ -2391,7 +2392,7 @@ type ServiceAccountList struct {
|
||||
type Endpoints struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// The set of all endpoints is the union of all subsets.
|
||||
Subsets []EndpointSubset
|
||||
@ -2713,7 +2714,7 @@ type ResourceList map[ResourceName]resource.Quantity
|
||||
type Node struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the behavior of a node.
|
||||
// +optional
|
||||
@ -2773,7 +2774,7 @@ const (
|
||||
type Namespace struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the behavior of the Namespace.
|
||||
// +optional
|
||||
@ -2798,7 +2799,7 @@ type Binding struct {
|
||||
metav1.TypeMeta
|
||||
// ObjectMeta describes the object that is being bound.
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Target is the object to bind to.
|
||||
Target ObjectReference
|
||||
@ -3026,7 +3027,7 @@ const (
|
||||
type Event struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Required. The object that this event is about.
|
||||
// +optional
|
||||
@ -3129,7 +3130,7 @@ type LimitRangeSpec struct {
|
||||
type LimitRange struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the limits enforced
|
||||
// +optional
|
||||
@ -3219,7 +3220,7 @@ type ResourceQuotaStatus struct {
|
||||
type ResourceQuota struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Spec defines the desired quota
|
||||
// +optional
|
||||
@ -3247,7 +3248,7 @@ type ResourceQuotaList struct {
|
||||
type Secret struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Data contains the secret data. Each key must be a valid DNS_SUBDOMAIN
|
||||
// or leading dot followed by valid DNS_SUBDOMAIN.
|
||||
@ -3362,7 +3363,7 @@ type SecretList struct {
|
||||
type ConfigMap struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// Data contains the configuration data.
|
||||
// Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.
|
||||
@ -3445,7 +3446,7 @@ type ComponentCondition struct {
|
||||
type ComponentStatus struct {
|
||||
metav1.TypeMeta
|
||||
// +optional
|
||||
ObjectMeta
|
||||
metav1.ObjectMeta
|
||||
|
||||
// +optional
|
||||
Conditions []ComponentCondition
|
||||
@ -3524,7 +3525,7 @@ type SELinuxOptions struct {
|
||||
type RangeAllocation struct {
|
||||
metav1.TypeMeta
|
||||
// +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
|
||||
// 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.
|
||||
|
@ -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 {
|
||||
if err := Convert_v1_ObjectMeta_To_api_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1_ReplicationControllerSpec_to_extensions_ReplicaSetSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
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 {
|
||||
if err := Convert_api_ObjectMeta_To_v1_ObjectMeta(&in.ObjectMeta, &out.ObjectMeta, s); err != nil {
|
||||
return err
|
||||
}
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_extensions_ReplicaSetSpec_to_v1_ReplicationControllerSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
fieldErr, ok := err.(*field.Error)
|
||||
if !ok {
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/api/resource"
|
||||
@ -59,7 +60,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
rc: &v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -72,14 +73,14 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
},
|
||||
{
|
||||
rc: &v1.ReplicationController{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"bar": "foo",
|
||||
},
|
||||
},
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -92,7 +93,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
},
|
||||
{
|
||||
rc: &v1.ReplicationController{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"bar": "foo",
|
||||
},
|
||||
@ -102,7 +103,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
"some": "other",
|
||||
},
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -120,7 +121,7 @@ func TestSetDefaultReplicationController(t *testing.T) {
|
||||
"some": "other",
|
||||
},
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -173,7 +174,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -188,7 +189,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(0),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -203,7 +204,7 @@ func TestSetDefaultReplicationControllerReplicas(t *testing.T) {
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -254,7 +255,7 @@ func TestSetDefaultReplicationControllerImagePullPolicy(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
"pod.beta.kubernetes.io/init-containers": string(containersWithoutPullPolicy),
|
||||
},
|
||||
@ -268,7 +269,7 @@ func TestSetDefaultReplicationControllerImagePullPolicy(t *testing.T) {
|
||||
rc: v1.ReplicationController{
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
"pod.beta.kubernetes.io/init-containers": string(containersWithPullPolicy),
|
||||
},
|
||||
@ -724,7 +725,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
|
||||
Spec: v1.ReplicationControllerSpec{
|
||||
Replicas: newInt(3),
|
||||
Template: &v1.PodTemplateSpec{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
"foo": "bar",
|
||||
},
|
||||
@ -744,7 +745,7 @@ func TestDefaultRequestIsNotSetForReplicationController(t *testing.T) {
|
||||
|
||||
func TestSetDefaultLimitRangeItem(t *testing.T) {
|
||||
limitRange := &v1.LimitRange{
|
||||
ObjectMeta: v1.ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "test-defaults",
|
||||
},
|
||||
Spec: v1.LimitRangeSpec{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -141,7 +141,7 @@ message Binding {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
optional ObjectReference target = 2;
|
||||
@ -240,7 +240,7 @@ message ComponentStatus {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// List of component conditions observed
|
||||
// +optional
|
||||
@ -263,7 +263,7 @@ message ConfigMap {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Data contains the configuration data.
|
||||
// Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.
|
||||
@ -767,7 +767,7 @@ message Endpoints {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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
|
||||
// subsets according to the IPs they share. A single address with multiple ports,
|
||||
@ -848,7 +848,7 @@ message EnvVarSource {
|
||||
message Event {
|
||||
// Standard object's 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.
|
||||
optional ObjectReference involvedObject = 2;
|
||||
@ -1195,7 +1195,7 @@ message LimitRange {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec defines the limits enforced.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec defines the behavior of the Namespace.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec defines the behavior of a node.
|
||||
// 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
|
||||
// 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 {
|
||||
// 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
|
||||
@ -1848,7 +1850,7 @@ message PersistentVolume {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// Provisioned by an administrator.
|
||||
@ -1869,7 +1871,7 @@ message PersistentVolumeClaim {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims
|
||||
@ -2111,7 +2113,7 @@ message Pod {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Specification of the desired behavior of the pod.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Most recently observed status of the pod.
|
||||
// This data may not be up to date.
|
||||
@ -2623,7 +2625,7 @@ message PodTemplate {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
@ -2647,7 +2649,7 @@ message PodTemplateSpec {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Specification of the desired behavior of the pod.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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'.
|
||||
optional string range = 2;
|
||||
@ -2821,7 +2823,7 @@ message ReplicationController {
|
||||
// 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
|
||||
// +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.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec defines the desired quota.
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
@ -3037,7 +3039,7 @@ message Secret {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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
|
||||
// or leading dot followed by valid DNS_SUBDOMAIN.
|
||||
@ -3169,7 +3171,7 @@ message Service {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +optional
|
||||
optional ObjectMeta metadata = 1;
|
||||
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec defines the behavior of a service.
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
@ -3192,7 +3194,7 @@ message ServiceAccount {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// More info: http://kubernetes.io/docs/user-guide/secrets
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
"k8s.io/apimachinery/pkg/selection"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
@ -86,26 +87,12 @@ var standardFinalizers = sets.NewString(
|
||||
FinalizerOrphan,
|
||||
)
|
||||
|
||||
// HasAnnotation returns a bool if passed in annotation exists
|
||||
func HasAnnotation(obj ObjectMeta, ann string) bool {
|
||||
_, found := obj.Annotations[ann]
|
||||
return found
|
||||
}
|
||||
|
||||
// SetMetaDataAnnotation sets the annotation and value
|
||||
func SetMetaDataAnnotation(obj *ObjectMeta, ann string, value string) {
|
||||
if obj.Annotations == nil {
|
||||
obj.Annotations = make(map[string]string)
|
||||
}
|
||||
obj.Annotations[ann] = value
|
||||
}
|
||||
|
||||
func IsStandardFinalizerName(str string) bool {
|
||||
return standardFinalizers.Has(str)
|
||||
}
|
||||
|
||||
// SingleObject returns a ListOptions for watching a single object.
|
||||
func SingleObject(meta ObjectMeta) ListOptions {
|
||||
func SingleObject(meta metav1.ObjectMeta) ListOptions {
|
||||
return ListOptions{
|
||||
FieldSelector: fields.OneTermEqualSelector("metadata.name", meta.Name).String(),
|
||||
ResourceVersion: meta.ResourceVersion,
|
||||
|
@ -190,7 +190,7 @@ func TestGetAffinityFromPod(t *testing.T) {
|
||||
},
|
||||
{
|
||||
pod: &Pod{
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
AffinityAnnotationKey: `
|
||||
{"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
@ -209,7 +209,7 @@ func TestGetAffinityFromPod(t *testing.T) {
|
||||
},
|
||||
{
|
||||
pod: &Pod{
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
AffinityAnnotationKey: `
|
||||
{"nodeAffinity": { "requiredDuringSchedulingIgnoredDuringExecution": {
|
||||
@ -350,7 +350,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
|
||||
},
|
||||
{
|
||||
node: &Node{
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
PreferAvoidPodsAnnotationKey: `
|
||||
{
|
||||
@ -395,7 +395,7 @@ func TestGetAvoidPodsFromNode(t *testing.T) {
|
||||
{
|
||||
node: &Node{
|
||||
// Missing end symbol of "podController" and "podSignature"
|
||||
ObjectMeta: ObjectMeta{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Annotations: map[string]string{
|
||||
PreferAvoidPodsAnnotationKey: `
|
||||
{
|
||||
|
@ -17,14 +17,13 @@ limitations under the License.
|
||||
package v1
|
||||
|
||||
import (
|
||||
"k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"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.
|
||||
func (meta *ObjectMeta) GetNamespace() string { return meta.Namespace }
|
||||
func (meta *ObjectMeta) SetNamespace(namespace string) { meta.Namespace = namespace }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -65,6 +65,8 @@ import (
|
||||
|
||||
// ObjectMeta is metadata that all persisted resources must have, which includes all objects
|
||||
// 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 {
|
||||
// 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
|
||||
@ -422,7 +424,7 @@ type PersistentVolume struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// Provisioned by an administrator.
|
||||
@ -514,7 +516,7 @@ type PersistentVolumeClaim struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// More info: http://kubernetes.io/docs/user-guide/persistent-volumes#persistentvolumeclaims
|
||||
@ -2252,7 +2254,7 @@ type PodStatusResult struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// This data may not be up to date.
|
||||
// Populated by the system.
|
||||
@ -2271,7 +2273,7 @@ type Pod struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// 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.
|
||||
// Standard object's metadata. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
@ -2719,7 +2721,7 @@ type ServiceAccount struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// More info: http://kubernetes.io/docs/user-guide/secrets
|
||||
@ -2766,7 +2768,7 @@ type Endpoints struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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
|
||||
// subsets according to the IPs they share. A single address with multiple ports,
|
||||
@ -3124,7 +3126,7 @@ type Node struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
@ -3196,7 +3198,7 @@ type Namespace struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
Target ObjectReference `json:"target" protobuf:"bytes,2,opt,name=target"`
|
||||
@ -3517,7 +3519,7 @@ type Event struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object's 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.
|
||||
InvolvedObject ObjectReference `json:"involvedObject" protobuf:"bytes,2,opt,name=involvedObject"`
|
||||
@ -3626,7 +3628,7 @@ type LimitRange struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// 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.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status
|
||||
@ -3759,7 +3761,7 @@ type Secret struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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
|
||||
// or leading dot followed by valid DNS_SUBDOMAIN.
|
||||
@ -3886,7 +3888,7 @@ type ConfigMap struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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.
|
||||
// Each key must be a valid DNS_SUBDOMAIN with an optional leading dot.
|
||||
@ -3941,7 +3943,7 @@ type ComponentStatus struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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
|
||||
// +optional
|
||||
@ -4059,7 +4061,7 @@ type RangeAllocation struct {
|
||||
// Standard object's metadata.
|
||||
// More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata
|
||||
// +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 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
Loading…
Reference in New Issue
Block a user