Commit 88b10b1d authored by nikhiljindal's avatar nikhiljindal

Removing unneeded fields from Cluster API object

parent 1f628500
...@@ -22,7 +22,6 @@ package federation ...@@ -22,7 +22,6 @@ package federation
import ( import (
api "k8s.io/kubernetes/pkg/api" api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
unversioned "k8s.io/kubernetes/pkg/api/unversioned" unversioned "k8s.io/kubernetes/pkg/api/unversioned"
conversion "k8s.io/kubernetes/pkg/conversion" conversion "k8s.io/kubernetes/pkg/conversion"
) )
...@@ -32,7 +31,6 @@ func init() { ...@@ -32,7 +31,6 @@ func init() {
DeepCopy_federation_Cluster, DeepCopy_federation_Cluster,
DeepCopy_federation_ClusterCondition, DeepCopy_federation_ClusterCondition,
DeepCopy_federation_ClusterList, DeepCopy_federation_ClusterList,
DeepCopy_federation_ClusterMeta,
DeepCopy_federation_ClusterSpec, DeepCopy_federation_ClusterSpec,
DeepCopy_federation_ClusterStatus, DeepCopy_federation_ClusterStatus,
DeepCopy_federation_ServerAddressByClientCIDR, DeepCopy_federation_ServerAddressByClientCIDR,
...@@ -93,11 +91,6 @@ func DeepCopy_federation_ClusterList(in ClusterList, out *ClusterList, c *conver ...@@ -93,11 +91,6 @@ func DeepCopy_federation_ClusterList(in ClusterList, out *ClusterList, c *conver
return nil 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 { func DeepCopy_federation_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil { if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
...@@ -134,35 +127,6 @@ func DeepCopy_federation_ClusterStatus(in ClusterStatus, out *ClusterStatus, c * ...@@ -134,35 +127,6 @@ func DeepCopy_federation_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *
} else { } else {
out.Conditions = nil 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 { if in.Zones != nil {
in, out := in.Zones, &out.Zones in, out := in.Zones, &out.Zones
*out = make([]string, len(in)) *out = make([]string, len(in))
......
...@@ -71,21 +71,10 @@ type ClusterCondition struct { ...@@ -71,21 +71,10 @@ type ClusterCondition struct {
Message string `json:"message,omitempty"` Message string `json:"message,omitempty"`
} }
// Cluster metadata
type ClusterMeta struct {
// Release version of the cluster.
Version string `json:"version,omitempty"`
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally. // ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
type ClusterStatus struct { type ClusterStatus struct {
// Conditions is an array of current cluster conditions. // Conditions is an array of current cluster conditions.
Conditions []ClusterCondition `json:"conditions,omitempty"` Conditions []ClusterCondition `json:"conditions,omitempty"`
// Capacity represents the total resources of the cluster
Capacity api.ResourceList `json:"capacity,omitempty"`
// Allocatable represents the total resources of a cluster that are available for scheduling.
Allocatable api.ResourceList `json:"allocatable,omitempty"`
ClusterMeta `json:",inline"`
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'. // Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
// These will always be in the same region. // These will always be in the same region.
Zones []string `json:"zones,omitempty"` Zones []string `json:"zones,omitempty"`
......
...@@ -23,7 +23,6 @@ package v1alpha1 ...@@ -23,7 +23,6 @@ package v1alpha1
import ( import (
federation "k8s.io/kubernetes/federation/apis/federation" federation "k8s.io/kubernetes/federation/apis/federation"
api "k8s.io/kubernetes/pkg/api" api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
v1 "k8s.io/kubernetes/pkg/api/v1" v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion" conversion "k8s.io/kubernetes/pkg/conversion"
) )
...@@ -36,8 +35,6 @@ func init() { ...@@ -36,8 +35,6 @@ func init() {
Convert_federation_ClusterCondition_To_v1alpha1_ClusterCondition, Convert_federation_ClusterCondition_To_v1alpha1_ClusterCondition,
Convert_v1alpha1_ClusterList_To_federation_ClusterList, Convert_v1alpha1_ClusterList_To_federation_ClusterList,
Convert_federation_ClusterList_To_v1alpha1_ClusterList, Convert_federation_ClusterList_To_v1alpha1_ClusterList,
Convert_v1alpha1_ClusterMeta_To_federation_ClusterMeta,
Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta,
Convert_v1alpha1_ClusterSpec_To_federation_ClusterSpec, Convert_v1alpha1_ClusterSpec_To_federation_ClusterSpec,
Convert_federation_ClusterSpec_To_v1alpha1_ClusterSpec, Convert_federation_ClusterSpec_To_v1alpha1_ClusterSpec,
Convert_v1alpha1_ClusterStatus_To_federation_ClusterStatus, Convert_v1alpha1_ClusterStatus_To_federation_ClusterStatus,
...@@ -178,24 +175,6 @@ func Convert_federation_ClusterList_To_v1alpha1_ClusterList(in *federation.Clust ...@@ -178,24 +175,6 @@ func Convert_federation_ClusterList_To_v1alpha1_ClusterList(in *federation.Clust
return autoConvert_federation_ClusterList_To_v1alpha1_ClusterList(in, out, s) return autoConvert_federation_ClusterList_To_v1alpha1_ClusterList(in, out, s)
} }
func autoConvert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(in *ClusterMeta, out *federation.ClusterMeta, s conversion.Scope) error {
out.Version = in.Version
return nil
}
func Convert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(in *ClusterMeta, out *federation.ClusterMeta, s conversion.Scope) error {
return autoConvert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(in, out, s)
}
func autoConvert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in *federation.ClusterMeta, out *ClusterMeta, s conversion.Scope) error {
out.Version = in.Version
return nil
}
func Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in *federation.ClusterMeta, out *ClusterMeta, s conversion.Scope) error {
return autoConvert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(in, out, s)
}
func autoConvert_v1alpha1_ClusterSpec_To_federation_ClusterSpec(in *ClusterSpec, out *federation.ClusterSpec, s conversion.Scope) error { func autoConvert_v1alpha1_ClusterSpec_To_federation_ClusterSpec(in *ClusterSpec, out *federation.ClusterSpec, s conversion.Scope) error {
if in.ServerAddressByClientCIDRs != nil { if in.ServerAddressByClientCIDRs != nil {
in, out := &in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs in, out := &in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
...@@ -266,15 +245,6 @@ func autoConvert_v1alpha1_ClusterStatus_To_federation_ClusterStatus(in *ClusterS ...@@ -266,15 +245,6 @@ func autoConvert_v1alpha1_ClusterStatus_To_federation_ClusterStatus(in *ClusterS
} else { } else {
out.Conditions = nil out.Conditions = nil
} }
if err := v1.Convert_v1_ResourceList_To_api_ResourceList(&in.Capacity, &out.Capacity, s); err != nil {
return err
}
if err := v1.Convert_v1_ResourceList_To_api_ResourceList(&in.Allocatable, &out.Allocatable, s); err != nil {
return err
}
if err := Convert_v1alpha1_ClusterMeta_To_federation_ClusterMeta(&in.ClusterMeta, &out.ClusterMeta, s); err != nil {
return err
}
out.Zones = in.Zones out.Zones = in.Zones
out.Region = in.Region out.Region = in.Region
return nil return nil
...@@ -296,35 +266,6 @@ func autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in *federati ...@@ -296,35 +266,6 @@ func autoConvert_federation_ClusterStatus_To_v1alpha1_ClusterStatus(in *federati
} else { } else {
out.Conditions = nil out.Conditions = nil
} }
if in.Capacity != nil {
in, out := &in.Capacity, &out.Capacity
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
newVal := new(resource.Quantity)
if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, newVal, s); err != nil {
return err
}
(*out)[v1.ResourceName(key)] = *newVal
}
} else {
out.Capacity = nil
}
if in.Allocatable != nil {
in, out := &in.Allocatable, &out.Allocatable
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
newVal := new(resource.Quantity)
if err := api.Convert_resource_Quantity_To_resource_Quantity(&val, newVal, s); err != nil {
return err
}
(*out)[v1.ResourceName(key)] = *newVal
}
} else {
out.Allocatable = nil
}
if err := Convert_federation_ClusterMeta_To_v1alpha1_ClusterMeta(&in.ClusterMeta, &out.ClusterMeta, s); err != nil {
return err
}
out.Zones = in.Zones out.Zones = in.Zones
out.Region = in.Region out.Region = in.Region
return nil return nil
......
...@@ -22,7 +22,6 @@ package v1alpha1 ...@@ -22,7 +22,6 @@ package v1alpha1
import ( import (
api "k8s.io/kubernetes/pkg/api" api "k8s.io/kubernetes/pkg/api"
resource "k8s.io/kubernetes/pkg/api/resource"
unversioned "k8s.io/kubernetes/pkg/api/unversioned" unversioned "k8s.io/kubernetes/pkg/api/unversioned"
v1 "k8s.io/kubernetes/pkg/api/v1" v1 "k8s.io/kubernetes/pkg/api/v1"
conversion "k8s.io/kubernetes/pkg/conversion" conversion "k8s.io/kubernetes/pkg/conversion"
...@@ -33,7 +32,6 @@ func init() { ...@@ -33,7 +32,6 @@ func init() {
DeepCopy_v1alpha1_Cluster, DeepCopy_v1alpha1_Cluster,
DeepCopy_v1alpha1_ClusterCondition, DeepCopy_v1alpha1_ClusterCondition,
DeepCopy_v1alpha1_ClusterList, DeepCopy_v1alpha1_ClusterList,
DeepCopy_v1alpha1_ClusterMeta,
DeepCopy_v1alpha1_ClusterSpec, DeepCopy_v1alpha1_ClusterSpec,
DeepCopy_v1alpha1_ClusterStatus, DeepCopy_v1alpha1_ClusterStatus,
DeepCopy_v1alpha1_ServerAddressByClientCIDR, DeepCopy_v1alpha1_ServerAddressByClientCIDR,
...@@ -94,11 +92,6 @@ func DeepCopy_v1alpha1_ClusterList(in ClusterList, out *ClusterList, c *conversi ...@@ -94,11 +92,6 @@ func DeepCopy_v1alpha1_ClusterList(in ClusterList, out *ClusterList, c *conversi
return nil return nil
} }
func DeepCopy_v1alpha1_ClusterMeta(in ClusterMeta, out *ClusterMeta, c *conversion.Cloner) error {
out.Version = in.Version
return nil
}
func DeepCopy_v1alpha1_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error { func DeepCopy_v1alpha1_ClusterSpec(in ClusterSpec, out *ClusterSpec, c *conversion.Cloner) error {
if in.ServerAddressByClientCIDRs != nil { if in.ServerAddressByClientCIDRs != nil {
in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs in, out := in.ServerAddressByClientCIDRs, &out.ServerAddressByClientCIDRs
...@@ -135,35 +128,6 @@ func DeepCopy_v1alpha1_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *co ...@@ -135,35 +128,6 @@ func DeepCopy_v1alpha1_ClusterStatus(in ClusterStatus, out *ClusterStatus, c *co
} else { } else {
out.Conditions = nil out.Conditions = nil
} }
if in.Capacity != nil {
in, out := in.Capacity, &out.Capacity
*out = make(v1.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(v1.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_v1alpha1_ClusterMeta(in.ClusterMeta, &out.ClusterMeta, c); err != nil {
return err
}
if in.Zones != nil { if in.Zones != nil {
in, out := in.Zones, &out.Zones in, out := in.Zones, &out.Zones
*out = make([]string, len(in)) *out = make([]string, len(in))
......
...@@ -21,7 +21,6 @@ syntax = 'proto2'; ...@@ -21,7 +21,6 @@ syntax = 'proto2';
package k8s.io.kubernetes.federation.apis.federation.v1alpha1; package k8s.io.kubernetes.federation.apis.federation.v1alpha1;
import "k8s.io/kubernetes/pkg/api/resource/generated.proto";
import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto"; import "k8s.io/kubernetes/pkg/api/unversioned/generated.proto";
import "k8s.io/kubernetes/pkg/api/v1/generated.proto"; import "k8s.io/kubernetes/pkg/api/v1/generated.proto";
import "k8s.io/kubernetes/pkg/util/intstr/generated.proto"; import "k8s.io/kubernetes/pkg/util/intstr/generated.proto";
...@@ -73,12 +72,6 @@ message ClusterList { ...@@ -73,12 +72,6 @@ message ClusterList {
repeated Cluster items = 2; repeated Cluster items = 2;
} }
// Cluster metadata
message ClusterMeta {
// Release version of the cluster.
optional string version = 1;
}
// ClusterSpec describes the attributes of a kubernetes cluster. // ClusterSpec describes the attributes of a kubernetes cluster.
message ClusterSpec { message ClusterSpec {
// A map of client CIDR to server address. // A map of client CIDR to server address.
...@@ -100,14 +93,6 @@ message ClusterStatus { ...@@ -100,14 +93,6 @@ message ClusterStatus {
// Conditions is an array of current cluster conditions. // Conditions is an array of current cluster conditions.
repeated ClusterCondition conditions = 1; repeated ClusterCondition conditions = 1;
// Capacity represents the total resources of the cluster
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> capacity = 2;
// Allocatable represents the total resources of a cluster that are available for scheduling.
map<string, k8s.io.kubernetes.pkg.api.resource.Quantity> allocatable = 3;
optional ClusterMeta clusterMeta = 4;
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'. // Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
// These will always be in the same region. // These will always be in the same region.
repeated string zones = 5; repeated string zones = 5;
......
...@@ -71,21 +71,10 @@ type ClusterCondition struct { ...@@ -71,21 +71,10 @@ type ClusterCondition struct {
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"` Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
} }
// Cluster metadata
type ClusterMeta struct {
// Release version of the cluster.
Version string `json:"version,omitempty" protobuf:"bytes,1,opt,name=version"`
}
// ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally. // ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.
type ClusterStatus struct { type ClusterStatus struct {
// Conditions is an array of current cluster conditions. // Conditions is an array of current cluster conditions.
Conditions []ClusterCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"` Conditions []ClusterCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
// Capacity represents the total resources of the cluster
Capacity v1.ResourceList `json:"capacity,omitempty" protobuf:"bytes,2,rep,name=capacity,casttype=k8s.io/kubernetes/pkg/api/v1.ResourceList,castkey=k8s.io/kubernetes/pkg/api/v1.ResourceName"`
// Allocatable represents the total resources of a cluster that are available for scheduling.
Allocatable v1.ResourceList `json:"allocatable,omitempty" protobuf:"bytes,3,rep,name=allocatable,casttype=k8s.io/kubernetes/pkg/api/v1.ResourceList,castkey=k8s.io/kubernetes/pkg/api/v1.ResourceName"`
ClusterMeta `json:",inline" protobuf:"bytes,4,opt,name=clusterMeta"`
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'. // Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
// These will always be in the same region. // These will always be in the same region.
Zones []string `json:"zones,omitempty" protobuf:"bytes,5,rep,name=zones"` Zones []string `json:"zones,omitempty" protobuf:"bytes,5,rep,name=zones"`
......
...@@ -2116,22 +2116,6 @@ func describeCluster(cluster *federation.Cluster) (string, error) { ...@@ -2116,22 +2116,6 @@ func describeCluster(cluster *federation.Cluster) (string, error) {
c.Message) c.Message)
} }
} }
fmt.Fprintf(out, "Version:\t%s\n", cluster.Status.Version)
if len(cluster.Status.Capacity) > 0 {
fmt.Fprintf(out, "Capacity:\n")
for resource, value := range cluster.Status.Capacity {
fmt.Fprintf(out, " %s:\t%s\n", resource, value.String())
}
}
if len(cluster.Status.Allocatable) > 0 {
fmt.Fprintf(out, "Allocatable:\n")
for resource, value := range cluster.Status.Allocatable {
fmt.Fprintf(out, " %s:\t%s\n", resource, value.String())
}
}
return nil return nil
}) })
} }
......
...@@ -568,7 +568,7 @@ func TestDescribeCluster(t *testing.T) { ...@@ -568,7 +568,7 @@ func TestDescribeCluster(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("unexpected error: %v", err) t.Errorf("unexpected error: %v", err)
} }
if !strings.Contains(out, "foo") || !strings.Contains(out, "Version:") { if !strings.Contains(out, "foo") {
t.Errorf("unexpected out: %s", out) t.Errorf("unexpected out: %s", out)
} }
} }
......
...@@ -863,10 +863,9 @@ func printCluster(c *federation.Cluster, w io.Writer, options PrintOptions) erro ...@@ -863,10 +863,9 @@ func printCluster(c *federation.Cluster, w io.Writer, options PrintOptions) erro
statuses = append(statuses, "Unknown") statuses = append(statuses, "Unknown")
} }
if _, err := fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", if _, err := fmt.Fprintf(w, "%s\t%s\t%s\n",
c.Name, c.Name,
strings.Join(statuses, ","), strings.Join(statuses, ","),
c.Status.Version,
translateTimestamp(c.CreationTimestamp), translateTimestamp(c.CreationTimestamp),
); err != nil { ); err != nil {
return err return err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment