Skip to content

Commit

Permalink
Merge pull request #28186 from nikhiljindal/betaAPI
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

federation: Upgrading the groupversion to v1beta1

This PR contains 2 commits:
* Removing fields from Cluster API object that we are not using. This includes: Capacity, Allocatable and ClusterMeta.
* Move code and rename groupversion `federation/v1alpha1` to `federation/v1beta1`


cc @kubernetes/sig-cluster-federation
  • Loading branch information
k8s-merge-robot authored Jun 29, 2016
2 parents d965b47 + 7fcf8da commit 044de6e
Show file tree
Hide file tree
Showing 48 changed files with 598 additions and 1,871 deletions.
2 changes: 1 addition & 1 deletion cmd/libs/go2idl/conversion-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
"k8s.io/kubernetes/pkg/apis/rbac",
"k8s.io/kubernetes/pkg/apis/rbac/v1alpha1",
"k8s.io/kubernetes/federation/apis/federation",
"k8s.io/kubernetes/federation/apis/federation/v1alpha1",
"k8s.io/kubernetes/federation/apis/federation/v1beta1",
"k8s.io/kubernetes/pkg/conversion",
"k8s.io/kubernetes/pkg/runtime",
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/libs/go2idl/deepcopy-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func main() {
"k8s.io/kubernetes/pkg/apis/rbac",
"k8s.io/kubernetes/pkg/apis/rbac/v1alpha1",
"k8s.io/kubernetes/federation/apis/federation",
"k8s.io/kubernetes/federation/apis/federation/v1alpha1",
"k8s.io/kubernetes/federation/apis/federation/v1beta1",
}

if err := arguments.Execute(
Expand Down
2 changes: 1 addition & 1 deletion cmd/libs/go2idl/go-to-protobuf/protobuf/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func New() *Generator {
`k8s.io/kubernetes/pkg/apis/batch/v2alpha1`,
`k8s.io/kubernetes/pkg/apis/apps/v1alpha1`,
`k8s.io/kubernetes/pkg/apis/rbac/v1alpha1`,
`k8s.io/kubernetes/federation/apis/federation/v1alpha1`,
`k8s.io/kubernetes/federation/apis/federation/v1beta1`,
`k8s.io/kubernetes/pkg/apis/certificates/v1alpha1`,
}, ","),
DropEmbeddedFields: "k8s.io/kubernetes/pkg/api/unversioned.TypeMeta",
Expand Down
36 changes: 0 additions & 36 deletions federation/apis/federation/deep_copy_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package federation

import (
api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion"
)
Expand All @@ -32,7 +31,6 @@ func init() {
DeepCopy_federation_Cluster,
DeepCopy_federation_ClusterCondition,
DeepCopy_federation_ClusterList,
DeepCopy_federation_ClusterMeta,
DeepCopy_federation_ClusterSpec,
DeepCopy_federation_ClusterStatus,
DeepCopy_federation_ServerAddressByClientCIDR,
Expand Down Expand Up @@ -93,11 +91,6 @@ func DeepCopy_federation_ClusterList(in ClusterList, out *ClusterList, c *conver
return nil
}

func DeepCopy_federation_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conversion.Cloner) error {
out.Version = in.Version
return nil
}

func DeepCopy_federation_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
Expand Down Expand Up @@ -134,35 +127,6 @@ func DeepCopy_federation_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *
} else {
out.Conditions = nil
}
if in.Capacity != nil {
in, out := in.Capacity, &out.Capacity
*out = make(api.ResourceList)
for key, val := range in {
newVal := new(resource.Quantity)
if err := resource.DeepCopy_resource_Quantity(val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Capacity = nil
}
if in.Allocatable != nil {
in, out := in.Allocatable, &out.Allocatable
*out = make(api.ResourceList)
for key, val := range in {
newVal := new(resource.Quantity)
if err := resource.DeepCopy_resource_Quantity(val, newVal, c); err != nil {
return err
}
(*out)[key] = *newVal
}
} else {
out.Allocatable = nil
}
if err := DeepCopy_federation_ClusterMeta(in.ClusterMeta, &out.ClusterMeta, c); err != nil {
return err
}
if in.Zones != nil {
in, out := in.Zones, &out.Zones
*out = make([]string, len(in))
Expand Down
10 changes: 5 additions & 5 deletions federation/apis/federation/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/golang/glog"

"k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/federation/apis/federation/v1alpha1"
"k8s.io/kubernetes/federation/apis/federation/v1beta1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/meta"
"k8s.io/kubernetes/pkg/api/unversioned"
Expand All @@ -37,7 +37,7 @@ const importPrefix = "k8s.io/kubernetes/federation/apis/federation"
var accessor = meta.NewAccessor()

// availableVersions lists all known external versions for this group from most preferred to least preferred
var availableVersions = []unversioned.GroupVersion{v1alpha1.SchemeGroupVersion}
var availableVersions = []unversioned.GroupVersion{v1beta1.SchemeGroupVersion}

func init() {
registered.RegisterVersions(availableVersions)
Expand Down Expand Up @@ -101,7 +101,7 @@ func newRESTMapper(externalVersions []unversioned.GroupVersion) meta.RESTMapper
// string, or an error if the version is not known.
func interfacesFor(version unversioned.GroupVersion) (*meta.VersionInterfaces, error) {
switch version {
case v1alpha1.SchemeGroupVersion:
case v1beta1.SchemeGroupVersion:
return &meta.VersionInterfaces{
ObjectConvertor: api.Scheme,
MetadataAccessor: accessor,
Expand All @@ -122,8 +122,8 @@ func addVersionsToScheme(externalVersions ...unversioned.GroupVersion) {
continue
}
switch v {
case v1alpha1.SchemeGroupVersion:
v1alpha1.AddToScheme(api.Scheme)
case v1beta1.SchemeGroupVersion:
v1beta1.AddToScheme(api.Scheme)
}
}
}
4 changes: 2 additions & 2 deletions federation/apis/federation/install/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"testing"

"k8s.io/kubernetes/federation/apis/federation"
"k8s.io/kubernetes/federation/apis/federation/v1alpha1"
"k8s.io/kubernetes/federation/apis/federation/v1beta1"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apimachinery/registered"
Expand Down Expand Up @@ -77,7 +77,7 @@ func TestInterfacesFor(t *testing.T) {
}

func TestRESTMapper(t *testing.T) {
gv := v1alpha1.SchemeGroupVersion
gv := v1beta1.SchemeGroupVersion
clusterGVK := gv.WithKind("Cluster")

if gvk, err := registered.GroupOrDie(federation.GroupName).RESTMapper.KindFor(gv.WithResource("clusters")); err != nil || gvk != clusterGVK {
Expand Down
Loading

0 comments on commit 044de6e

Please sign in to comment.